diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-12-28 01:25:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-28 01:25:28 (GMT) |
commit | fba8c7cf740433cc71280ea6dce6b44ee477b2d3 (patch) | |
tree | 47926c8e1d961eb9e7e0cf42c111c811b309e704 | |
parent | a3dbd4c70e93260432fc024265fdf9222926fdad (diff) | |
download | cpython-fba8c7cf740433cc71280ea6dce6b44ee477b2d3.zip cpython-fba8c7cf740433cc71280ea6dce6b44ee477b2d3.tar.gz cpython-fba8c7cf740433cc71280ea6dce6b44ee477b2d3.tar.bz2 |
gh-100553: Improve accuracy of sqlite3.Row iter test (GH-100555)
(cherry picked from commit 3dc48dabd48864039951715816e07986a4828d80)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r-- | Lib/test/test_sqlite3/test_factory.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_sqlite3/test_factory.py b/Lib/test/test_sqlite3/test_factory.py index cdaf125..2b70093 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""" |