From 07376bfe8285b85f0ca370ad357d4daa0b50f13a Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 27 Dec 2022 14:46:17 +0300 Subject: [PATCH] gh-100553: Improve `test_sqlite3.test_sqlite_row_iter` --- Lib/test/test_sqlite3/test_factory.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_sqlite3/test_factory.py b/Lib/test/test_sqlite3/test_factory.py index 7fdc45ab69243d..7c36135ecadccd 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"""