def test_csv_decoding(self): serializer = OrientSerialization.get_impl(OrientSerialization.CSV) content = 'Animal@name:"rat",specie:"rodent",out_Eat:%AQAAAAEADQAAAAAAAAAAAAAAAAAAAAAAAA==;' _, record = serializer.decode(content) assert isinstance(record, dict) assert record['name'] == 'rat' assert isinstance(record['out_Eat'], OrientBinaryObject)
def test_mixed_list(): rec = OrientRecord({ '__o_class': 'ListTest', 'list': [1, 'a'] }) serializer = OrientSerialization.get_impl(OrientSerialization.CSV) raw = serializer.encode(rec) assert raw == 'ListTest@list:[1,"a"]'
def test_mixed_list(self): rec = OrientRecord( { '__o_class': 'ListTest', 'list': [ 1, 'a' ] } ) serializer = OrientSerialization.get_impl( OrientSerialization.CSV ) raw = serializer.encode( rec ) assert raw == 'ListTest@list:[1,"a"]'
def test_csv_encoding(self): rec = OrientRecord({ '__o_class': 'Animal', 'name':'rat', 'specie': 'rodent' }) serializer = OrientSerialization.get_impl(OrientSerialization.CSV) raw = serializer.encode(rec) assert raw.startswith('Animal@') assert 'name:"rat"' in raw assert 'specie:"rodent"' in raw
def test_csv_encoding(self): rec = OrientRecord({ '__o_class': 'Animal', 'name': 'rat', 'specie': 'rodent' }) serializer = OrientSerialization.get_impl(OrientSerialization.CSV) raw = serializer.encode(rec) assert raw.startswith('Animal@') assert 'name:"rat"' in raw assert 'specie:"rodent"' in raw
def test_binary_serializer(self): serializer = OrientSerialization.get_impl(OrientSerialization.Binary) content = 'Animal@name:"rat",specie:"rodent",out_Eat:%AQAAAAEADQAAAAAAAAAAAAAAAAAAAAAAAA==;' with self.assertRaises(NotImplementedError): serializer.decode(content) rec = OrientRecord({ '__o_class': 'Animal', 'name':'rat', 'specie': 'rodent' }) with self.assertRaises(NotImplementedError): serializer.encode(rec)
def test_binary_serializer(self): serializer = OrientSerialization.get_impl(OrientSerialization.Binary) content = 'Animal@name:"rat",specie:"rodent",out_Eat:%AQAAAAEADQAAAAAAAAAAAAAAAAAAAAAAAA==;' with self.assertRaises(NotImplementedError): serializer.decode(content) rec = OrientRecord({ '__o_class': 'Animal', 'name': 'rat', 'specie': 'rodent' }) with self.assertRaises(NotImplementedError): serializer.encode(rec)