@@ -389,10 +389,25 @@ def test_autocommit_setget(self):
389389
390390 def test_autocommit_setget_invalid (self ):
391391 msg = "autocommit must be True, False, or.*LEGACY"
392- for mode in "a" , 12 , (), None :
392+ for mode in "a" , 12 , (), None , 2 ** 1000 , - 2 ** 1000 :
393393 with self .subTest (mode = mode ):
394394 with self .assertRaisesRegex (ValueError , msg ):
395395 sqlite .connect (":memory:" , autocommit = mode )
396+ with memory_database () as cx :
397+ with self .assertRaisesRegex (ValueError , msg ):
398+ cx .autocommit = mode
399+ # a failed assignment does not change the value
400+ self .assertEqual (cx .autocommit ,
401+ sqlite .LEGACY_TRANSACTION_CONTROL )
402+
403+ def test_autocommit_delete (self ):
404+ with memory_database () as cx :
405+ cx .autocommit = False
406+ with self .assertRaisesRegex (AttributeError ,
407+ "cannot delete autocommit attribute" ):
408+ del cx .autocommit
409+ # a failed deletion does not change the value
410+ self .assertIs (cx .autocommit , False )
396411
397412 def test_autocommit_disabled (self ):
398413 expected = [
0 commit comments