From e57aca45b21913b9017ee5641e526c77265bbe16 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Wed, 28 Dec 2022 03:58:05 +0300 Subject: [PATCH] gh-100553: Improve accuracy of sqlite3.Row iter test (GH-100555) (cherry picked from commit 3dc48dabd48864039951715816e07986a4828d80) Co-authored-by: Nikita Sobolev --- Lib/sqlite3/test/factory.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/sqlite3/test/factory.py b/Lib/sqlite3/test/factory.py index 876428497542f8..40a290f0c9816f 100644 --- a/Lib/sqlite3/test/factory.py +++ b/Lib/sqlite3/test/factory.py @@ -155,8 +155,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"""