test_candidates_does_not_list_one_declaration_twice¶
Tests › tests/test_disambiguation.py
What this test is for
Why it exists
gh#19. `dossier("register_server")` on entropic returned three candidates, two of them identical in signature, file, line AND has_body:
Given
conn = sqlite3.connect(":memory:")conn.executescript("CREATE TABLE memberdef (rowid INTEGER PRIMARY KEY, name TEXT, kind TEXT);")duplicated = [ (4647, "void C::register_server", "include/c.h", 142, True), (4717, "void C::register_server", "include/c.h", 142, True), ]
When
rows = candidate_rows(conn, "register_server", duplicated)
Then
- ✓ len(rows) equals 1
- ✓ rows[0].rowid equals 4647
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
Look up one name: everything the index holds about it · 6 of 226 steps
… 17 earlier steps
… 55 steps between
… 105 steps between
… 31 later steps
2 more
- clew — `main` (clew/cli.py) · 3 of 400 steps
- `main` (scripts/export_parity.py) · 3 of 203 steps
tests/test_disambiguation.py:370 · its file's page
What it checks (2)
assert len(rows) == 1, f"one declaration, one candidate: {[r.signature for r in rows]}"observescandidate_rowsviarowsassert rows[0].rowid == 4647, "the first row wins, preserving the definition-preferring order"observescandidate_rowsviarows
Where the product reaches it
dossier→_chain_for→chain_trace→candidate_rows(flow)
Call flow
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 3 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-004 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-010 measured