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

(cherry picked from commit 3dc48dabd4)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2022-12-27 17:25:28 -08:00 committed by GitHub
parent a3dbd4c70e
commit fba8c7cf74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"""