Skip to content

Commit

Permalink
Fixed issue in test, fixes #21
Browse files Browse the repository at this point in the history
  • Loading branch information
jkminder committed Apr 8, 2024
1 parent a3e9b20 commit bee51bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions rel2graph/neo4j/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def match_nodes(session: Session, *labels: List[str], **properties: dict):

unwind = "UNWIND $data as r" if len(data) > 0 else ""
clause = cypher_join(unwind, _match_clause('n', tuple(flat_params), "r"), "RETURN n, LABELS(n), ID(n)", data=data)
print(clause)

records = session.run(*clause).data()
# Convert to Node
out = []
Expand Down Expand Up @@ -115,7 +115,6 @@ def match_relationships(session: Session, from_node: Node =None, to_node:Node =N
" AND ".join(clauses),
"RETURN PROPERTIES(r), TYPE(r), ID(r), from_node, LABELS(from_node), ID(from_node), to_node, LABELS(to_node), ID(to_node)"
)

records = session.run(*clause).data()
out = []
for record in records:
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/neo4j/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def session():
n3 = Node("anotherlabel", id=3, name="test3")

r1 = Relationship(n1, "to", n2, id=1)
r2 = Relationship(n1, "to", n3, id=2, name="test")
r2 = Relationship(n1, "to", n3, id=2, anotherattr="test")

graph = n1 | n2 | n3 | r1 | r2
create(graph, session)
Expand Down Expand Up @@ -92,9 +92,9 @@ def test_match_relationships(session):
assert(check_rel(rels, 1))

# match by multiple properties
rels = match_relationships(session, rel_type="to", id=1, name="test")
rels = match_relationships(session, rel_type="to", id=2, anotherattr="test")
assert(len(rels) == 1)
assert(check_rel(rels, 1))
assert(check_rel(rels,2))

# match by from node
n1 = match_nodes(session, "test", id=1)[0]
Expand Down

0 comments on commit bee51bb

Please sign in to comment.