Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-100553: Improve accuracy of sqlite3.Row iter test #100555

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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