test_serves_alias.py¶
tests/test_serves_alias.py
`serves:` is read as `satisfies:` everywhere (#72 item 13, 2.1).
test_serves_and_satisfies_are_one_link_list
None test_serves_alias.test_serves_and_satisfies_are_one_link_list()
Both keys read, in order, without duplicates; every spelling a catalogue uses.
Checks
assert link_ids({"serves": ["REQ-A-001"]}) == ["REQ-A-001"]assert link_ids({"satisfies": "REQ-A-001, REQ-A-002", "serves": ["REQ-A-002", "REQ-B-001"]} ) == [assert link_ids({"name": "x"}) == []
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-SCHEMA-015 | measured | test_serves_and_satisfies_are_one_link_list → link_ids |
Source · 13 lines
def test_serves_and_satisfies_are_one_link_list() -> None:
"""@brief Both keys read, in order, without duplicates; every spelling a catalogue uses."""
assert link_ids({"serves": ["REQ-A-001"]}) == ["REQ-A-001"]
assert link_ids(
{"satisfies": "REQ-A-001, REQ-A-002", "serves": ["REQ-A-002", "REQ-B-001"]}
) == [
"REQ-A-001",
"REQ-A-002",
"REQ-B-001",
]
assert link_ids({"name": "x"}) == []
Activity · 3 steps
test_the_gate_checks_a_serves_link
None test_serves_alias.test_the_gate_checks_a_serves_link()
A `serves` id no catalogue holds is a broken edge, as for `satisfies`.
Checks
assert len(found) == 1 and "REQ-P-999" in found[0].message
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-SCHEMA-015 | measured | test_the_gate_checks_a_serves_link → check_satisfies |
Source · 9 lines
def test_the_gate_checks_a_serves_link() -> None:
"""@brief A `serves` id no catalogue holds is a broken edge, as for `satisfies`."""
from clew.guard.checks import check_satisfies
rows = {"REQ-L-001": {"serves": "REQ-P-999"}, "REQ-L-002": {"serves": "REQ-P-001"}}
found = check_satisfies(rows, {"REQ-P-001", "REQ-L-001", "REQ-L-002"}, "requirements.yaml")
assert len(found) == 1 and "REQ-P-999" in found[0].message
Activity · 4 steps
test_the_wiki_tree_follows_a_serves_link
None test_serves_alias.test_the_wiki_tree_follows_a_serves_link(tmp_path)
The composite tree hangs a `serves` requirement under its parent.
Checks
assert "lib:REQ-LIB-001" in tree.nodes["product:REQ-PRD-001"].satisfied_by
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_the_wiki_tree_follows_a_serves_link → compose → _root_source → declared_catalog → load_guard_config |
| REQ-DDB-CONFIG-003 | measured | test_the_wiki_tree_follows_a_serves_link → compose → _root_source → declared_catalog → _is_flat_req_list |
| REQ-DDB-GUARD-012 | inferred | test_the_wiki_tree_follows_a_serves_link → compose → _root_source → declared_catalog → load_guard_config → read_guard_config → read_requirements_section |
| REQ-DDB-GUARD-024 | inferred | test_the_wiki_tree_follows_a_serves_link → compose → _root_source → declared_catalog → load_guard_config → read_guard_config → load_config → apply_opt_in_languages |
| REQ-DDB-GUARD-027 | measured | test_the_wiki_tree_follows_a_serves_link → compose → _walk → _nested_specs → git_text |
| REQ-DDB-SCHEMA-006 | measured | test_the_wiki_tree_follows_a_serves_link → compose → _root_source → declared_catalog → resolve_catalog_path |
| REQ-DDB-SCHEMA-015 | measured | test_the_wiki_tree_follows_a_serves_link → compose → _nodes → link_ids |
| REQ-DDB-WIKI-015 | measured | test_the_wiki_tree_follows_a_serves_link → compose → _root_source → declared_catalog |
| REQ-DDB-WIKI-040 | measured | test_the_wiki_tree_follows_a_serves_link → compose |
| REQ-DDB-WIKI-054 | inferred | test_the_wiki_tree_follows_a_serves_link → compose → _root_source → declared_catalog → _is_flat_req_list → all |
Source · 16 lines
def test_the_wiki_tree_follows_a_serves_link(tmp_path) -> None: # noqa: ANN001
"""@brief The composite tree hangs a `serves` requirement under its parent."""
import importlib
composite_tests = importlib.import_module("tests.test_wiki_composite")
from clew.wiki.composite import compose
product, pins = composite_tests._fixture(tmp_path)
pins["lib"] = composite_tests._repo(
tmp_path / "lib",
"requirements:\n REQ-LIB-001:\n name: Bounded retry\n serves: [product:REQ-PRD-001]\n",
)
tree = compose(
product, "product", composite_tests._specs(product, pins), probe=composite_tests._no_index
)
assert "lib:REQ-LIB-001" in tree.nodes["product:REQ-PRD-001"].satisfied_by1 more lines, not shown