test_search_prose_returns_a_snippet

Tests › tests/test_query.py

passed Passed in the packaged run.

What this test is for

Why it exists

The sample's markdown is ingested into FTS5; a term known to be in it comes back with a heading and a snippet showing the match in context.

Verifies REQ-DDB-QUERY-002

Given

  1. —
→

When

  1. hits = q.search_prose(rich_db, "chime")
  2. all(h.snippet for h in hits)
→

Then

  1. ✓ hits holds
  2. ✓ any(h.file_path.endswith(".md") for h in hits) holds
  3. ✓ all(h.snippet for h in hits) holds
  4. ✓ any(">>" in h.snippet for h in hits) holds

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

… 215 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)loopmain216. _memberdef_corpora → _expansion_sql216_expansion_sql217. _expansion_sql → has_columns217has_columns218. has_columns → table_exists218table_exists219. _memberdef_corpora → _memberdef_candidates219_memberdef_candidates220. _memberdef_candidates → table_exists220table_exists

… 73 steps between

command-line usercommand-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesother filesopt (line 1012)optopt (line 1014)optmain294. corpus_payload → _prose_corpus294_prose_corpus295. _prose_corpus → search_prose_graded295search_prose_graded296. search_prose_graded → _query_tokens296_query_tokens▶ test enters297. search_prose_graded → connect297connect298. search_prose_graded → table_exists298table_exists299. search_prose_graded → _fts_match299_fts_match300. search_prose_graded → _fts_match300_fts_match301. search_prose_graded → strip_xml301strip_xml302. search_prose_graded → list302list303. search_prose_graded → member_doc_rows303member_doc_rows304. member_doc_rows → table_exists304table_exists305. member_doc_rows → has_columns305has_columns306. search_prose_graded → _collapse306_collapse307. _prose_corpus → prose_emptiness307prose_emptiness308. prose_emptiness → has_prose_corpus308has_prose_corpus

… 92 later steps

2 more

tests/test_query.py:908 · its file's page

What it checks (4)

  1. assert hits, "'chime' is in the fixture tree's docs/architecture.md" observes search_prose via hits
  2. assert any(h.file_path.endswith(".md") for h in hits) observes search_prose via hits
  3. assert all(h.snippet for h in hits) observes all
  4. assert any(">>" in h.snippet for h in hits), "snippet() must mark the match" observes search_prose via hits

Where the product reaches it

  • dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all (flow)

Call flow

test_search_prose_returns_a_snippet→search_prose→all

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_search_prose_returns_a_snippet · 4 checkssearch_proseREQ-DDB-QUERY-001 · measuredsearch_prosesearch_prose_gradedtable_existsREQ-DDB-QUERY-003 · measuredsearch_prosesearch_prose_gradedmember_doc_rowsREQ-DDB-QUERY-007 · measuredallREQ-DDB-WIKI-054 · inferred

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-QUERY-002catalogunknown
Also reaches 4 requirements

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