Skip to content

Commit

Permalink
pythongh-100553: Improve test_sqlite3.test_sqlite_row_iter
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Dec 27, 2022
1 parent b3da698 commit 07376bf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Lib/test/test_sqlite3/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,14 @@ def test_sqlite_row_iter(self):
"""Checks if the row object is iterable"""
self.con.row_factory = sqlite.Row
row = self.con.execute("select 1 as a, 2 as b").fetchone()
for col in row:
pass

# Is iterable in correct order and produces valid results:
items = [col for col in row]
self.assertEqual(items, [1, 2])

# Is iterable the second time:
items = [col for col in row]
self.assertEqual(items, [1, 2])

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

0 comments on commit 07376bf

Please sign in to comment.