File: test_decoder.py

package info (click to toggle)
python-dom-toml 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,080 kB
  • sloc: python: 1,778; makefile: 7
file content (25 lines) | stat: -rw-r--r-- 621 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# stdlib
from textwrap import dedent

# this package
from dom_toml import loads
from dom_toml.decoder import InlineTableDict, TomlPureDecoder


def test_decoder():

	config = dedent("""\
	[project]
	license = {file = "LICENSE"}
	""")

	data = loads(config)["project"]
	assert isinstance(data, dict)
	assert isinstance(data["license"], dict)
	assert isinstance(data["license"], InlineTableDict)

	data = loads(config, decoder=TomlPureDecoder)["project"]
	assert isinstance(data, dict)
	assert isinstance(data["license"], dict)
	assert not isinstance(data["license"], InlineTableDict)
	assert type(data["license"]) is dict