Skip to content

Commit

Permalink
gh-100553: Improve accuracy of sqlite3.Row iter test (GH-100555)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3dc48da)

Co-authored-by: Nikita Sobolev <[email protected]>
  • Loading branch information
miss-islington and sobolevn authored Dec 28, 2022
1 parent 1ffc672 commit 0428550
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Lib/sqlite3/test/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,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 0428550

Please sign in to comment.