Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fba8c7c

Browse filesBrowse files
gh-100553: Improve accuracy of sqlite3.Row iter test (GH-100555)
(cherry picked from commit 3dc48da) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent a3dbd4c commit fba8c7c
Copy full SHA for fba8c7c

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed

‎Lib/test/test_sqlite3/test_factory.py

Copy file name to clipboardExpand all lines: Lib/test/test_sqlite3/test_factory.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,14 @@ def test_sqlite_row_iter(self):
179179
"""Checks if the row object is iterable"""
180180
self.con.row_factory = sqlite.Row
181181
row = self.con.execute("select 1 as a, 2 as b").fetchone()
182-
for col in row:
183-
pass
182+
183+
# Is iterable in correct order and produces valid results:
184+
items = [col for col in row]
185+
self.assertEqual(items, [1, 2])
186+
187+
# Is iterable the second time:
188+
items = [col for col in row]
189+
self.assertEqual(items, [1, 2])
184190

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.