Ejemplo n.º 1
0
    def test_48_loads_w_validation(self):
        cnf_s = TT.dumps(CNF_0, "json")
        scm_s = TT.dumps(SCM_0, "json")
        cnf_2 = TT.loads(cnf_s, ac_parser="json", ac_context={},
                         ac_schema=scm_s)

        self.assertEqual(cnf_2["name"], CNF_0["name"])
        self.assertEqual(cnf_2["a"], CNF_0["a"])
        self.assertEqual(cnf_2["b"]["b"], CNF_0["b"]["b"])
        self.assertEqual(cnf_2["b"]["c"], CNF_0["b"]["c"])
Ejemplo n.º 2
0
    def test_48_loads_w_validation(self):
        cnf_s = TT.dumps(CNF_0, "json")
        scm_s = TT.dumps(SCM_0, "json")
        cnf_2 = TT.loads(cnf_s, ac_parser="json", ac_context={},
                         ac_schema=scm_s)

        self.assertEqual(cnf_2["name"], CNF_0["name"])
        self.assertEqual(cnf_2["a"], CNF_0["a"])
        self.assertEqual(cnf_2["b"]["b"], CNF_0["b"]["b"])
        self.assertEqual(cnf_2["b"]["c"], CNF_0["b"]["c"])
Ejemplo n.º 3
0
    def test_30_dumps_and_loads(self):
        a = dict(name="a", a=1, b=dict(b=[1, 2], c="C"))
        a1 = A.loads(A.dumps(a, "json"), "json")

        self.assertEquals(a1["name"],   a["name"])
        self.assertEquals(a1["a"],      a["a"])
        self.assertEquals(a1["b"]["b"], a["b"]["b"])
        self.assertEquals(a1["b"]["c"], a["b"]["c"])
Ejemplo n.º 4
0
    def test_30_dumps_and_loads__w_options(self):
        a = dict(name="a", a=1, b=dict(b=[1, 2], c="C"))
        a1 = A.loads(A.dumps(a, "json", indent=2), "json", ensure_ascii=False)

        self.assertEquals(a1["name"],   a["name"])
        self.assertEquals(a1["a"],      a["a"])
        self.assertEquals(a1["b"]["b"], a["b"]["b"])
        self.assertEquals(a1["b"]["c"], a["b"]["c"])
Ejemplo n.º 5
0
    def test_32_dumps_and_loads__w_options__no_dumper(self):
        a = dict(name="a", a=1, b=dict(b=[1, 2], c="C"))
        a1 = A.loads(A.dumps(a, "type_not_exist"), "json")

        self.assertEquals(a1["name"],   a["name"])
        self.assertEquals(a1["a"],      a["a"])
        self.assertEquals(a1["b"]["b"], a["b"]["b"])
        self.assertEquals(a1["b"]["c"], a["b"]["c"])
Ejemplo n.º 6
0
    def test_30_dumps_and_loads__w_options(self):
        a = dict(name="a", a=1, b=dict(b=[1, 2], c="C"))
        a1 = A.loads(A.dumps(a, "json", indent=2), "json", ensure_ascii=False)

        self.assertEquals(a1["name"], a["name"])
        self.assertEquals(a1["a"], a["a"])
        self.assertEquals(a1["b"]["b"], a["b"]["b"])
        self.assertEquals(a1["b"]["c"], a["b"]["c"])
Ejemplo n.º 7
0
    def test_32_dumps_and_loads__w_options__no_dumper(self):
        a = dict(name="a", a=1, b=dict(b=[1, 2], c="C"))
        a1 = A.loads(A.dumps(a, "type_not_exist"), "json")

        self.assertEquals(a1["name"], a["name"])
        self.assertEquals(a1["a"], a["a"])
        self.assertEquals(a1["b"]["b"], a["b"]["b"])
        self.assertEquals(a1["b"]["c"], a["b"]["c"])
Ejemplo n.º 8
0
    def test_49_loads_w_validation_error(self):
        if not anyconfig.schema.JSONSCHEMA_IS_AVAIL:
            skip_test()

        cnf_s = """{"a": "aaa"}"""
        scm_s = TT.dumps(SCM_0, "json")
        cnf_2 = TT.loads(cnf_s, ac_parser="json", ac_schema=scm_s)
        self.assertTrue(cnf_2 is None, cnf_2)
Ejemplo n.º 9
0
    def test_30_dumps_and_loads(self):
        a = dict(name="a", a=1, b=dict(b=[1, 2], c="C"))
        a1 = A.loads(A.dumps(a, "json"), "json")

        self.assertEquals(a1["name"], a["name"])
        self.assertEquals(a1["a"], a["a"])
        self.assertEquals(a1["b"]["b"], a["b"]["b"])
        self.assertEquals(a1["b"]["c"], a["b"]["c"])
Ejemplo n.º 10
0
 def test_30_dumps_and_loads(self):
     res = TT.loads(TT.dumps(self.cnf, "json"), "json")
     self.assert_dicts_equal(res, self.cnf)
Ejemplo n.º 11
0
 def test_49_loads_w_validation_error(self):
     cnf_s = """{"a": "aaa"}"""
     scm_s = TT.dumps(SCM_0, "json")
     cnf_2 = TT.loads(cnf_s, ac_parser="json", ac_schema=scm_s)
     self.assertTrue(cnf_2 is None, cnf_2)
Ejemplo n.º 12
0
 def test_32_dumps_and_loads__w_options__no_dumper(self):
     cnf = TT.loads(TT.dumps(self.cnf, "type_not_exist"), "json")
     self.assertTrue(dicts_equal(cnf, self.cnf), str(cnf))
Ejemplo n.º 13
0
 def test_30_dumps_and_loads__w_options(self):
     cnf = TT.loads(TT.dumps(self.cnf, "json", indent=2), "json",
                    ensure_ascii=False)
     self.assertTrue(dicts_equal(cnf, self.cnf), str(cnf))
Ejemplo n.º 14
0
 def test_30_dumps_and_loads__w_options(self):
     res = TT.loads(TT.dumps(self.cnf, "json", indent=2), "json",
                    ensure_ascii=False)
     self.assert_dicts_equal(res, self.cnf)
Ejemplo n.º 15
0
 def test_30_dumps_and_loads__w_options(self):
     res = TT.loads(TT.dumps(self.cnf, "json", indent=2), "json",
                    ensure_ascii=False)
     self.assert_dicts_equal(res, self.cnf)
Ejemplo n.º 16
0
 def test_30_dumps_and_loads(self):
     res = TT.loads(TT.dumps(self.cnf, "json"), "json")
     self.assert_dicts_equal(res, self.cnf)
Ejemplo n.º 17
0
 def test_32_dumps_and_loads__w_options__no_dumper(self):
     cnf = TT.loads(TT.dumps(self.cnf, "type_not_exist"), "json")
     self.assertTrue(dicts_equal(cnf, self.cnf), str(cnf))
Ejemplo n.º 18
0
 def test_30_dumps_and_loads__w_options(self):
     cnf = TT.loads(TT.dumps(self.cnf, "json", indent=2),
                    "json",
                    ensure_ascii=False)
     self.assertTrue(dicts_equal(cnf, self.cnf), str(cnf))
Ejemplo n.º 19
0
 def test_30_dumps_and_loads(self):
     cnf = TT.loads(TT.dumps(self.cnf, "json"), "json")
     self.assertTrue(dicts_equal(cnf, self.cnf), str(cnf))
Ejemplo n.º 20
0
 def test_49_loads_w_validation_error(self):
     cnf_s = """{"a": "aaa"}"""
     scm_s = TT.dumps(SCM_0, "json")
     cnf_2 = TT.loads(cnf_s, ac_parser="json", ac_schema=scm_s)
     self.assertTrue(cnf_2 is None, cnf_2)
Ejemplo n.º 21
0
 def test_30_dumps_and_loads(self):
     cnf = TT.loads(TT.dumps(self.cnf, "json"), "json")
     self.assertTrue(dicts_equal(cnf, self.cnf), str(cnf))