Skip to content

Commit d68d6d8

Browse files
author
Erlend E. Aasland
committed
Add test for too many SQL variables
1 parent 8cdb980 commit d68d6d8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Lib/test/test_sqlite3/test_dbapi.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,13 @@ def __getitem__(slf, x):
540540
with self.assertRaises(ZeroDivisionError):
541541
self.cu.execute("select name from test where name=?", L())
542542

543+
def test_execute_too_many_params(self):
544+
category = sqlite.SQLITE_LIMIT_VARIABLE_NUMBER
545+
msg = "too many SQL variables"
546+
with cx_limit(self.cx, category=category, limit=1):
547+
with self.assertRaisesRegex(sqlite.OperationalError, msg):
548+
self.cu.execute("insert into test values(?, ?)", (1, 2))
549+
543550
def test_execute_dict_mapping(self):
544551
self.cu.execute("insert into test(name) values ('foo')")
545552
self.cu.execute("select name from test where name=:name", {"name": "foo"})

0 commit comments

Comments
 (0)