/
toml.py
58 lines (42 loc) · 1.6 KB
/
toml.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# Copyright (C) 2015 - 2019 Satoru SATOH <satoru.satoh@gmail.com>
# Copyright (C) 2017 Red Hat, Inc.
# License: MIT
#
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods
# pylint: disable=ungrouped-imports
from __future__ import absolute_import
try:
import anyconfig.backend.toml as TT
except ImportError:
import tests.common
raise tests.common.skip_test()
import tests.backend.common as TBC
from anyconfig.compat import OrderedDict as ODict
_DOB = TT.toml.loads("dob = 1979-05-27T07:32:00Z")['dob']
CNF = ODict((('title', 'TOML Example'),
('owner',
ODict((('name', 'Tom Preston-Werner'),
('dob', _DOB)))),
('database',
ODict((('server', '192.168.1.1'),
('ports', [8001, 8001, 8002]),
('connection_max', 5000),
('enabled', True)))),
('servers',
ODict((('alpha',
ODict((('ip', '10.0.0.1'), ('dc', 'eqdc10')))),
('beta',
ODict((('ip', '10.0.0.2'), ('dc', 'eqdc10'))))))),
('clients',
ODict((('data', [['gamma', 'delta'], [1, 2]]),
('hosts', ['alpha', 'omega']))))))
class HasParserTrait(TBC.HasParserTrait):
psr = TT.Parser()
cnf = CNF
cnf_s = TBC.read_from_res("20-00-cnf.toml")
class Test_10(TBC.Test_10_dumps_and_loads, HasParserTrait):
load_options = dump_options = dict(dummy="this_will_be_ignored")
class Test_20(TBC.Test_20_dump_and_load, HasParserTrait):
pass
# vim:sw=4:ts=4:et: