summaryrefslogtreecommitdiff
path: root/Lib/sqlite3/test/dbapi.py
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-06-04 19:36:08 +0200
committerGitHub <noreply@github.com>2021-06-04 18:36:08 +0100
commit8363ac8607eca7398e568e1336154e1262a995a0 (patch)
tree012e9c60acd5e09a34871b081fa5260dfbcf5714 /Lib/sqlite3/test/dbapi.py
parent17c4edc4e0692fe55e185755ea8a2f5238f3ef08 (diff)
downloadcpython-git-8363ac8607eca7398e568e1336154e1262a995a0.tar.gz
bpo-44041: Add test for sqlite3 column count (GH-25907)
Diffstat (limited to 'Lib/sqlite3/test/dbapi.py')
-rw-r--r--Lib/sqlite3/test/dbapi.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index 77fafe0930..4bda6aa393 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -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):