

def test_reserved_words(self):
    class_id1 = self.client.command('create class my_v_class extends V')[0]
    class_id2 = self.client.command('create class str extends E')[0]
    rec1 = {
        '@my_v_class': {
            'accommodation': 'house',
            'work': 'office',
            'holiday': 'sea',
        },
    }
    rec2 = {
        '@my_v_class': {
            'accommodation': 'house',
            'work2': 'office',
            'holiday': 'sea3',
        },
    }
    rec_position1 = self.client.record_create(class_id1, rec1)
    rec_position2 = self.client.record_create(class_id1, rec2)
    sql_edge = ((('create edge from ' + rec_position1._rid) + ' to ') + rec_position2._rid)
    res = self.client.command(sql_edge)
    assert isinstance(res[0]._in, pyorient.OrientRecordLink)
    assert (res[0]._in.get_hash() == rec_position2._rid)
    assert isinstance(res[0]._out, pyorient.OrientRecordLink)
    assert (res[0]._out.get_hash() == rec_position1._rid)
    result = self.client.query('select @rid, @version, holiday from my_v_class')
    assert (result[0].oRecordData['rid'].get() == '11:0')
    assert (result[0].rid.get_hash() == rec_position1._rid)
    assert (result[0].holiday == rec1['@my_v_class']['holiday'])
    assert (result[0].version != 0)
    assert (result[1].rid.get() == '11:1')
    assert (result[1].rid.get_hash() == rec_position2._rid)
    assert (result[1].rid.get_hash() == rec_position2._rid)
    assert (result[1].holiday == rec2['@my_v_class']['holiday'])
    assert (result[0].version != 0)
    x = self.client.command(('insert into V ( rid, version, model, ciao )' + " values ('test_rid', 'V1', '1123', 1234)"))
    assert (x[0].ciao == 1234)
    x = self.client.command('select rid, @rid, model, ciao from V')
    import re
    assert re.match('#[-]*[0-9]+:[0-9]+', x[0]._rid), ("Failed to assert that '#[-]*[0-9]+:[0-9]+' matches received value: '%s'" % x[0]._rid)
    print(x[0]._rid)
    assert (x[0].rid == 'test_rid')
    try:
        x[0]._rid.get_hash()
        assert False
    except AttributeError:
        assert True
    assert (x[0].rid2.get_hash() == '#9:0'), ("Failed to assert that '#9:0' equals received value: '%s'" % x[0]._rid2)
    assert (x[0].model == '1123')
    assert (x[0].ciao == 1234)

dataset/ETHPy150Open mogui/pyorient/tests/test_reserved_words_batch.py CommandTestCase.test_reserved_words/original