test_token_hit_counts_sees_the_class_corpus

Tests › tests/test_query.py

passed Passed in the packaged run.

What this test is for

Why it exists

The zero-result diagnosis counts each token over the corpora `search` reads. Leaving classes out of the count would report `0` for a token that matches a class and only a class — advising the caller to drop the one token that was working, which is gh#31's defect reintroduced through the new corpus.

Verifies REQ-DDB-QUERY-002

Given

  1. —
→

When

  1. counts = q.token_hit_counts(_class_db(tmp_path), ["ishapewidget", "nosuchtoken"])
→

Then

  1. ✓ counts["ishapewidget"] equals 1
  2. ✓ 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) · 11 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–238. search_counted → _config_candidates237_config_candidates +1 more

… 6 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_query.py:1449 · its file's page

What it checks (2)

  1. assert counts["ishapewidget"] == 1 observes token_hit_counts via counts
  2. 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_token_hit_counts_sees_the_class_corpus→token_hit_counts→_class_db

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_token_hit_counts_sees_the_class_corpus · 2 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-002catalogunknown
Also reaches 3 requirements

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