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 <mail@sobolevn.me>
  • Loading branch information
miss-islington and sobolevn authored Dec 28, 2022
1 parent a3dbd4c commit fba8c7c
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 fba8c7c

Please sign in to comment.