예제 #1
0
def test_has_neq(O):
    errors = []
    setupGraph(O)

    count = 0
    for i in O.query().V().has(gripql.neq("_gid", "vertex3")):
        count += 1
        if i['gid'] == "vertex3":
            errors.append("Wrong vertex returned %s" % (i))
    if count != 5:
        errors.append(
            "Fail: O.query().V().has(gripql.not_(gripql.eq(\"_gid\", \"vertex3\"))) %s != %s" %
            (count, 5))

    count = 0
    for i in O.query().V().has(gripql.neq("_label", "person")):
        count += 1
        if i['label'] == "person":
            errors.append("Wrong vertex label %s" % (i['label']))
    if count != 2:
        errors.append(
            "Fail: O.query().V().has(gripql.not_(gripql.eq(\"_label\", \"person\"))) %s != %s" %
            (count, 2))

    count = 0
    for i in O.query().V().has(gripql.neq("occupation", "jedi")):
        count += 1
        if i['gid'] in ["vertex2", "vertex5"]:
            errors.append("Wrong vertex returned %s" % (i))
    if count != 4:
        errors.append(
            "Fail: O.query().V().has(gripql.not_(gripql.eq(\"occupation\", \"jedi\"))) %s != %s" %
            (count, 4))

    return errors
예제 #2
0
def test_has_not(O):
    errors = []
    setupGraph(O)

    count = 0
    for i in O.query().V().has(gripql.not_(gripql.eq("_label", "person"))):
        count += 1
        if i['gid'] not in ["vertex3", "vertex4"]:
            errors.append("Wrong vertex returned %s" % (i))
    if count != 2:
        errors.append(
            "Fail: O.query().V().has(gripql.not_(gripql.eq(\"_label\", \"person\"))) %s != %s" %
            (count, 2))

    count = 0
    for i in O.query().V().has(gripql.not_(gripql.neq("_label", "person"))):
        count += 1
        if i['gid'] not in ["vertex1", "vertex2", "vertex5", "vertex6"]:
            errors.append("Wrong vertex returned %s" % (i))
    if count != 4:
        errors.append(
            "Fail: O.query().V().has(gripql.not_(gripql.neq(\"_label\", \"person\"))) %s != %s" %
            (count, 4))

    return errors
예제 #3
0
 def neq(self, *args, **kwargs):
     return gripql.neq(*args, **kwargs)