diff --git a/conformance/tests/ot_distinct.py b/conformance/tests/ot_distinct.py index ffeec4ab..f7872231 100644 --- a/conformance/tests/ot_distinct.py +++ b/conformance/tests/ot_distinct.py @@ -6,26 +6,26 @@ def test_distinct(O, man): count = 0 for i in O.query().V().distinct(): count += 1 - if count != 25: - errors.append("Distinct %s != %s" % (count, 25)) + if count != 39: + errors.append("Distinct %s != %s" % (count, 39)) count = 0 for i in O.query().V().distinct("_gid"): count += 1 - if count != 25: - errors.append("Distinct %s != %s" % (count, 25)) + if count != 39: + errors.append("Distinct %s != %s" % (count, 39)) count = 0 - for i in O.query().V().distinct("name"): + for i in O.query().V().distinct("eye_color"): count += 1 - if count != 23: - errors.append("Distinct %s != %s" % (count, 23)) + if count != 8: + errors.append("Distinct %s != %s" % (count, 8)) count = 0 - for i in O.query().V().distinct("lang"): + for i in O.query().V().distinct("gender"): count += 1 - if count != 3: - errors.append("Distinct %s != %s" % (count, 3)) + if count != 4: + errors.append("Distinct %s != %s" % (count, 4)) count = 0 for i in O.query().V().distinct("non-existent-field"): @@ -34,10 +34,16 @@ def test_distinct(O, man): errors.append("Distinct %s != %s" % (count, 0)) count = 0 - for i in O.query().V().hasLabel("Person").as_("person").out().distinct("$person.name"): + for i in O.query().V().hasLabel("Character").as_("person").out().distinct("$person.name"): count += 1 - if count != 5: - errors.append("Distinct O.query().V().hasLabel(\"Person\").as_(\"person\").out().distinct(\"$person.name\") %s != %s" % (count, 5)) + if count != 18: + errors.append("Distinct O.query().V().hasLabel(\"Person\").as_(\"person\").out().distinct(\"$person.name\") %s != %s" % (count, 18)) + + count = 0 + for i in O.query().V().hasLabel("Character").as_("person").out().distinct("$person.eye_color"): + count += 1 + if count != 8: + errors.append("Distinct O.query().V().hasLabel(\"Person\").as_(\"person\").out().distinct(\"$person.eye_color\") %s != %s" % (count, 8)) return errors @@ -48,9 +54,12 @@ def test_distinct_multi(O, man): man.setGraph("swapi") count = 0 - for i in O.query().V().as_("a").out().distinct(["$a.name", "_gid"]).render(["$a.name", "_gid"]): + o = {} + for i in O.query().V().as_("a").out().distinct(["$a.eye_color", "_gid"]).render(["$a.eye_color", "_gid"]): + if i[0] in o and o[i[0]] != i[1]: + errors.append("Non-unique pair returned: %s" % (i)) count += 1 - if count != 14: - errors.append("Distinct multi %s != %s" % (count, 14)) + if count != 68: + errors.append("Distinct multi %s != %s" % (count, 68)) return errors