예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
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"]'
예제 #4
0
    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"]'
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
    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)
예제 #8
0
    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)