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

Method test_variable_length_path

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

Source from the content-addressed store, hash-verified

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")
54 node1 = Node(node_id=1, label="L1")
55 node2 = Node(node_id=2, label="L1")
56 edge01 = Edge(node0, "R1", node1, edge_id=0, properties={'value': 1})
57 edge12 = Edge(node1, "R1", node2, edge_id=1, properties={'value': 2})
58
59 redis_graph.add_node(node0)
60 redis_graph.add_node(node1)
61 redis_graph.add_node(node2)
62 redis_graph.add_edge(edge01)
63 redis_graph.add_edge(edge12)
64
65 redis_graph.flush()
66
67 # Rewrite the edges with IDs instead of node values to match how they are returned.
68 edge01 = Edge(0, "R1", 1, edge_id=0, properties={'value': 1})
69 edge12 = Edge(1, "R1", 2, edge_id=1, properties={'value': 2})
70
71 path01 = Path.new_empty_path().add_node(node0).add_edge(edge01).add_node(node1)
72 path12 = Path.new_empty_path().add_node(node1).add_edge(edge12).add_node(node2)
73 path02 = Path.new_empty_path().add_node(node0).add_edge(edge01).add_node(node1).add_edge(edge12).add_node(node2)
74 expected_results=[[path01], [path12], [path02]]
75
76 query = "MATCH p=(:L1)-[:R1*]->(:L1) RETURN p"
77 query_info = QueryInfo(query = query, description="Tests variable length paths", expected_result = expected_results)
78 self._assert_resultset_and_expected_mutually_included(redis_graph.query(query), query_info)
79
80 def test_bi_directional_path(self):
81 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