Skip to content

Commit e58797c

Browse files
Simplify test
SQLite seems to have slightly inconsisten behaviour when it comes to enforcing limits. It might have something to do with the SQLite compile time options, or it may be a bug. Simplifying the test seems to work in different environments.
1 parent 4e9ef10 commit e58797c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Lib/test/test_sqlite3/test_hooks.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,11 @@ def test_trace_too_much_expanded_sql(self):
326326
# unexpanded SQL statement (for SQLite 3.14.0 and newer).
327327
# The resulting string length is limited by the runtime limit
328328
# SQLITE_LIMIT_LENGTH.
329-
template = "select 'b' as \"a\" from sqlite_master where \"a\"="
329+
template = "select 1 as a where a="
330330
category = sqlite.SQLITE_LIMIT_LENGTH
331331
with memory_database() as cx, cx_limit(cx, category=category) as lim:
332-
nextra = lim - (len(template) + 2) - 1
333-
ok_param = "a" * nextra
334-
bad_param = "a" * (nextra + 1)
332+
ok_param = "a"
333+
bad_param = "a" * lim
335334

336335
unexpanded_query = template + "?"
337336
expected = [unexpanded_query]

0 commit comments

Comments
 (0)