def deserialize(data): is_binary = data[Blob.SERIAL_IS_BINARY_KEY] c = Blob(is_binary=is_binary) c._compressed_bin = data[Blob.SERIAL_COMPRESSED_BIN_KEY] c._size = data.get(Blob.SERIAL_SIZE_KEY) #c.is_binary = data[Blob.SERIAL_IS_BINARY_KEY] c._sha = SHA.deserialize(data[Blob.SERIAL_SHA_KEY]) return c
def test_sha(self): c = SHA('hola') s = c.serialize() c2 = SHA.deserialize(s) self.assertEqual(c, c2)