test_candidates_does_not_list_one_declaration_twice

Tests › tests/test_disambiguation.py

passed Passed in the packaged run.

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

  1. conn = sqlite3.connect(":memory:")
  2. conn.executescript("CREATE TABLE memberdef (rowid INTEGER PRIMARY KEY, name TEXT, kind TEXT);")
  3. duplicated = [ (4647, "void C::register_server", "include/c.h", 142, True), (4717, "void C::register_server", "include/c.h", 142, True), ]
→

When

  1. rows = candidate_rows(conn, "register_server", duplicated)
→

Then

  1. ✓ len(rows) equals 1
  2. ✓ 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

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pydossier18. _documentation_mentions → table_exists18table_exists19. _documentation_mentions → has_columns19has_columns20. has_columns → table_exists20table_exists21–22. _hint_from → _name_exists21_name_exists +1 more

… 55 steps between

callercallercallercallerclew/query/payload.pyclew/query/payload.pyclew/query/payload.pyclew/query/payload.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesdossier78. _referenced_by → table_exists78table_exists79. _macro_def → symbol_provenance79symbol_provenance80–81. symbol_provenance → records_provenance80records_provenance +1 more82. _gate_definitions → _gate_definition_gaps82_gate_definition_gaps83. _flatten_subject → _empty_callers_note83_empty_callers_note

… 105 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pydossier189. chain_trace → function_candidates189function_candidates190. chain_trace → candidate_rows190candidate_rows191. candidate_rows → symbol_provenance191symbol_provenance▶ test enters192–193. candidate_rows → qualified_name_of192qualified_name_of +1 more194. chain_trace → is_overloaded194is_overloaded195. chain_trace → _make_node195_make_node

… 31 later steps

2 more

tests/test_disambiguation.py:370 · its file's page

What it checks (2)

  1. assert len(rows) == 1, f"one declaration, one candidate: {[r.signature for r in rows]}" observes candidate_rows via rows
  2. assert rows[0].rowid == 4647, "the first row wins, preserving the definition-preferring order" observes candidate_rows via rows

Where the product reaches it

  • dossier → _chain_for → chain_trace → candidate_rows (flow)

Call flow

test_candidates_does_not_list_one_declaration_twice→candidate_rows

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.

test_candidates_does_not_list_one_declaration_twice · 2 checkscandidate_rowssymbol_provenanceREQ-DDB-INDEX-004 · measuredcandidate_rowsREQ-DDB-QUERY-003 · measuredcandidate_rowsREQ-DDB-QUERY-010 · measured
Also reaches 3 requirements

Its run touches their code; that is reach, not proof.