示例#1
0
def test_match_set():
    ast = match(node()).set(*parameters(foo="bar"))
    assert_that(
        str(ast),
        is_(equal_to("MATCH () SET foo = $foo")),
    )
    assert_that(
        dict(ast),
        is_(equal_to(dict(foo="bar"))),
    )
示例#2
0
def test_match_merge():
    ast = match(node()).merge(node())
    assert_that(
        str(ast),
        is_(equal_to("MATCH () MERGE ()")),
    )
    assert_that(
        dict(ast),
        is_(equal_to(dict())),
    )
示例#3
0
def test_match_match():
    ast = match(node()).match(node()).ret("foo")
    assert_that(
        str(ast),
        is_(equal_to("MATCH () MATCH () RETURN foo")),
    )
    assert_that(
        dict(ast),
        is_(equal_to(dict())),
    )
示例#4
0
def test_match_delete():
    ast = match(node()).delete("foo")
    assert_that(
        str(ast),
        is_(equal_to("MATCH () DELETE foo")),
    )
    assert_that(
        dict(ast),
        is_(equal_to(dict())),
    )
示例#5
0
def test_match_create():
    ast = match(node()).create(node())
    assert_that(
        str(ast),
        is_(equal_to("MATCH () CREATE ()")),
    )
    assert_that(
        dict(ast),
        is_(equal_to(dict())),
    )
示例#6
0
def test_match_union():
    ast = match(node("foo", "Foo", {"bar": "baz"}), ).ret("foo").union(
        match(node("bar", "Bar", {"foo": "baz"}), ).ret("bar", ))
    assert_that(
        str(ast),
        is_(
            equal_to(
                "MATCH (foo:Foo {bar: $foo_bar}) "
                "RETURN foo "
                "UNION "
                "MATCH (bar:Bar {foo: $bar_foo}) "
                "RETURN bar", )),
    )
    assert_that(
        dict(ast),
        is_(equal_to(dict(
            foo_bar="baz",
            bar_foo="baz",
        ))),
    )