def test_dump_change_value(self): text = r'{"name":"benjamin", "age":21}' obj = objson.loads(text) obj.age = 30 fp = StringIO() objson.dump(obj, fp) expected = json.loads(text) expected["age"] = 30 self.assertEqual(expected, json.loads(fp.getvalue()))
def test_dump_normal(self): text = r'{"name":"benjamin", "age":21}' obj = objson.loads(text) fp = StringIO() objson.dump(obj, fp) self.assertEqual(json.loads(text), json.loads(fp.getvalue()))