summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-12-28 01:16:53 (GMT)
committerGitHub <noreply@github.com>2022-12-28 01:16:53 (GMT)
commit04285502ba7d90e41138b0282434372be18ac042 (patch)
tree412911cfb22adb250aa8e4044c389890767f7c04 /Lib/sqlite3/test
parent1ffc67265f1a622751069997e7ca8193f983e1e2 (diff)
downloadcpython-04285502ba7d90e41138b0282434372be18ac042.zip
cpython-04285502ba7d90e41138b0282434372be18ac042.tar.gz
cpython-04285502ba7d90e41138b0282434372be18ac042.tar.bz2
gh-100553: Improve accuracy of sqlite3.Row iter test (GH-100555)
(cherry picked from commit 3dc48dabd48864039951715816e07986a4828d80) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Lib/sqlite3/test')
-rw-r--r--Lib/sqlite3/test/factory.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/sqlite3/test/factory.py b/Lib/sqlite3/test/factory.py
index 8764284..40a290f 100644
--- a/Lib/sqlite3/test/factory.py
+++ b/Lib/sqlite3/test/factory.py
@@ -155,8 +155,14 @@ class RowFactoryTests(unittest.TestCase):
"""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"""