test_a_body_literal_finds_its_function

Tests › tests/test_code_corpus.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE INNERMOST FUNCTION RANKS FIRST: `createClient` holds the text, and the file's `__module__` row also contains it; the smaller unit is the answer.

Given

  1. rows = _tools(tmp_path).search("retryLimit", corpus="code")["results"]
→

When

  1. —
→

Then

  1. ✓ rows holds
  2. ✓ rows[0]["name"] equals "createClient"
  3. ✓ rows[0]["kind"] equals "function"
  4. ✓ rows[0]["snippet"] contains "retryLimit"
  5. ✓ {r["name"] for r in rows} does not contain "other"

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

… 10 earlier steps

command-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesalt (line 1171)altopt (line 485)optmain11. propose → build_context11build_context12. build_context → derive_scope12derive_scope13. derive_scope → _declared_index_scope13_declared_index_scope▶ test enters14. _declared_index_scope → load_declaration_located14load_declaration_located15. load_declaration_located → _read_mapping15_read_mapping16. _read_mapping → _parsed_declaration16_parsed_declaration17. load_declaration_located → _checked_sections17_checked_sections

… 26 steps between

command-line usercommand-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesother filesopt (line 696)opttry (line 1003)tryopt (line 847)optloop (line 746)looploop (line 1055)loopopt (line 1075)optmain44. _declared_index_scope → _existing_paths44_existing_paths45. derive_scope → whole_repo_scope45whole_repo_scope46. whole_repo_scope → _gitignored_paths46_gitignored_paths47. _gitignored_paths → git_argv47git_argv48–49. git_argv → _no_ext_diff48_no_ext_diff +1 more50. _gitignored_paths → git_env50git_env51. whole_repo_scope → list51list52–56. whole_repo_scope → nested_repo_roots52nested_repo_roots +4 more57. nested_repo_roots → _nested_repos_under57_nested_repos_under58. whole_repo_scope → _gitignored_paths58_gitignored_paths59–60. whole_repo_scope → _pruned_dirs59_pruned_dirs +1 more61. _pruned_dirs → _skip_dir61_skip_dir62–64. _pruned_dirs → _descendable62_descendable +2 more65–68. whole_repo_scope → _declaration_note65_declaration_note +3 more69. derive_scope → whole_repo_scope69whole_repo_scope▶ test enters70–72. build_context → repo_source_files70repo_source_files +2 more73. _ts_language_for → _grammar_available73_grammar_available▶ test enters74–75. _grammar_available → has_language74has_language +1 more76. _ts_language_for → _try_import_ts_module76_try_import_ts_module77–78. build_context → scope_membership77scope_membership +1 more

… 4 steps between

command-line usercommand-line usercommand-line usercommand-line userother filesother filesother filesother filesopt (line 288)optopt (line 385)optmain83. _cached_parser → _try_import_ts_module83_try_import_ts_module84. _ast_parse_one_file → _parseable_file84_parseable_file85. _parseable_file → binary_file85binary_file▶ test enters86–87. _ast_parse_one_file → _disambiguate_header86_disambiguate_header +1 more

… 23 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/propose/astdefs.pyclew/propose/astdefs.pyclew/propose/astdefs.pyclew/propose/astdefs.pyother filesother filesother filesother filesmain111. _accessor_site → callee_name111callee_name112. build_context → load_declaration112load_declaration113. load_declaration → load_declaration_located113load_declaration_located▶ test enters114–115. propose → _sections114_sections +1 more

… 57 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/init_command.pyclew/init_command.pyclew/init_command.pyclew/init_command.pyother filesother filesother filesother filesloop (line 312)looploop (line 314)loopmain173. diagnose → _check_doxygen173_check_doxygen174. _check_doxygen → uses_rustdoc174uses_rustdoc175. uses_rustdoc → discover_doxyfile175discover_doxyfile▶ test enters176. uses_rustdoc → has_cargo_manifest176has_cargo_manifest177. _check_doxygen → _needs_doxygen177_needs_doxygen178. _needs_doxygen → claims178claims

… 27 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.pyother filesother filesother filesother filestry (line 155)trymain206–207. _locate → target_for206target_for +1 more208. target_for → state_home208state_home▶ test enters209–211. query_main → _payload209_payload +2 more212. corpus_payload → _symbol_corpus212_symbol_corpus▶ test enters213. _symbol_corpus → search_counted213search_counted214. search_counted → connect214connect

