Пример #1
0
 def test_can_create_path(self, graph):
     path = Path({"name": "Alice"}, "KNOWS", {"name": "Bob"})
     assert path.nodes[0] == {"name": "Alice"}
     assert path.rels[0].type == "KNOWS"
     assert path.nodes[1] == {"name": "Bob"}
     path = path.create(graph)
     assert isinstance(path.nodes[0], Node)
     assert path.nodes[0]["name"] == "Alice"
     assert isinstance(path.relationships[0], neo4j.Relationship)
     assert path.relationships[0].type == "KNOWS"
     assert isinstance(path.nodes[1], Node)
     assert path.nodes[1]["name"] == "Bob"
Пример #2
0
 def test_can_create_path_with_rel_properties(self):
     path = Path({"name": "Alice"}, ("KNOWS", {"since": 1999}), {"name": "Bob"})
     assert path.nodes[0] == {"name": "Alice"}
     assert path.rels[0].type == "KNOWS"
     assert path.rels[0].properties == {"since": 1999}
     assert path.nodes[1] == {"name": "Bob"}
     path = path.create(self.graph)
     assert isinstance(path.nodes[0], Node)
     assert path.nodes[0]["name"] == "Alice"
     assert isinstance(path.relationships[0], neo4j.Relationship)
     assert path.relationships[0].type == "KNOWS"
     assert path.relationships[0].properties == {"since": 1999}
     assert isinstance(path.nodes[1], Node)
     assert path.nodes[1]["name"] == "Bob"