diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-11-10 19:46:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-10 18:46:11 +0000 |
commit | c1323d4b8cb010a06c11bace6e681bea7f895851 (patch) | |
tree | 37800fb4b11f3dddef2f3c337fbf0deb98884d69 /Lib/test/test_sqlite3/test_dbapi.py | |
parent | 4cdeee5978ee3f8ea7fe95172ae04d866cd88177 (diff) | |
download | cpython-c1323d4b8cb010a06c11bace6e681bea7f895851.tar.gz cpython-c1323d4b8cb010a06c11bace6e681bea7f895851.zip |
bpo-45754: Use correct SQLite limit when checking statement length (GH-29489)
Diffstat (limited to 'Lib/test/test_sqlite3/test_dbapi.py')
-rw-r--r-- | Lib/test/test_sqlite3/test_dbapi.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 6628eee975d..a5ec66fe22a 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -55,7 +55,7 @@ def memory_database(): # Temporarily limit a database connection parameter @contextlib.contextmanager -def cx_limit(cx, category=sqlite.SQLITE_LIMIT_LENGTH, limit=128): +def cx_limit(cx, category=sqlite.SQLITE_LIMIT_SQL_LENGTH, limit=128): try: _prev = cx.setlimit(category, limit) yield limit @@ -495,7 +495,7 @@ class ConnectionTests(unittest.TestCase): prev_limit = self.cx.setlimit(category, new_limit) self.assertEqual(saved_limit, prev_limit) self.assertEqual(self.cx.getlimit(category), new_limit) - msg = "string or blob too big" + msg = "query string is too large" self.assertRaisesRegex(sqlite.DataError, msg, self.cx.execute, "select 1 as '16'") finally: # restore saved limit @@ -1063,9 +1063,9 @@ class ExtensionTests(unittest.TestCase): def test_cursor_executescript_too_large_script(self): msg = "query string is too large" with memory_database() as cx, cx_limit(cx) as lim: - cx.executescript("select 'almost too large'".ljust(lim-1)) + cx.executescript("select 'almost too large'".ljust(lim)) with self.assertRaisesRegex(sqlite.DataError, msg): - cx.executescript("select 'too large'".ljust(lim)) + cx.executescript("select 'too large'".ljust(lim+1)) def test_cursor_executescript_tx_control(self): con = sqlite.connect(":memory:") |