… 51 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.pyother filesother filesother filesother filesopt (line 150)optmain266–267. _prune_rows → _prune_rows266_prune_rows +1 more268. _pruned_row → _absent268_absent▶ test enters269. _pruned_row → _prune_rows269_prune_rows270. search_emptiness → unsearched_corpora270unsearched_corpora271. unsearched_corpora → connect271connect

… 20 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesmain292. search_emptiness → _scope_sentence292_scope_sentence293. _symbol_corpus → with_limit_disclosure293with_limit_disclosure294. corpus_payload → _prose_corpus294_prose_corpus▶ test enters295. _prose_corpus → search_prose_graded295search_prose_graded296. search_prose_graded → _query_tokens296_query_tokens

… 14 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesopt (line 474)optloop (line 538)loopmain311. prose_emptiness → token_hit_counts311token_hit_counts312. prose_emptiness → _render_counts312_render_counts313. corpus_payload → _code_corpus313_code_corpus▶ test enters314–321. _code_corpus → search_code314search_code +7 more322. _file_hits → _first_match322_first_match323. _code_corpus → count_code323count_code324–326. count_code → _has_table324_has_table +2 more327. _code_corpus → with_limit_disclosure327with_limit_disclosure328. corpus_payload → _files_corpus328_files_corpus329. _files_corpus → files_context329files_context330. files_context → directory_rollup330directory_rollup

… 14 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/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 filesmain345. list_files → _matches345_matches346. _files_corpus → files_miss346files_miss347. corpus_payload → lock_roster347lock_roster▶ test enters348. lock_roster → connect348connect349. lock_roster → table_exists349table_exists

… 9 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.pyother filesother filesother filesother filesmain359–360. lock_roster → _object_route359_object_route +1 more361. corpus_payload → one361one▶ test enters362. corpus_payload → one362one363. corpus_payload → thread_roster363thread_roster364. thread_roster → connect364connect365. thread_roster → table_exists365table_exists

… 10 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyother filesother filesother filesother filesmain376–377. thread_roster → _thread_origins376_thread_origins +1 more378. corpus_payload → _config_found_on_the_wire378_config_found_on_the_wire▶ test enters379. _config_found_on_the_wire → _compact_gate_panel379_compact_gate_panel380. corpus_payload → kconfig_space380kconfig_space

… 20 later steps

8 more

tests/test_code_corpus.py:63 · its file's page

What it checks (4)

  1. assert rows and rows[0]["name"] == "createClient", rows observes _tools via rows
  2. assert rows[0]["kind"] == "function", rows[0] observes _tools via rows
  3. assert "retryLimit" in rows[0]["snippet"], rows[0] observes _tools via rows
  4. assert "other" not in {r["name"] for r in rows}, rows observes _tools via rows

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

test_a_body_literal_finds_its_function→_tools

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_a_body_literal_finds_its_function · 4 checks_tools_run_pipeline_run_pipeline_innerreport_statsREQ-DDB-CLI-001 · measured_tools… 7 calls …doxygen_supports_sqlite3REQ-DDB-CLI-002 · inferred_tools… 3 calls …stated_document_metaREQ-DDB-CONFIG-001 · measured_tools… 4 calls …_is_flat_req_listREQ-DDB-CONFIG-003 · inferred_tools… 3 calls …resolve_preprocessorREQ-DDB-CONFIG-004 · measured_tools… 3 calls …import_kconfigREQ-DDB-CONFIG-005 · measured_tools… 3 calls …recorded_explicitREQ-DDB-CONFIG-006 · measured_tools… 3 calls …write_build_signatureREQ-DDB-CONFIG-007 · measured_tools… 3 calls …load_toolchain_configREQ-DDB-CONFIG-009 · measured_tools… 5 calls …read_requirements_sectionREQ-DDB-GUARD-012 · inferred_tools… 5 calls …parse_doxygen_tagsREQ-DDB-GUARD-019 · inferred_tools… 5 calls …apply_autobriefREQ-DDB-GUARD-024 · inferred

and 42 more requirement paths, listed below.

Also reaches 58 requirements

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