test_an_endpoint_with_no_resolvable_file_reports_empty

Tests › tests/test_edge_file.py

passed Passed in the packaged run.

What this test is for

Why it exists

`''` AND NOT A GUESS. A caller row whose `file_id` resolves to no `path` row has no file to report, and inventing one would put a path nobody can open into a reply whose value is that its paths are real. The same rule `FileSubject.harvested` follows one module over.

Given

  1. db = tmp_path / "clew.db"
  2. conn = sqlite3.connect(str(db))
6 more
  1. conn.executescript( """ CREATE TABLE path (rowid INTEGER PRIMARY KEY, name TEXT, type INTEGER); CREATE TABLE memberdef ( rowid INTEGER PRIMARY KEY, kind TEXT, name TEXT, file_id INTEGER, bodyfile_id INTEGER, bodystart INTEGER, bodyend INTEGER, definition TEXT, argsstring TEXT, briefdescription TEXT, detaileddescription TEXT, static INTEGER ); CREATE TABLE call_edges ( caller_rowid INTEGER, callee_rowid INTEGER, source TEXT, confidence TEXT ); """ )
  2. conn.execute("INSERT INTO path (rowid, name, type) VALUES (1, 'library/ct.c', 1)")
  3. conn.executemany( "INSERT INTO memberdef (rowid, kind, name, file_id, bodyfile_id, bodystart, bodyend, " "definition, argsstring, briefdescription, detaileddescription, static) " "VALUES (?, 'function', ?, ?, ?, ?, ?, ?, '()', '', '', 0)", [(1, "callee", 1, 1, 10, 20, "int callee"), (2, "orphan", 99, 99, 30, 40, "int orphan")], )
  4. conn.execute("INSERT INTO call_edges VALUES (2, 1, 'doxygen_sqlite', 'exact')")
  5. conn.commit()
  6. conn.close()
→

When

  1. built = q.dossier(db, "callee")
→

Then

  1. ✓ [c.file for c in built.function.callers] equals [""]

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.

Look up one name: everything the index holds about it · 23 of 226 steps

… 17 earlier steps

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pydossier18. _documentation_mentions → table_exists18table_exists19. _documentation_mentions → has_columns19has_columns20. has_columns → table_exists20table_exists21–22. _hint_from → _name_exists21_name_exists +1 more

… 23 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesdossier46. _ambiguity_counts → table_exists46table_exists47. _ambiguity_counts → function_candidates47function_candidates48–51. function_candidates → table_exists48table_exists +3 more52–53. matching_identity → qualified_name_of52qualified_name_of +1 more

… 4 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesdossier58. macro_definitions → connect58connect59. macro_definitions → macro_definitions_conn59macro_definitions_conn60. macro_definitions_conn → has_columns60has_columns▶ test enters61–62. macro_definitions_conn → _macro_def61_macro_def +1 more63. gates_covering → table_exists63table_exists▶ test enters64. gates_covering → has_columns64has_columns65. gates_covering → _gate_columns65_gate_columns

… 12 steps between

callercallercallercallerclew/query/payload.pyclew/query/payload.pyclew/query/payload.pyclew/query/payload.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesdossier78. _referenced_by → table_exists78table_exists79. _macro_def → symbol_provenance79symbol_provenance80. symbol_provenance → records_provenance80records_provenance▶ test enters81. records_provenance → has_columns81has_columns82. _gate_definitions → _gate_definition_gaps82_gate_definition_gaps83. _flatten_subject → _empty_callers_note83_empty_callers_note

… 51 steps between

