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"))), )
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())), )
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())), )
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())), )
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())), )
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", ))), )