]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-100553: Improve accuracy of sqlite3.Row iter test (#100555)
authorNikita Sobolev <mail@sobolevn.me>
Wed, 28 Dec 2022 00:58:05 +0000 (03:58 +0300)
committerGitHub <noreply@github.com>
Wed, 28 Dec 2022 00:58:05 +0000 (01:58 +0100)
Lib/test/test_sqlite3/test_factory.py

index 7fdc45ab69243dfac3ac760ab0692fbde8cd39de..7c36135ecadccd7cb26169fd3cf67f883b819977 100644 (file)
@@ -179,8 +179,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"""