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