def test_parsers(self): p = DRLCPPParser() s = p.serialize() p2 = Parser.deserialize(s) self.assert_bii_equal(p, p2) p = DRLCPPParser() s = p.serialize() p2 = Parser.deserialize(s) self.assert_bii_equal(p, p2)
def deserialize(self, data): '''From dictionary to object Content''' if data is None: return None try: return Content(id_=self.id_type.deserialize(data[Content.SERIAL_ID_KEY]), load=Blob.deserialize(data[Content.SERIAL_LOAD_KEY]), parser=Parser.deserialize(data[Content.SERIAL_PARSER_KEY]), is_parsed=data[Content.SERIAL_IS_PARSED_KEY], ) except Exception as e: raise BiiSerializationException('Could not deserialize Content: %s' % str(e))
def deserialize(self, data): '''From dictionary to object Content''' if data is None: return None try: return Content( id_=self.id_type.deserialize(data[Content.SERIAL_ID_KEY]), load=Blob.deserialize(data[Content.SERIAL_LOAD_KEY]), parser=Parser.deserialize(data[Content.SERIAL_PARSER_KEY]), is_parsed=data[Content.SERIAL_IS_PARSED_KEY], ) except Exception as e: raise BiiSerializationException( 'Could not deserialize Content: %s' % str(e))