Skip to content

Commit e57aca4

Browse files
sobolevnmiss-islington
authored andcommitted
pythongh-100553: Improve accuracy of sqlite3.Row iter test (pythonGH-100555)
(cherry picked from commit 3dc48da) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent 1ffc672 commit e57aca4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/sqlite3/test/factory.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,14 @@ def test_sqlite_row_iter(self):
155155
"""Checks if the row object is iterable"""
156156
self.con.row_factory = sqlite.Row
157157
row = self.con.execute("select 1 as a, 2 as b").fetchone()
158-
for col in row:
159-
pass
158+
159+
# Is iterable in correct order and produces valid results:
160+
items = [col for col in row]
161+
self.assertEqual(items, [1, 2])
162+
163+
# Is iterable the second time:
164+
items = [col for col in row]
165+
self.assertEqual(items, [1, 2])
160166

161167
def test_sqlite_row_as_tuple(self):
162168
"""Checks if the row object can be converted to a tuple"""

0 commit comments

Comments
 (0)