Skip to content

bpo-44041: Add test for sqlite3 column count #25907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Lib/sqlite3/test/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,17 @@ def test_last_row_id_insert_o_r(self):
]
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):
Expand Down