Skip to content

Commit

Permalink
Fixing path unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kellrott committed Mar 23, 2020
1 parent 287d1da commit da71b4b
Showing 1 changed file with 16 additions and 34 deletions.
50 changes: 16 additions & 34 deletions conformance/tests/ot_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,30 @@ def test_path_1(O, man):
man.setGraph("swapi")

count = 0
for res in O.query().V().out().out().out():
if res.gid not in ["01", "02", "03", "04", "05", "06", "08", "09", "40", "41", "42", "50"]:
errors.append("Wrong vertex found at end of path: %s" % (res.gid))
if res.label not in ["Person", "Movie", "Book"]:
errors.append("Wrong label found at end of path: %s" % (res.label))
for res in O.query().V("Film:1").out().out().out():
count += 1
if count != 14:
errors.append("out-out-out Incorrect vertex count returned: %d != %d" % (count, 14))
if count != 1814:
errors.append("out-out-out Incorrect vertex count returned: %d != %d" % (count, 1814))

count = 0
for res in O.query().V().in_().in_().in_():
if res.gid not in ["01", "08"]:
errors.append("Wrong vertex found at end of path: %s" % (res.gid))
if not res.label == "Person":
errors.append("Wrong label found at end of path: %s" % (res.label))
for res in O.query().V("Film:1").in_().in_().in_():
count += 1
if count != 14:
errors.append("in-in-in Incorrect vertex count returned: %d != %d" % (count, 14))
if count != 1814:
errors.append("in-in-in Incorrect vertex count returned: %d != %d" % (count, 1814))

count = 0
for res in O.query().V().out().out().outE():
if not res['from'] in ["01", "02", "04", "05", "06", "08"]:
errors.append("Wrong 'from' vertex found at end of outE path: %s" % (res['from']))
if not res['to'] in ["01", "02", "03", "04", "05", "06", "08", "09", "40", "41", "42", "50"]:
errors.append("Wrong 'to' vertex found at end of ourE path: %s" % (res['to']))
if res.label not in ["likes", "knows", "friend", "parent", "enemy"]:
for res in O.query().V("Film:1").out().out().outE():
if res.label not in ["vehicles", "species", "planets", "characters", "enemy", "starships", "films", "homeworld", "people", "pilots", "residents"]:
errors.append("Wrong label found at end of path: %s" % (res.label))
count += 1
if count != 14:
errors.append("out-out-outE Incorrect vertex count returned: %d != %d" % (count, 14))
if count != 1814:
errors.append("out-out-outE Incorrect vertex count returned: %d != %d" % (count, 1814))

count = 0
for res in O.query().V().out().out().outE().out():
if res.gid not in ["42", "41", "02", "03", "04", "08", "09", "05", "50", "40", "06", "01"]:
errors.append("Wrong vertex found at end of outE to out path: %s" % (res.gid))
if res.label not in ["Movie", "Person", "Book"]:
errors.append("Wrong label found at end of outE to out path: %s" % (res.label))
for res in O.query().V("Film:1").out().out().outE().out():
count += 1
if count != 14:
errors.append("out-out-outE-out Incorrect vertex count returned: %d != %d" % (count, 14))
if count != 1814:
errors.append("out-out-outE-out Incorrect vertex count returned: %d != %d" % (count, 1814))

return errors

Expand All @@ -63,11 +47,9 @@ def test_path_2(O, man):
man.setGraph("swapi")

count = 0
for res in O.query().V().out().hasLabel("Person").out().out():
if res.gid not in ["01", "02", "03", "04", "05", "06", "08", "09", "40", "41", "42", "50"]:
errors.append("Wrong vertex found at end of hasLabel path: %s" % (res.gid))
for res in O.query().V().out().hasLabel("Starship").out().out():
count += 1
if count != 14:
errors.append("out-hasLabel-out-out Incorrect vertex count returned: %d != %d" % (count, 3))
if count != 666:
errors.append("out-hasLabel-out-out Incorrect vertex count returned: %d != %d" % (count, 666))

return errors

0 comments on commit da71b4b

Please sign in to comment.