test_short_qualified.py¶
tests/test_short_qualified.py
A neighbour row's `qualified` is the SHORTEST separator-aligned suffix that is still unique.
test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it
None test_short_qualified.test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it(Path nested)
Short published identities each select exactly their own function.
tests/test_short_qualified.py:90
Checks
assert quals == ["alpha.Handler.run", "beta.Handler.run"]assert identity_rowids(conn, edge.name, edge.qualified) == [assert identity_rowids(conn, "run", "app.alpha.Handler.run") == [2]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance |
| REQ-DDB-QUERY-001 | measured | test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it → dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it → dossier → _chain_for → chain_trace |
| REQ-DDB-QUERY-003 | measured | test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it → identity_rowids |
| REQ-DDB-QUERY-004 | measured | |
| REQ-DDB-QUERY-005 | inferred | test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it → dossier → _chain_for → chain_trace → _make_node |
| REQ-DDB-QUERY-006 | measured | |
| REQ-DDB-QUERY-009 | measured | |
| REQ-DDB-QUERY-010 | measured | test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it → identity_rowids |
| REQ-DDB-QUERY-012 | measured | |
| REQ-DDB-QUERY-013 | inferred | test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it → dossier → _qualified_reread → _split_qualified → bare_tail |
| REQ-DDB-SCHEMA-011 | measured | |
| REQ-DDB-WIKI-054 | inferred | test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all |
Source · 22 lines
def test_a_callee_row_publishes_the_short_form_and_the_selector_follows_it(nested: Path) -> None:
"""THE ROUND TRIP, through `identity_rowids` — what `dossier(subject, qualified=...)` uses.
@brief Short published identities each select exactly their own function.
@return None.
@version 1
"""
built = q.dossier(nested, "main")
quals = sorted(e.qualified for e in built.function.callees)
assert quals == ["alpha.Handler.run", "beta.Handler.run"]
conn = sqlite3.connect(str(nested))
try:
for edge in built.function.callees:
assert identity_rowids(conn, edge.name, edge.qualified) == [
2 if edge.qualified.startswith("alpha") else 3
]
## The FULL spelling still selects, so a consumer holding one keeps working.
assert identity_rowids(conn, "run", "app.alpha.Handler.run") == [2]
finally:
conn.close()
Activity · 8 steps
test_a_selector_in_the_other_languages_separator_still_selects
None test_short_qualified.test_a_selector_in_the_other_languages_separator_still_selects(Path nested)
`::` and `.` are interchangeable in a qualified selector.
tests/test_short_qualified.py:112
Checks
assert identity_rowids(conn, "run", "alpha::Handler::run") == [2]assert identity_rowids(conn, "run", "app::beta::Handler::run") == [3]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-QUERY-003 | measured | test_a_selector_in_the_other_languages_separator_still_selects → identity_rowids |
| REQ-DDB-QUERY-010 | measured | test_a_selector_in_the_other_languages_separator_still_selects → identity_rowids |
Source · 15 lines
def test_a_selector_in_the_other_languages_separator_still_selects(nested: Path) -> None:
"""1.3.10. A mattermost agent passed `qualified="app::database::...::execute"` — C++ spelling
for a TypeScript identity — and got `found: false` for a function the index holds. The two
separators name the same nesting, so a selector written with either is resolved with both.
@brief `::` and `.` are interchangeable in a qualified selector.
@return None.
@version 1
"""
conn = sqlite3.connect(str(nested))
try:
assert identity_rowids(conn, "run", "alpha::Handler::run") == [2]
assert identity_rowids(conn, "run", "app::beta::Handler::run") == [3]
finally:
conn.close()1 more lines, not shown
Activity · 4 steps
test_the_shortest_unique_suffix
None test_short_qualified.test_the_shortest_unique_suffix(str full, set[str] others, str short)
short_qualified picks the shortest boundary-aligned unique suffix.
tests/test_short_qualified.py:43
Checks
assert short_qualified(full, others) == short
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-QUERY-010 | measured | test_the_shortest_unique_suffix → short_qualified |
Source · 12 lines
def test_the_shortest_unique_suffix(full: str, others: set[str], short: str) -> None:
"""A QUALIFIED NAME KEEPS AT LEAST ITS OWNER: a bare name is what `name` already says, so the
shortest form still carries one qualifier when the full name had one.
@brief short_qualified picks the shortest boundary-aligned unique suffix.
@return None.
@version 1
"""
assert short_qualified(full, others) == short
@pytest.fixture()