test_ingest_one_doc_file_accepts_valid_utf8¶
Tests › tests/test_build_docs_db.py
What this test is for
Why it exists
Sanity-check the strict-decode change doesn't reject legitimate UTF-8 (including multi-byte characters).
Verifies REQ-DDB-PIPE-010
Given
db_path = tmp_path / "clew.db"conn = sqlite3.connect(str(db_path))
3 more
conn.execute("CREATE VIRTUAL TABLE supplementary_docs USING fts5(file_path, heading, content)")good = tmp_path / "ok.md"good.write_text("# Heading\nbody with é character\n", encoding="utf-8")
When
result = _ingest_one_doc_file(conn, good, "ok.md")rows = conn.execute("SELECT heading, content FROM supplementary_docs").fetchall()
Then
- ✓ result equals 1
- ✓ rows[0][0] equals "Heading"
- ✓ rows[0][1] contains "é"
tests/test_build_docs_db.py:401 · its file's page
What it checks (3)
assert result == 1observes_ingest_one_doc_fileviaresultassert rows[0][0] == "Heading"not attributedassert "é" in rows[0][1]not attributed
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
test_ingest_one_doc_file_accepts_valid_utf8→_ingest_one_doc_fileWhat 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.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-PIPE-010 | catalog | unknown |
Also reaches 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-002 measured
- REQ-DDB-PIPE-001 measured