Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3841a33

Browse files
Lorak-mmkdkropachev
authored andcommitted
verify_iterator_data: Use plain assert
This method took a assertEqual callback, but it was always self.assertEqual. This commit removes this unnecessary indirection by replacing the callback with plain assert.
1 parent b8776a3 commit 3841a33

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎tests/integration/standard/test_cython_protocol_handlers.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ def test_cython_parser(self):
4747
"""
4848
Test Cython-based parser that returns a list of tuples
4949
"""
50-
verify_iterator_data(self.assertEqual, get_data(ProtocolHandler))
50+
verify_iterator_data(get_data(ProtocolHandler))
5151

5252
@cythontest
5353
def test_cython_lazy_parser(self):
5454
"""
5555
Test Cython-based parser that returns an iterator of tuples
5656
"""
57-
verify_iterator_data(self.assertEqual, get_data(LazyProtocolHandler))
57+
verify_iterator_data(get_data(LazyProtocolHandler))
5858

5959
@numpytest
6060
def test_cython_lazy_results_paged(self):
@@ -74,7 +74,7 @@ def test_cython_lazy_results_paged(self):
7474
results = session.execute("SELECT * FROM test_table")
7575

7676
assert results.has_more_pages
77-
assert verify_iterator_data(self.assertEqual, results) == self.N_ITEMS # make sure we see all rows
77+
assert verify_iterator_data(results) == self.N_ITEMS # make sure we see all rows
7878

7979
cluster.shutdown()
8080

@@ -146,7 +146,7 @@ def _verify_numpy_page(self, page):
146146
arr = page[colname]
147147
self.match_dtype(datatype, arr.dtype)
148148

149-
return verify_iterator_data(self.assertEqual, arrays_to_list_of_tuples(page, colnames))
149+
return verify_iterator_data(arrays_to_list_of_tuples(page, colnames))
150150

151151
def match_dtype(self, datatype, dtype):
152152
"""Match a string cqltype (e.g. 'int' or 'blob') with a numpy dtype"""
@@ -192,18 +192,17 @@ def get_data(protocol_handler):
192192
return results
193193

194194

195-
def verify_iterator_data(assertEqual, results):
195+
def verify_iterator_data(results):
196196
"""
197197
Check the result of get_data() when this is a list or
198198
iterator of tuples
199199
"""
200200
count = 0
201201
for count, result in enumerate(results, 1):
202202
params = get_all_primitive_params(result[0])
203-
assertEqual(len(params), len(result),
204-
msg="Not the right number of columns?")
203+
assert len(params) == len(result), "Not the right number of columns?"
205204
for expected, actual in zip(params, result):
206-
assertEqual(actual, expected)
205+
assertactual==expected
207206
return count
208207

209208

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /