@@ -62,41 +62,38 @@ def graph_env(tmp_path):
6262 return config , datasets , people_table
6363
6464
65- @pytest .mark .parametrize ("execute_method" , ["execute" , "execute_datafusion" ])
66- def test_basic_node_selection (graph_env , execute_method ):
65+ def test_basic_node_selection (graph_env ):
6766 config , datasets , _ = graph_env
6867 query = CypherQuery ("MATCH (p:Person) RETURN p.name, p.age" ).with_config (config )
69- result = getattr ( query , execute_method ) ({"Person" : datasets ["Person" ]})
68+ result = query . execute ({"Person" : datasets ["Person" ]})
7069 data = result .to_pydict ()
7170
7271 assert set (data .keys ()) == {"p.name" , "p.age" }
7372 assert len (data ["p.name" ]) == 4
7473 assert "Alice" in set (data ["p.name" ])
7574
7675
77- @pytest .mark .parametrize ("execute_method" , ["execute" , "execute_datafusion" ])
78- def test_filtered_query (graph_env , execute_method ):
76+ def test_filtered_query (graph_env ):
7977 config , datasets , _ = graph_env
8078 query = CypherQuery (
8179 "MATCH (p:Person) WHERE p.age > 30 RETURN p.name, p.age"
8280 ).with_config (config )
83- result = getattr ( query , execute_method ) ({"Person" : datasets ["Person" ]})
81+ result = query . execute ({"Person" : datasets ["Person" ]})
8482 data = result .to_pydict ()
8583
8684 assert len (data ["p.name" ]) == 2
8785 assert set (data ["p.name" ]) == {"Bob" , "David" }
8886 assert all (age > 30 for age in data ["p.age" ])
8987
9088
91- @pytest .mark .parametrize ("execute_method" , ["execute" , "execute_datafusion" ])
92- def test_relationship_query (graph_env , execute_method ):
89+ def test_relationship_query (graph_env ):
9390 config , datasets , _ = graph_env
9491 query = CypherQuery (
9592 "MATCH (p:Person)-[:WORKS_FOR]->(c:Company) "
9693 "RETURN p.person_id AS person_id, p.name AS name, c.company_id AS company_id"
9794 ).with_config (config )
9895
99- result = getattr ( query , execute_method ) (
96+ result = query . execute (
10097 {
10198 "Person" : datasets ["Person" ],
10299 "Company" : datasets ["Company" ],
@@ -109,8 +106,7 @@ def test_relationship_query(graph_env, execute_method):
109106 assert data ["company_id" ] == [101 , 101 , 102 , 103 ]
110107
111108
112- @pytest .mark .parametrize ("execute_method" , ["execute" , "execute_datafusion" ])
113- def test_friendship_direct_and_network (graph_env , execute_method ):
109+ def test_friendship_direct_and_network (graph_env ):
114110 config , datasets , _ = graph_env
115111 # Direct friends of Alice (person_id = 1)
116112 query_direct = CypherQuery (
@@ -119,7 +115,7 @@ def test_friendship_direct_and_network(graph_env, execute_method):
119115 "RETURN b.person_id AS friend_id"
120116 ).with_config (config )
121117
122- result_direct = getattr ( query_direct , execute_method ) (
118+ result_direct = query_direct . execute (
123119 {
124120 "Person" : datasets ["Person" ],
125121 "FRIEND_OF" : datasets ["FRIEND_OF" ],
@@ -134,7 +130,7 @@ def test_friendship_direct_and_network(graph_env, execute_method):
134130 "RETURN f.person_id AS person1_id, t.person_id AS person2_id"
135131 ).with_config (config )
136132
137- result_edges = getattr ( query_edges , execute_method ) (
133+ result_edges = query_edges . execute (
138134 {
139135 "Person" : datasets ["Person" ],
140136 "FRIEND_OF" : datasets ["FRIEND_OF" ],
@@ -145,16 +141,15 @@ def test_friendship_direct_and_network(graph_env, execute_method):
145141 assert got == {(1 , 2 ), (1 , 3 ), (2 , 4 ), (3 , 4 )}
146142
147143
148- @pytest .mark .parametrize ("execute_method" , ["execute" , "execute_datafusion" ])
149- def test_two_hop_friends_of_friends (graph_env , execute_method ):
144+ def test_two_hop_friends_of_friends (graph_env ):
150145 config , datasets , _ = graph_env
151146 query = CypherQuery (
152147 "MATCH (a:Person)-[:FRIEND_OF]->(b:Person)-[:FRIEND_OF]->(c:Person) "
153148 "WHERE a.person_id = 1 "
154149 "RETURN a.person_id AS a_id, b.person_id AS b_id, c.person_id AS c_id"
155150 ).with_config (config )
156151
157- result = getattr ( query , execute_method ) (
152+ result = query . execute (
158153 {
159154 "Person" : datasets ["Person" ],
160155 "FRIEND_OF" : datasets ["FRIEND_OF" ],
@@ -164,29 +159,31 @@ def test_two_hop_friends_of_friends(graph_env, execute_method):
164159 assert set (data ["c_id" ]) == {4 }
165160
166161
167- @pytest .mark .parametrize ("execute_method" , ["execute" , "execute_datafusion" ])
168- def test_variable_length_path (graph_env , execute_method ):
162+ def test_variable_length_path (graph_env ):
169163 config , datasets , _ = graph_env
170164 query = CypherQuery (
171165 "MATCH (p1:Person)-[:FRIEND_OF*1..2]-(p2:Person) "
172166 "RETURN p1.person_id AS p1, p2.person_id AS p2"
173167 ).with_config (config )
174- _ = getattr (query , execute_method )(
168+
169+ result = query .execute (
175170 {
176171 "Person" : datasets ["Person" ],
177172 "FRIEND_OF" : datasets ["FRIEND_OF" ],
178173 }
179174 )
175+ data = result .to_pydict ()
176+ got = set (zip (data ["p1" ], data ["p2" ]))
177+ assert got == {(1 , 2 ), (1 , 3 ), (2 , 4 ), (3 , 4 ), (1 , 4 )}
180178
181179
182- @pytest .mark .parametrize ("execute_method" , ["execute" , "execute_datafusion" ])
183- def test_distinct_clause (graph_env , execute_method ):
180+ def test_distinct_clause (graph_env ):
184181 config , datasets , _ = graph_env
185182 query = CypherQuery (
186183 "MATCH (p:Person)-[:WORKS_FOR]->(c:Company) RETURN DISTINCT c.company_name"
187184 ).with_config (config )
188185
189- result = getattr ( query , execute_method ) (
186+ result = query . execute (
190187 {
191188 "Person" : datasets ["Person" ],
192189 "Company" : datasets ["Company" ],
0 commit comments