[Python-checkins] gh-100553: Improve accuracy of sqlite3.Row iter test (#100555)

erlend-aasland webhook-mailer at python.org
Tue Dec 27 19:58:10 EST 2022


https://github.com/python/cpython/commit/3dc48dabd48864039951715816e07986a4828d80
commit: 3dc48dabd48864039951715816e07986a4828d80
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2022-12-28T01:58:05+01:00
summary:

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

files:
M Lib/test/test_sqlite3/test_factory.py

diff --git a/Lib/test/test_sqlite3/test_factory.py b/Lib/test/test_sqlite3/test_factory.py
index 7fdc45ab6924..7c36135ecadc 100644
--- a/Lib/test/test_sqlite3/test_factory.py
+++ b/Lib/test/test_sqlite3/test_factory.py
@@ -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"""



More information about the Python-checkins mailing list