def test_attribute_error(self): class Klass(object): def __init__(self, i): self.value = i def to_json(self): # Value is an int() it doesn't have a pk return {'value': self.value.pk} with self.assertRaises(AttributeError): dumps(Klass(5))
def __init__(self, context, *args, **kwargs): content = dumps(context) super(JsonResponse, self).__init__(content, *args, **kwargs) self['Content-Type'] = 'application/json'
def encode_and_decode(self, v): return json.loads(dumps(v))
def serialize(self, obj): """ Returns a json serialized string object encoded using `argonauts.serializers.JSONArgonautsEncoder`. """ return dumps(obj)