@@ -344,6 +344,15 @@ def test_connection_limits(self):
344
344
finally : # restore old limit
345
345
self .cx .SQLITE_LIMIT_SQL_LENGTH = limit
346
346
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
+
347
356
348
357
class UninitialisedConnectionTests (unittest .TestCase ):
349
358
def setUp (self ):
@@ -771,6 +780,11 @@ def run(err):
771
780
self .fail ("\n " .join (err ))
772
781
773
782
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
+
774
788
fns = [
775
789
lambda : self .con .cursor (),
776
790
lambda : self .con .commit (),
@@ -779,6 +793,8 @@ def test_check_connection_thread(self):
779
793
lambda : self .con .set_trace_callback (None ),
780
794
lambda : self .con .set_authorizer (None ),
781
795
lambda : self .con .create_collation ("foo" , None ),
796
+ lambda : set_cx_limit (),
797
+ lambda : get_cx_limit (),
782
798
]
783
799
for fn in fns :
784
800
with self .subTest (fn = fn ):
0 commit comments