callercallercallercallerclew/query/subject.pyclew/query/subject.pyclew/query/subject.pyclew/query/subject.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyopt (line 1012)optopt (line 777)optalt (line 780)altopt (line 1014)optdossier135. dossier → connect135connect136. dossier → identity_rowids136identity_rowids137. identity_rowids → function_candidates137function_candidates▶ test enters138–139. identity_rowids → qualified_name_of138qualified_name_of +1 more140–141. identity_rowids → qualified_name_of140qualified_name_of +1 more142. dossier → _selector_from_signature142_selector_from_signature143. _selector_from_signature → qualified_name_of143qualified_name_of144. dossier → _rank_enum_over_mirror144_rank_enum_over_mirror▶ test enters145. _rank_enum_over_mirror → connect145connect146. _rank_enum_over_mirror → _class_side_is_only_enum_mirrors146_class_side_is_only_enum_mirrors

… 2 steps between

callercallercallercallerclew/query/subject.pyclew/query/subject.pyclew/query/subject.pyclew/query/subject.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pyother filesother filesother filesother filesopt (line 1021)optdossier149. _derives_from_py_enum → all149all150. _class_side_is_only_enum_mirrors → all150all151. dossier → resolve_subject151resolve_subject▶ test enters152. resolve_subject → connect152connect153–154. dossier → _qualified_reread153_qualified_reread +1 more155. _split_qualified → bare_tail155bare_tail156. _split_qualified → connect156connect

… 4 steps between

callercallercallercallerclew/query/subject.pyclew/query/subject.pyclew/query/subject.pyclew/query/subject.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyopt (line 1078)optdossier161–162. _qualified_reread → _rank_enum_over_mirror161_rank_enum_over_mirror +1 more163. dossier → _chosen_kind163_chosen_kind▶ test enters164. dossier → connect164connect165. dossier → _chain_for165_chain_for166. _chain_for → chain_trace166chain_trace167. chain_trace → _normalize_direction167_normalize_direction

… 5 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pydossier173–174. _identity_walk → _make_node173_make_node +1 more175. termini_for → table_exists175table_exists▶ test enters176. _make_node → _reqs_for176_reqs_for177. _reqs_for → table_exists177table_exists

… 3 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyother filesother filesother filesother filesloop (line 362)looploop (line 368)looploop (line 429)loopdossier181. _identity_call_hops → qualified_name_of181qualified_name_of182. _identity_call_hops → _collapse_variants182_collapse_variants183. _collapse_variants → _variant_rank183_variant_rank▶ test enters184. _identity_walk → identity_rowids184identity_rowids185. _identity_walk → _cap_at_depth185_cap_at_depth

… 15 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyother filesother filesother filesother filesloop (line 191)loopdossier201. _neighbors → _key_hops201_key_hops202. _key_hops → _key_edge_rows202_key_edge_rows203. _key_edge_rows → table_exists203table_exists▶ test enters204. _key_edge_rows → _key_r1_projection204_key_r1_projection205. _key_r1_projection → has_columns205has_columns

… 21 later steps

3 more

tests/test_edge_file.py:130 · its file's page

What it checks (1)

  1. assert [c.file for c in built.function.callers] == [""], ( "an unresolvable file must be empty, never invented" ) observes dossier via built

Where the product reaches it

  • dossier is the entry of the flow (flow)

Call flow

test_an_endpoint_with_no_resolvable_file_reports_empty→dossier

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_an_endpoint_with_no_resolvable_file_reports_empty · 1 checksdossier… 3 calls …symbol_provenanceREQ-DDB-INDEX-004 · measureddossierconnectREQ-DDB-QUERY-001 · measureddossier_chain_forchain_traceREQ-DDB-QUERY-002 · measureddossieridentity_rowidsREQ-DDB-QUERY-003 · measureddossier_chain_forchain_trace_make_nodeREQ-DDB-QUERY-005 · inferreddossieridentity_rowidsREQ-DDB-QUERY-010 · measureddossier_qualified_reread_split_qualifiedbare_tailREQ-DDB-QUERY-013 · inferreddossier_rank_enum_over_mirror_class_side_is_only_enum_mirrorsallREQ-DDB-WIKI-054 · inferred
Also reaches 13 requirements

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