test_wiki_scenario.py¶
tests/test_wiki_scenario.py
A flow states its intent, its scenario and a worked example, declared (W-1, W-5, 2.0.0).
test_a_flow_declares_intent_scenario_and_example
None test_wiki_scenario.test_a_flow_declares_intent_scenario_and_example(Path tmp_path)
The three keys are read as written; a scenario may be a block or a list.
tests/test_wiki_scenario.py:26
Checks
assert problems == [], problemsassert spec.intent == "Everything the index knows about one name."assert spec.scenario[0] == "Given an index of this repository" and len(spec.scenario) == 3assert spec.example == ('dossier(subject="derive_flow")', "file: clew/wiki/flow.py")
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-012 | measured | test_a_flow_declares_intent_scenario_and_example → _load → load_wiki_config → _requirements_section → read_requirements_section |
| REQ-DDB-WIKI-054 | inferred | test_a_flow_declares_intent_scenario_and_example → _load → load_wiki_config → _comments → all |
Source · 21 lines
def test_a_flow_declares_intent_scenario_and_example(tmp_path: Path) -> None:
"""@brief The three keys are read as written; a scenario may be a block or a list."""
config, problems = _load(
tmp_path,
" - entry: dossier\n"
" intent: Everything the index knows about one name.\n"
" scenario: |\n"
" Given an index of this repository\n"
" When an agent asks dossier about derive_flow\n"
" Then the reply carries its body, callers and callees\n"
" example:\n"
' input: dossier(subject="derive_flow")\n'
' output: "file: clew/wiki/flow.py"\n',
)
assert problems == [], problems
(spec,) = config.flows
assert spec.intent == "Everything the index knows about one name."
assert spec.scenario[0] == "Given an index of this repository" and len(spec.scenario) == 3
assert spec.example == ('dossier(subject="derive_flow")', "file: clew/wiki/flow.py")
Activity · 6 steps
test_a_scenario_line_may_name_the_call_it_starts_at
None test_wiki_scenario.test_a_scenario_line_may_name_the_call_it_starts_at(Path tmp_path)
Anchored scenario lines.
tests/test_wiki_scenario.py:85
Checks
assert problems == [], problemsassert spec.scenario[1] == "When names are asked about"assert spec.scenario_at == ("", "_accepted_batch", "_batched_dossiers")
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-012 | measured | test_a_scenario_line_may_name_the_call_it_starts_at → _load → load_wiki_config → _requirements_section → read_requirements_section |
| REQ-DDB-WIKI-054 | inferred | test_a_scenario_line_may_name_the_call_it_starts_at → _load → load_wiki_config → _comments → all |
Source · 21 lines
def test_a_scenario_line_may_name_the_call_it_starts_at(tmp_path: Path) -> None:
"""X-1 (owner review 2, 2026-11-22): "show WHAT is being built up by the sequence diagram … blocks
of it can be aligned to gherkin syntax". A scenario line is text, or `{step, at}` naming the call
where its part of the diagram begins.
@brief Anchored scenario lines.
"""
config, problems = _load(
tmp_path,
" - entry: dossier\n"
" scenario:\n"
" - Given an index\n"
" - {step: When names are asked about, at: _accepted_batch}\n"
" - {step: Then one reply answers them, at: _batched_dossiers}\n",
)
assert problems == [], problems
(spec,) = config.flows
assert spec.scenario[1] == "When names are asked about"
assert spec.scenario_at == ("", "_accepted_batch", "_batched_dossiers")
Activity · 5 steps
test_a_scenario_line_without_a_gherkin_keyword_is_refused_by_name
None test_wiki_scenario.test_a_scenario_line_without_a_gherkin_keyword_is_refused_by_name(Path tmp_path)
Each line starts Given / When / Then / And / But; otherwise a named problem.
tests/test_wiki_scenario.py:47
Checks
assert any("wiki.flows[0].scenario" in p and "Returns a reply" in p for p in problems), problems
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-012 | measured | test_a_scenario_line_without_a_gherkin_keyword_is_refused_by_name → _load → load_wiki_config → _requirements_section → read_requirements_section |
| REQ-DDB-WIKI-054 | inferred | test_a_scenario_line_without_a_gherkin_keyword_is_refused_by_name → _load → load_wiki_config → _comments → all |
Source · 8 lines
def test_a_scenario_line_without_a_gherkin_keyword_is_refused_by_name(tmp_path: Path) -> None:
"""@brief Each line starts Given / When / Then / And / But; otherwise a named problem."""
_config, problems = _load(
tmp_path, ' - entry: dossier\n scenario: ["Given x", "Returns a reply"]\n'
)
assert any("wiki.flows[0].scenario" in p and "Returns a reply" in p for p in problems), problems
Activity · 2 steps
test_the_flows_page_says_what_each_flow_is_for
None test_wiki_scenario.test_the_flows_page_says_what_each_flow_is_for()
A flow's declared intent sits under its title in the Flows table.
tests/test_wiki_scenario.py:74
Checks
assert "Look up one name" in html and '<span class="intent">Everything about it.</span>' in html
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-012 | measured | test_the_flows_page_says_what_each_flow_is_for → _role_block → table |
| REQ-DDB-WIKI-022 | inferred | test_the_flows_page_says_what_each_flow_is_for → _role_block → _badges → page_of |
Source · 11 lines
def test_the_flows_page_says_what_each_flow_is_for() -> None:
"""@brief A flow's declared intent sits under its title in the Flows table."""
from clew.wiki.flowpage import FlowPage, _role_block
page = FlowPage(
"flow-d", "Look up one name", frozenset(), role="product", intent="Everything about it."
)
html = _role_block("product", [page])
assert "Look up one name" in html and '<span class="intent">Everything about it.</span>' in html