mirror of
https://github.com/python/cpython.git
synced 2025-10-03 21:55:41 +00:00
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:
parent
a3dbd4c70e
commit
fba8c7cf74
1 changed files with 8 additions and 2 deletions
|
@ -179,8 +179,14 @@ class RowFactoryTests(unittest.TestCase):
|
||||||
"""Checks if the row object is iterable"""
|
"""Checks if the row object is iterable"""
|
||||||
self.con.row_factory = sqlite.Row
|
self.con.row_factory = sqlite.Row
|
||||||
row = self.con.execute("select 1 as a, 2 as b").fetchone()
|
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):
|
def test_sqlite_row_as_tuple(self):
|
||||||
"""Checks if the row object can be converted to a tuple"""
|
"""Checks if the row object can be converted to a tuple"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue