bpo-44041: Add test for sqlite3 column count (GH-25907)

This commit is contained in:
Erlend Egeberg Aasland 2021-06-04 19:36:08 +02:00 committed by GitHub
parent 17c4edc4e0
commit 8363ac8607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -555,6 +555,17 @@ class CursorTests(unittest.TestCase):
]
self.assertEqual(results, expected)
def test_column_count(self):
# Check that column count is updated correctly for cached statements
select = "select * from test"
res = self.cu.execute(select)
old_count = len(res.description)
# Add a new column and execute the cached select query again
self.cu.execute("alter table test add newcol")
res = self.cu.execute(select)
new_count = len(res.description)
self.assertEqual(new_count - old_count, 1)
class ThreadTests(unittest.TestCase):
def setUp(self):