示例#1
0
 def test_json_object_wrap_list(self):
     expected = [
         {"json_class": "user", "first_name": "Isaak", "last_name": "Knewton", "email": None},
         {"json_class": "user", "first_name": "Isaak2", "last_name": "Knewton2", "email": None},
     ]
     data = [
         {"first_name": "Isaak", "last_name": "Knewton", "email": None},
         {"first_name": "Isaak2", "last_name": "Knewton2", "email": None},
     ]
     actual = json.json_object_wrap(data, "user")
     assert expected == [element.__dict__ for element in actual]
示例#2
0
 def test_json_object_wrap_jo(self):
     expected = {"json_class": "user", "first_name": "Isaak", "last_name": "Knewton", "email": None}
     data = {"first_name": "Isaak", "last_name": "Knewton", "email": None}
     actual = json.json_object_wrap(data, "user")
     assert expected == actual.__dict__
示例#3
0
 def test_json_object_wrap_null(self):
     assert json.json_object_wrap(None, "foo") is None