From: Nikita Sobolev Date: Wed, 28 Dec 2022 00:58:05 +0000 (+0300) Subject: gh-100553: Improve accuracy of sqlite3.Row iter test (#100555) X-Git-Tag: v3.12.0a4~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3dc48dabd48864039951715816e07986a4828d80;p=thirdparty%2FPython%2Fcpython.git gh-100553: Improve accuracy of sqlite3.Row iter test (#100555) --- 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 @@ 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"""