mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-12 03:24:23 +02:00
Test for doubled single quotes in string defaults
Refs #811 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d7c6df6b46
commit
e7f567d764
1 changed files with 11 additions and 0 deletions
|
|
@ -311,6 +311,7 @@ def test_table_strict(fresh_db, create_table, expected_strict):
|
|||
1,
|
||||
1.3,
|
||||
"foo",
|
||||
"O'Brien",
|
||||
True,
|
||||
b"binary",
|
||||
),
|
||||
|
|
@ -323,6 +324,16 @@ def test_table_default_values(fresh_db, value):
|
|||
assert default_values == {"value": value}
|
||||
|
||||
|
||||
def test_table_default_values_escaped_quotes(fresh_db):
|
||||
# SQLite stores string defaults with single quotes doubled, so
|
||||
# introspection needs to unescape them again
|
||||
fresh_db.execute(
|
||||
"create table t (id integer primary key, name text default 'O''Brien')"
|
||||
)
|
||||
assert "default 'O''Brien'" in fresh_db["t"].schema
|
||||
assert fresh_db["t"].default_values == {"name": "O'Brien"}
|
||||
|
||||
|
||||
def test_pks_use_primary_key_declaration_order(fresh_db):
|
||||
# PRIMARY KEY (a, b) declared against columns stored in order (b, a) -
|
||||
# pks must follow the declaration order, which is what SQLite uses to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue