Ejemplo n.º 1
0
def testReadWrite(odbhs: OrientDbHashStore, nodesLeaves):
    nodes, leaves = nodesLeaves
    for node in nodes:
        odbhs.writeNode(node)
    for leaf in leaves:
        odbhs.writeLeaf(leaf)
    onebyone = [odbhs.readLeaf(i + 1) for i in range(10)]
    multiple = odbhs.readLeafs(1, 10)
    assert onebyone == multiple
def testUniqueConstraint(odbhs: OrientDbHashStore):
    leafHash = generateHashes(1)[0]
    odbhs.writeLeaf(leafHash)
    with pytest.raises(pyorient.PyOrientORecordDuplicatedException):
        odbhs.writeLeaf(leafHash)
def testIndexFrom1(odbhs: OrientDbHashStore):
    with pytest.raises(IndexError):
        odbhs.readLeaf(0)
def odbhs():
    hs = OrientDbHashStore(
        OrientDbStore(user="******", password="******", dbName="test"))
    cleanup(hs)
    return hs