test_single_value_vocabulary_generates_valid_sql¶
Tests › tests/test_vocabulary.py
What this test is for
Why it exists
The idiom this replaces used `{tuple!r}`, which emits `IN ('x',)` for a one-value set — SQLite rejects the trailing comma. It survived only because every set it was applied to happened to have >= 2 values; `boundary_source` was the live one-value case until the declared-dispatch terminus widened it.
Given
one = Vocabulary(id="one", values=("only",), means="test")conn = sqlite3.connect(":memory:")
2 more
for vocab in [one, *(v for v in VOCABULARIES.values() if len(v.values) == 1)]: conn.execute(f"CREATE TABLE probe (c TEXT {vocab.check('c')})") conn.execute("INSERT INTO probe VALUES (?)", (vocab.values[0],)) with pytest.raises(sqlite3.IntegrityError): conn.execute("INSERT INTO probe VALUES ('__not_a_member__')") conn.execute("DROP TABLE probe")conn.close()
When
- —
Then
- ✓ one.check("c") equals "CHECK(c IN ('only'))"
tests/test_vocabulary.py:291 · its file's page
What it checks (1)
assert one.check("c") == "CHECK(c IN ('only'))"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