Skip to content

Commit

Permalink
pythongh-100553: Improve accuracy of sqlite3.Row iter test (pythonGH-…
Browse files Browse the repository at this point in the history
…100555)

(cherry picked from commit 3dc48da)

Co-authored-by: Nikita Sobolev <[email protected]>
  • Loading branch information
sobolevn authored and miss-islington committed Dec 28, 2022
1 parent 1ffc672 commit e57aca4
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 e57aca4

Please sign in to comment.