Skip to content

Commit 79c2edf

Browse files
Use new param style when invoking redisgraph-py from tests (#1953)
1 parent a7dab33 commit 79c2edf

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

tests/flow/test_index_scans.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,21 +249,19 @@ def test08_index_scan_multiple_filters(self):
249249

250250
def test09_index_scan_with_params(self):
251251
query = "MATCH (p:person) WHERE p.age = $age RETURN p.name"
252-
params = {'age':30}
253-
query = redis_graph.build_params_header(params) + query
254-
plan = redis_graph.execution_plan(query)
252+
params = {'age': 30}
253+
plan = redis_graph.execution_plan(query, params=params)
255254
self.env.assertIn('Index Scan', plan)
256-
query_result = redis_graph.query(query)
255+
query_result = redis_graph.query(query, params=params)
257256
expected_result = ["Lucy Yanfital"]
258257
self.env.assertEquals(query_result.result_set[0], expected_result)
259258

260259
def test10_index_scan_with_param_array(self):
261260
query = "MATCH (p:person) WHERE p.age in $ages RETURN p.name"
262-
params = {'ages':[30]}
263-
query = redis_graph.build_params_header(params) + query
264-
plan = redis_graph.execution_plan(query)
261+
params = {'ages': [30]}
262+
plan = redis_graph.execution_plan(query, params=params)
265263
self.env.assertIn('Index Scan', plan)
266-
query_result = redis_graph.query(query)
264+
query_result = redis_graph.query(query, params=params)
267265
expected_result = ["Lucy Yanfital"]
268266
self.env.assertEquals(query_result.result_set[0], expected_result)
269267

tests/flow/test_params.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,11 @@ def test_missing_parameter(self):
127127

128128
def test_id_scan(self):
129129
redis_graph.query("CREATE ({val:1})")
130-
expected_results=[[1]]
131-
params = {'id' : 0}
130+
expected_results = [[1]]
131+
params = {'id': 0}
132132
query = "MATCH (n) WHERE id(n)=$id return n.val"
133-
query_info = QueryInfo(query = query, description="Test id scan with params", expected_result = expected_results)
133+
query_info = QueryInfo(query=query, description="Test id scan with params", expected_result=expected_results)
134134
self._assert_resultset_equals_expected(redis_graph.query(query, params), query_info)
135-
query = redis_graph.build_params_header(params) + query
136-
plan = redis_graph.execution_plan(query)
135+
plan = redis_graph.execution_plan(query, params=params)
137136
self.env.assertIn('NodeByIdSeek', plan)
138137

0 commit comments

Comments
 (0)