comparison tests/test.py @ 134:2f2e819e8d17

Check the return type of the JSON and YAML loading functions: they must be a dict alike
author Franz Glasner <hg@dom66.de>
date Thu, 05 Apr 2018 09:12:29 +0200
parents b11af3ded7c1
children d8d47893df5b
comparison
equal deleted inserted replaced
133:05cb18c8697a 134:2f2e819e8d17
64 64
65 def test03_yaml_types(self): 65 def test03_yaml_types(self):
66 with io.open(os.path.join(TESTDATADIR, "conf1.yml"), "rt", 66 with io.open(os.path.join(TESTDATADIR, "conf1.yml"), "rt",
67 encoding="utf-8") as f: 67 encoding="utf-8") as f:
68 cfg = configmix.yaml.safe_load(f) 68 cfg = configmix.yaml.safe_load(f)
69 if configmix.yaml.OrderedDict:
70 self.assertTrue(isinstance(cfg, configmix.yaml.OrderedDict))
69 self.__check_types(cfg) 71 self.__check_types(cfg)
70 72
71 def test04_json_types(self): 73 def test04_json_types(self):
72 cfg = configmix.json.load(os.path.join(TESTDATADIR, "conf1.json")) 74 cfg = configmix.json.load(os.path.join(TESTDATADIR, "conf1.json"))
73 self.assertTrue(isinstance(cfg, configmix.json.DictImpl)) 75 self.assertTrue(isinstance(cfg, configmix.json.DictImpl))