Skip to content

Commit a29499a

Browse files
author
Erlend E. Aasland
committed
Add tests
1 parent dc8976b commit a29499a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Lib/sqlite3/test/test_dbapi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,15 @@ def test_connection_limits(self):
344344
finally: # restore old limit
345345
self.cx.SQLITE_LIMIT_SQL_LENGTH = limit
346346

347+
def test_connection_delete_limit(self):
348+
msg = "Cannot delete limit attributes"
349+
with self.assertRaisesRegex(sqlite.ProgrammingError, msg):
350+
del self.cx.SQLITE_LIMIT_LENGTH
351+
352+
def test_connection_bad_set_limit(self):
353+
with self.assertRaises(TypeError):
354+
self.cx.SQLITE_LIMIT_EXPR_DEPTH = "a"
355+
347356

348357
class UninitialisedConnectionTests(unittest.TestCase):
349358
def setUp(self):
@@ -771,6 +780,11 @@ def run(err):
771780
self.fail("\n".join(err))
772781

773782
def test_check_connection_thread(self):
783+
def set_cx_limit():
784+
self.con.SQLITE_LIMIT_LENGTH = 0
785+
def get_cx_limit():
786+
return self.con.SQLITE_LIMIT_LENGTH
787+
774788
fns = [
775789
lambda: self.con.cursor(),
776790
lambda: self.con.commit(),
@@ -779,6 +793,8 @@ def test_check_connection_thread(self):
779793
lambda: self.con.set_trace_callback(None),
780794
lambda: self.con.set_authorizer(None),
781795
lambda: self.con.create_collation("foo", None),
796+
lambda: set_cx_limit(),
797+
lambda: get_cx_limit(),
782798
]
783799
for fn in fns:
784800
with self.subTest(fn=fn):

0 commit comments

Comments
 (0)