def testSerialization(self): d = Device('a', 'abcdefgh', True) p = Person('A', [d]) person_json = ('{"name": "A", "devices": [' + '{"is_wireless": true, "status": "offline", ' + '"mac": "abcdefgh", "name": "a"}]}') self.assertEqual(json_encode(p), person_json)
def to_json(self): return json_encode(self.serialize())
def to_json(self): # return json.dumps(self.serialize()) return json_encode(self.serialize())