mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
bpo-37406: sqlite3 raises TypeError for wrong operation type (GH-14386)
The sqlite3 module now raises TypeError, rather than ValueError, if operation argument type is not str: execute(), executemany() and calling a connection.
This commit is contained in:
parent
ed076ed467
commit
c6a2320e87
6 changed files with 11 additions and 16 deletions
|
|
@ -230,7 +230,7 @@ class CursorTests(unittest.TestCase):
|
|||
""")
|
||||
|
||||
def CheckExecuteWrongSqlArg(self):
|
||||
with self.assertRaises(ValueError):
|
||||
with self.assertRaises(TypeError):
|
||||
self.cu.execute(42)
|
||||
|
||||
def CheckExecuteArgInt(self):
|
||||
|
|
@ -377,7 +377,7 @@ class CursorTests(unittest.TestCase):
|
|||
self.cu.executemany("insert into test(income) values (?)", mygen())
|
||||
|
||||
def CheckExecuteManyWrongSqlArg(self):
|
||||
with self.assertRaises(ValueError):
|
||||
with self.assertRaises(TypeError):
|
||||
self.cu.executemany(42, [(3,)])
|
||||
|
||||
def CheckExecuteManySelect(self):
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ class RegressionTests(unittest.TestCase):
|
|||
Call a connection with a non-string SQL request: check error handling
|
||||
of the statement constructor.
|
||||
"""
|
||||
self.assertRaises(sqlite.Warning, self.con, 1)
|
||||
self.assertRaises(TypeError, self.con, 1)
|
||||
|
||||
def CheckCollation(self):
|
||||
def collation_cb(a, b):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue