test_apostrophe_is_escaped_by_doubling¶
Tests › tests/test_vocabulary.py
What this test is for
Why it exists
`repr` quotes an apostrophe-bearing value with DOUBLE quotes, which SQLite reads as an identifier, not a string. No shipped value contains one today; the generator must not be the reason it can never be added.
Given
vocab = Vocabulary(id="t", values=("it's", "plain"), means="test")conn = sqlite3.connect(":memory:")
2 more
conn.execute(f"CREATE TABLE t (c TEXT {vocab.check('c')})")conn.execute('INSERT INTO t VALUES ("it\'s")')
When
conn.execute("INSERT INTO t VALUES ('nope')")conn.close()
Then
- ✓ vocab.check("c") equals "CHECK(c IN ('it''s', 'plain'))"
- ✓ raises sqlite3.IntegrityError
tests/test_vocabulary.py:332 · its file's page
What it checks (1)
assert vocab.check("c") == "CHECK(c IN ('it''s', 'plain'))"not attributed
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-SCHEMA-012 measured