Beispiel #1
0
    def test_deserialize(self):
        obj = json_util.deserialize(FakeModel, MOCK_JSON)

        self.assertEqual(MOCK_JSON['k1'], obj.k1)
        self.assertEqual(MOCK_JSON['k2'], obj.k2)
        self.assertEqual(MOCK_JSON['k3'], obj.k3)
        self.assertEqual(date_util.parse(MOCK_JSON['k4']), obj.k4)
        self.assertListEqual(MOCK_JSON['k5'], obj.k5)
        self.assertDictEqual(MOCK_JSON['k6'], obj.k6)
Beispiel #2
0
    def test_deserialize(self):
        obj = json_util.deserialize(FakeModel, MOCK_JSON)

        self.assertEqual(MOCK_JSON["k1"], obj.k1)
        self.assertEqual(MOCK_JSON["k2"], obj.k2)
        self.assertEqual(MOCK_JSON["k3"], obj.k3)
        self.assertEqual(date_util.parse(MOCK_JSON["k4"]), obj.k4)
        self.assertListEqual(MOCK_JSON["k5"], obj.k5)
        self.assertDictEqual(MOCK_JSON["k6"], obj.k6)
Beispiel #3
0
    def test_deserialize_unsupported_type(self):
        obj = json_util.deserialize(FakeModel, MOCK_JSON_UNSERIALIZEABLE)

        self.assertIsNone(obj.k1)