test_search_finds_a_class_by_name¶
Tests › tests/test_query.py
What this test is for
Why it exists
gh#315, the headline defect. `search` read `memberdef WHERE kind='function'` and the file-doc corpus, and NOTHING ELSE — classes live in `compounddef`, a table it never touched. So a class name returned a confident empty result, which is indistinguishable from a measured negative and is the worst failure mode this project has. Reproduced live on this repo's own index: `search("WritePlan")` returned only the mcp_config.py FILE DOC while the class sits at line 132.
Verifies REQ-DDB-QUERY-002
Given
- —
When
hits = q.search(_class_db(tmp_path), "PolygonWidget")by_name = {h.name: h for h in hits}
Then
- ✓ by_name contains "demo::shape::PolygonWidget"
- ✓ by_name["demo::shape::PolygonWidget"].kind equals "class"
- ✓ by_name["demo::shape::PolygonWidget"].file equals "src/demo/shape/PolygonWidget.hpp"
- ✓ by_name["demo::shape::PolygonWidget"].brief equals "Recomputes the cached outline."
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.
clew — `main` (clew/cli.py) · 35 of 400 steps
… 211 earlier steps
… 147 later steps
2 more
- `main` (scripts/export_parity.py) · 35 of 203 steps
- Look up one name: everything the index holds about it · 3 of 226 steps
tests/test_query.py:1389 · its file's page
What it checks (4)
assert "demo::shape::PolygonWidget" in by_namenot attributedassert by_name["demo::shape::PolygonWidget"].kind == "class"not attributedassert by_name["demo::shape::PolygonWidget"].file == "src/demo/shape/PolygonWidget.hpp"not attributedassert by_name["demo::shape::PolygonWidget"].brief == "Recomputes the cached outline."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
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.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-QUERY-002 | catalog | unknown |
Also reaches 5 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-004 measured
- REQ-DDB-QUERY-001 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-007 measured
- REQ-DDB-QUERY-012 measured