@@ 373-389 (lines=17) @@ | ||
370 | if "xml" in anyconfig.backends.list_types(): |
|
371 | self._load_and_dump_with_opened_files("a.xml", 'rb', 'wb') |
|
372 | ||
373 | def test_30_open_bson_file(self): |
|
374 | if "bson" in anyconfig.backends.list_types(): |
|
375 | self._load_and_dump_with_opened_files("a.bson", 'rb', 'wb') |
|
376 | ||
377 | def test_40_open_yaml_file(self): |
|
378 | if "yaml" in anyconfig.backends.list_types(): |
|
379 | self._load_and_dump_with_opened_files("a.yaml") |
|
380 | self._load_and_dump_with_opened_files("a.yml") |
|
381 | ||
382 | ||
383 | class Test_34_single_load(TestBaseWithIO): |
|
384 | ||
385 | def test_10_single_load_w_validation(self): |
|
386 | cnf_path = os.path.join(self.workdir, "cnf.json") |
|
387 | scm_path = os.path.join(self.workdir, "scm.json") |
|
388 | TT.dump(CNF_0, cnf_path) |
|
389 | TT.dump(SCM_0, scm_path) |
|
390 | ||
391 | cnf_2 = TT.single_load(cnf_path, ac_context={}, ac_schema=scm_path) |
|
392 | ||
@@ 631-645 (lines=15) @@ | ||
628 | ||
629 | cnf_2 = TT.load(cnf_path, ac_context={}, ac_schema=scm_path) |
|
630 | ||
631 | self.assertEqual(cnf_2["name"], CNF_0["name"]) |
|
632 | self.assertEqual(cnf_2["a"], CNF_0["a"]) |
|
633 | self.assertEqual(cnf_2["b"]["b"], CNF_0["b"]["b"]) |
|
634 | self.assertEqual(cnf_2["b"]["c"], CNF_0["b"]["c"]) |
|
635 | ||
636 | def test_38_load_w_validation_yaml(self): |
|
637 | cnf_path = os.path.join(self.workdir, "cnf.yml") |
|
638 | scm_path = os.path.join(self.workdir, "scm.yml") |
|
639 | TT.dump(CNF_0, cnf_path) |
|
640 | TT.dump(SCM_0, scm_path) |
|
641 | ||
642 | cnf_2 = TT.load(cnf_path, ac_context={}, ac_schema=scm_path) |
|
643 | ||
644 | self.assertEqual(cnf_2["name"], CNF_0["name"]) |
|
645 | self.assertEqual(cnf_2["a"], CNF_0["a"]) |
|
646 | self.assertEqual(cnf_2["b"]["b"], CNF_0["b"]["b"]) |
|
647 | self.assertEqual(cnf_2["b"]["c"], CNF_0["b"]["c"]) |
|
648 |