@@ -55,7 +55,7 @@ def memory_database():
5555
5656# Temporarily limit a database connection parameter
5757@contextlib .contextmanager
58- def cx_limit (cx , category = sqlite .SQLITE_LIMIT_LENGTH , limit = 128 ):
58+ def cx_limit (cx , category = sqlite .SQLITE_LIMIT_SQL_LENGTH , limit = 128 ):
5959 try :
6060 _prev = cx .setlimit (category , limit )
6161 yield limit
@@ -495,7 +495,7 @@ def test_connection_limits(self):
495495 prev_limit = self .cx .setlimit (category , new_limit )
496496 self .assertEqual (saved_limit , prev_limit )
497497 self .assertEqual (self .cx .getlimit (category ), new_limit )
498- msg = "string or blob too big "
498+ msg = "query string is too large "
499499 self .assertRaisesRegex (sqlite .DataError , msg ,
500500 self .cx .execute , "select 1 as '16'" )
501501 finally : # restore saved limit
@@ -1063,9 +1063,9 @@ def test_cursor_executescript_with_surrogates(self):
10631063 def test_cursor_executescript_too_large_script (self ):
10641064 msg = "query string is too large"
10651065 with memory_database () as cx , cx_limit (cx ) as lim :
1066- cx .executescript ("select 'almost too large'" .ljust (lim - 1 ))
1066+ cx .executescript ("select 'almost too large'" .ljust (lim ))
10671067 with self .assertRaisesRegex (sqlite .DataError , msg ):
1068- cx .executescript ("select 'too large'" .ljust (lim ))
1068+ cx .executescript ("select 'too large'" .ljust (lim + 1 ))
10691069
10701070 def test_cursor_executescript_tx_control (self ):
10711071 con = sqlite .connect (":memory:" )
0 commit comments