def deserialize_raw_item(self, raw_item): data = {} for key, raw_value in raw_item.iteritems(): try: value = Attribute.from_json(raw_value) except TypeError as e: logger.error( 'Failed to deserialize field {0}.{1} because: {2}'.format( self.model.__class__.__name__, key, str(e))) raise data[key] = value return data
def deserialize_raw_item(self, raw_item): data = {} for key, raw_value in raw_item.iteritems(): try: value = Attribute.from_json(raw_value) except TypeError as e: logger.error('Failed to deserialize field {0}.{1} because: {2}'.format( self.model.__class__.__name__, key, str(e) )) raise data[key] = value return data
def test_attribute_from_json(): ('Attribute.from_json() should deserialize the given dict into a value') # Given an instance of attribute attribute = Attribute() # When I call from_json result = attribute.from_json( json.dumps({ b'module': b'repocket.attributes', b'type': b'Attribute', b'value': b'foobar', })) # Then the result should be a value result.should.equal(b'foobar')
def test_attribute_from_json(): ('Attribute.from_json() should deserialize the given dict into a value') # Given an instance of attribute attribute = Attribute() # When I call from_json result = attribute.from_json(json.dumps({ b'module': b'repocket.attributes', b'type': b'Attribute', b'value': b'foobar', })) # Then the result should be a value result.should.equal( b'foobar' )