def test_to_dict_obj(self): class Foo(object): def __init__(self): self.foo = 42 expected = {'foo': 42} assert fields.to_marshallable_type(Foo()) == expected
def test_to_dict_custom_marshal(self): class Foo(object): def __marshallable__(self): return {'foo': 42} expected = {'foo': 42} assert fields.to_marshallable_type(Foo()) == expected
def test_to_dict(self): expected = data = {'foo': 42} assert fields.to_marshallable_type(data) == expected
def output(self, key, obj, **kwargs): to_marshal = to_marshallable_type(obj) to_marshal['uid'] = obj.id return super().output(key, to_marshal)