MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / test_simple_path

Method test_simple_path

tests/flow/test_path.py:25–50  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

23 self.env.flush()
24
25 def test_simple_path(self):
26 node0 = Node(node_id=0, label="L1")
27 node1 = Node(node_id=1, label="L1")
28 node2 = Node(node_id=2, label="L1")
29 edge01 = Edge(node0, "R1", node1, edge_id=0, properties={'value': 1})
30 edge12 = Edge(node1, "R1", node2, edge_id=1, properties={'value': 2})
31
32 redis_graph.add_node(node0)
33 redis_graph.add_node(node1)
34 redis_graph.add_node(node2)
35 redis_graph.add_edge(edge01)
36 redis_graph.add_edge(edge12)
37
38 redis_graph.flush()
39
40 # Rewrite the edges with IDs instead of node values to match how they are returned.
41 edge01 = Edge(0, "R1", 1, edge_id=0, properties={'value': 1})
42 edge12 = Edge(1, "R1", 2, edge_id=1, properties={'value': 2})
43
44 path01 = Path.new_empty_path().add_node(node0).add_edge(edge01).add_node(node1)
45 path12 = Path.new_empty_path().add_node(node1).add_edge(edge12).add_node(node2)
46 expected_results = [[path01], [path12]]
47
48 query = "MATCH p=(:L1)-[:R1]->(:L1) RETURN p"
49 query_info = QueryInfo(query = query, description="Tests simple paths", expected_result = expected_results)
50 self._assert_resultset_and_expected_mutually_included(redis_graph.query(query), query_info)
51
52 def test_variable_length_path(self):
53 node0 = Node(node_id=0, label="L1")

Callers

nothing calls this directly

Calls 5

QueryInfoClass · 0.90
NodeClass · 0.50
EdgeClass · 0.50
queryMethod · 0.45

Tested by

no test coverage detected