test_the_token_diagnosis_counts_macros

Tests › tests/test_macro_query.py

passed Passed in the packaged run.

What this test is for

Why it exists

gh#31's defect reintroduced through a new corpus: a token that matches ONLY a macro must not be named as the token that emptied the query. Asserted on the expansion, not just the name, because that is what `search` matches.

Verifies REQ-DDB-QUERY-012

Given

  1. —
→

When

  1. counts = token_hit_counts(macro_db, ["allow", "hidden_##member", "nosuchtoken"])
→

Then

  1. ✓ counts["allow"] is at least 1
  2. ✓ counts["hidden_##member"] is at least 1
  3. ✓ counts["nosuchtoken"] equals 0

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) · 10 of 400 steps

… 214 earlier steps

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyloop (line 1576)loopmain215–216. search_counted → _memberdef_corpora215_memberdef_corpora +1 more217. _expansion_sql → has_columns217has_columns218. has_columns → table_exists218table_exists219. _memberdef_corpora → _memberdef_candidates219_memberdef_candidates220. _memberdef_candidates → table_exists220table_exists

… 12 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pymain233. _class_candidates → _search_rank233_search_rank234. _class_candidates → class_rows234class_rows235. class_rows → table_exists235table_exists236. class_rows → strip_xml236strip_xml237. search_counted → _config_candidates237_config_candidates

… 7 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pymain245. _file_candidates → _doc_brief245_doc_brief246. _file_candidates → file_doc_rows246file_doc_rows247. file_doc_rows → table_exists247table_exists248. _file_candidates → undocumented_path_rows248undocumented_path_rows249. undocumented_path_rows → table_exists249table_exists

… 25 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesopt (line 1968)optopt (line 333)optloop (line 1856)loopopt (line 1902)optmain275. unsearched_corpora → _unread_kind_counts275_unread_kind_counts276. search_emptiness → token_hit_counts276token_hit_counts277. token_hit_counts → connect277connect▶ test enters278. token_hit_counts → _one_token_count278_one_token_count279. _one_token_count → table_exists279table_exists280. _one_token_count → _expansion_sql280_expansion_sql281. _one_token_count → class_rows281class_rows282. _one_token_count → file_doc_rows282file_doc_rows283–284. search_emptiness → _conjunction_note283_conjunction_note +1 more

… 116 later steps

2 more

tests/test_macro_query.py:353 · its file's page

What it checks (3)

  1. assert counts["allow"] >= 1 observes token_hit_counts via counts
  2. assert counts["hidden_##member"] >= 1 observes token_hit_counts via counts
  3. assert counts["nosuchtoken"] == 0 observes token_hit_counts via counts

Where the product reaches it

  • main → query_main → _payload → export_search → corpus_payload → _symbol_corpus → search_emptiness → token_hit_counts (flow)

Call flow

test_the_token_diagnosis_counts_macros→token_hit_counts

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_the_token_diagnosis_counts_macros · 3 checkstoken_hit_countsconnectREQ-DDB-QUERY-001 · measuredtoken_hit_counts_one_token_counttable_existsREQ-DDB-QUERY-003 · measuredtoken_hit_countsREQ-DDB-QUERY-007 · measured

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-QUERY-012catalogunknown
Also reaches 3 requirements

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