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

Show on the map →

Called by none

Calls _load

Checks

  • assert problems == [], problems
  • 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")

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_a_flow_declares_intent_scenario_and_example → _load → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-WIKI-054inferredtest_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
lines 28–39config, 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', )lines 40–40assert problems == [], problemslines 41–41(spec,) = config.flowslines 42–42assert spec.intent == "Everything the index knows about one name."lines 43–43assert spec.scenario[0] == "Given an index of this repository" and len(spec.scenario) == 3lines 44–44assert spec.example == ('dossier(subject="derive_flow")', "file: clew/wiki/flow.py")

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

Show on the map →

Called by none

Calls _load

Checks

  • assert problems == [], problems
  • assert spec.scenario[1] == "When names are asked about"
  • assert spec.scenario_at == ("", "_accepted_batch", "_batched_dossiers")

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_a_scenario_line_may_name_the_call_it_starts_at → _load → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-WIKI-054inferredtest_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
lines 92–99config, 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", )lines 100–100assert problems == [], problemslines 101–101(spec,) = config.flowslines 102–102assert spec.scenario[1] == "When names are asked about"lines 103–103assert spec.scenario_at == ("", "_accepted_batch", "_batched_dossiers")

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

Show on the map →

Called by none

Calls _load

Checks

  • assert any("wiki.flows[0].scenario" in p and "Returns a reply" in p for p in problems), problems

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_a_scenario_line_without_a_gherkin_keyword_is_refused_by_name → _load → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-WIKI-054inferredtest_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
lines 49–51_config, problems = _load( tmp_path, ' - entry: dossier\n scenario: ["Given x", "Returns a reply"]\n' )lines 52–52assert any("wiki.flows[0].scenario" in p and "Returns a reply" in p for p in problems), problems

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

Show on the map →

Called by none

Calls _role_block

Checks

  • assert "Look up one name" in html and '<span class="intent">Everything about it.</span>' in html

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-012measuredtest_the_flows_page_says_what_each_flow_is_for → _role_block → table
REQ-DDB-WIKI-022inferredtest_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

Activity · 4 steps
lines 76–76from clew.wiki.flowpage import FlowPage, _role_blocklines 78–80page = FlowPage( "flow-d", "Look up one name", frozenset(), role="product", intent="Everything about it." )lines 81–81html = _role_block("product", [page])lines 82–82assert "Look up one name" in html and '<span class="intent">Everything about it.</span>' in html