test_wiki_testcard.py

tests/test_wiki_testcard.py

A test page opens with WHY the test exists and WHAT it checks (owner review 3, 2.0.0).

test_a_call_inside_the_assertion_is_the_when_and_no_empty_given_is_drawn

None test_wiki_testcard.test_a_call_inside_the_assertion_is_the_when_and_no_empty_given_is_drawn()

Calls in assertions are the When.

tests/test_wiki_testcard.py:97

Show on the map →

Called by none

Calls _card

Checks

  • assert '<li class="none">—</li>' in given
  • assert "strip_xml(&quot;&lt;p&gt;a &lt; 2&lt;/p&gt;&quot;)" in when

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-026measuredtest_a_call_inside_the_assertion_is_the_when_and_no_empty_given_is_drawn → _card → test_card
Source · 18 lines
def test_a_call_inside_the_assertion_is_the_when_and_no_empty_given_is_drawn() -> None:
    """Owner review 3, found on test_strip_xml: `assert strip_xml(...) == ...` drew empty Given and
    When panels. The product call inside an assertion is the When; a Given with nothing in it is not
    drawn.

    @brief Calls in assertions are the When.
    """
    src = ["def test_s():", '    assert strip_xml("<p>a < 2</p>") == "a < 2"']
    d = SimpleNamespace(name="test_s", file="tests/test_s.py", start=1)
    html = _card(lines=src, d=d, product={"strip_xml"})
    ## SPEC CHANGED (UX review E-16, owner Q/A 2026-11-22): three fixed columns, so an empty Given
    ## reads "—" instead of disappearing.
    given = html.split('class="tc-given"', 1)[1].split('class="tc-when"', 1)[0]
    assert '<li class="none">—</li>' in given
    when = html.split('class="tc-when"', 1)[1].split('class="tc-then"', 1)[0]
    assert "strip_xml(&quot;&lt;p&gt;a &lt; 2&lt;/p&gt;&quot;)" in when

Activity · 7 steps
lines 104–104src = ["def test_s():", ' assert strip_xml("<p>a < 2</p>") == "a < 2"']lines 105–105d = SimpleNamespace(name="test_s", file="tests/test_s.py", start=1)lines 106–106html = _card(lines=src, d=d, product={"strip_xml"})lines 109–109given = html.split('class="tc-given"', 1)[1].split('class="tc-when"', 1)[0]lines 110–110assert '<li class="none">—</li>' in givenlines 111–111when = html.split('class="tc-when"', 1)[1].split('class="tc-then"', 1)[0]lines 112–112assert "strip_xml(&quot;&lt;p&gt;a &lt; 2&lt;/p&gt;&quot;)" in when

test_a_test_in_another_language_still_says_why

None test_wiki_testcard.test_a_test_in_another_language_still_says_why()

No Python syntax to read: the card keeps WHY (the index's brief) and draws no G/W/T.

tests/test_wiki_testcard.py:75

Show on the map →

Called by none

Calls _card

Checks

  • assert "Checks c." in html and 'class="tc-when"' not in html

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-026measuredtest_a_test_in_another_language_still_says_why → _card → test_card
Source · 7 lines
def test_a_test_in_another_language_still_says_why() -> None:
    """@brief No Python syntax to read: the card keeps WHY (the index's brief) and draws no G/W/T."""
    d = SimpleNamespace(name="test_c", file="tests/test_c.c", start=1)
    html = _card(lines=["void test_c(void) {", "  TEST_ASSERT(1);", "}"], d=d, brief="Checks c.")
    assert "Checks c." in html and 'class="tc-when"' not in html

Activity · 3 steps
lines 77–77d = SimpleNamespace(name="test_c", file="tests/test_c.c", start=1)lines 78–78html = _card(lines=["void test_c(void) {", " TEST_ASSERT(1);", "}"], d=d, brief="Checks c.")lines 79–79assert "Checks c." in html and 'class="tc-when"' not in html

test_given_when_then_come_from_the_syntax

None test_wiki_testcard.test_given_when_then_come_from_the_syntax()

Given = setup before the first product call; When = the product calls; Then = asserts.

tests/test_wiki_testcard.py:58

Show on the map →

Called by none

Calls _card

Checks

  • assert "make_repo(tmp_path)" in when and "build_wiki(repo)" in when
  • assert "panel = site[&quot;flow-x.html&quot;]" in when, ("a statement after the first product call is When" )
  • assert ("panel contains &quot;traces/run.json&quot;" in then and "panel contains &quot;confirmed&quot;" in then )
  • assert "len(site) equals 3" in then and "site.get(&quot;error&quot;) is false" in then
  • assert then.count('class="ck passed"') == 4

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-026measuredtest_given_when_then_come_from_the_syntax → _card → test_card
Source · 17 lines
def test_given_when_then_come_from_the_syntax() -> None:
    """@brief Given = setup before the first product call; When = the product calls; Then = asserts."""
    html = _card()
    given, rest = html.split('class="tc-when"', 1)
    when, then = rest.split('class="tc-then"', 1)
    assert "make_repo(tmp_path)" in when and "build_wiki(repo)" in when
    assert "panel = site[&quot;flow-x.html&quot;]" in when, (
        "a statement after the first product call is When"
    )
    assert (
        "panel contains &quot;traces/run.json&quot;" in then
        and "panel contains &quot;confirmed&quot;" in then
    )
    assert "len(site) equals 3" in then and "site.get(&quot;error&quot;) is false" in then
    assert then.count('class="ck passed"') == 4

Activity · 8 steps
lines 60–60html = _card()lines 61–61given, rest = html.split('class="tc-when"', 1)lines 62–62when, then = rest.split('class="tc-then"', 1)lines 63–63assert "make_repo(tmp_path)" in when and "build_wiki(repo)" in whenlines 64–66assert "panel = site[&quot;flow-x.html&quot;]" in when, ( "a statement after the first product call is When" )lines 67–70assert ( "panel contains &quot;traces/run.json&quot;" in then and "panel contains &quot;confirmed&quot;" in then )lines 71–71assert "len(site) equals 3" in then and "site.get(&quot;error&quot;) is false" in thenlines 72–72assert then.count('class="ck passed"') == 4

test_setup_noise_is_kept_out_of_the_card

None test_wiki_testcard.test_setup_noise_is_kept_out_of_the_card()

Imports dropped; long panels folded.

tests/test_wiki_testcard.py:115

Show on the map →

Called by none

Calls _card

Checks

  • assert "from x import y" not in given and "v0 = 0" in given
  • assert "<details" in given and "5 more" in given # Given shows two (UX review E-16)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-026measuredtest_setup_noise_is_kept_out_of_the_card → _card → test_card
Source · 19 lines
def test_setup_noise_is_kept_out_of_the_card() -> None:
    """Owner review 3, found on test_an_imported_trace_is_drawn_over_its_test_flow: Given listed the
    test's own imports, and When began at a helper defined in the test file. Imports are not setup;
    a long panel shows three statements and folds the rest.

    @brief Imports dropped; long panels folded.
    """
    src = (
        ["def test_n(tmp_path):", "    from x import y"]
        + [f"    v{i} = {i}" for i in range(7)]
        + ["    assert v1 == 1"]
    )
    d = SimpleNamespace(name="test_n", file="tests/test_n.py", start=1)
    html = _card(lines=src, d=d, product=set())
    given = html.split('class="tc-given"', 1)[1]
    assert "from x import y" not in given and "v0 = 0" in given
    assert "<details" in given and "5 more" in given  # Given shows two (UX review E-16)

Activity · 6 steps
lines 122–126src = ( ["def test_n(tmp_path):", " from x import y"] + [f" v{i} = {i}" for i in range(7)] + [" assert v1 == 1"] )lines 127–127d = SimpleNamespace(name="test_n", file="tests/test_n.py", start=1)lines 128–128html = _card(lines=src, d=d, product=set())lines 129–129given = html.split('class="tc-given"', 1)[1]lines 130–130assert "from x import y" not in given and "v0 = 0" in givenlines 131–131assert "<details" in given and "5 more" in given

test_the_checks_are_never_folded

None test_wiki_testcard.test_the_checks_are_never_folded()

Seven assertions: every check is shown, none behind "more".

tests/test_wiki_testcard.py:148

Show on the map →

Called by none

Calls _card

Checks

  • assert then.count('class="ck ') == 7 and "<details" not in then

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-026measuredtest_the_checks_are_never_folded → _card → test_card
Source · 6 lines
def test_the_checks_are_never_folded() -> None:
    """@brief Seven assertions: every check is shown, none behind "more"."""
    src = ["def test_m():", "    v = make()"] + [f"    assert v == {i}" for i in range(7)]
    d = SimpleNamespace(name="test_m", file="tests/test_m.py", start=1)
    then = _card(lines=src, d=d, product={"make"}).split('class="tc-then"', 1)[1]
    assert then.count('class="ck ') == 7 and "<details" not in then

1 more lines, not shown

Activity · 4 steps
lines 150–150src = ["def test_m():", " v = make()"] + [f" assert v == {i}" for i in range(7)]lines 151–151d = SimpleNamespace(name="test_m", file="tests/test_m.py", start=1)lines 152–152then = _card(lines=src, d=d, product={"make"}).split('class="tc-then"', 1)[1]lines 153–153assert then.count('class="ck ') == 7 and "<details" not in then

test_why_is_the_docstring_and_the_declared_requirements

None test_wiki_testcard.test_why_is_the_docstring_and_the_declared_requirements()

The docstring's first paragraph and only the declared (tag/catalog) requirements.

tests/test_wiki_testcard.py:50

Show on the map →

Called by none

Calls _card

Checks

  • assert "An imported trace is drawn over its flow." in why and "@brief" not in why
  • assert "REQ-W-001" in why and "REQ-X-002" not in why

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-026measuredtest_why_is_the_docstring_and_the_declared_requirements → _card → test_card
Source · 8 lines
def test_why_is_the_docstring_and_the_declared_requirements() -> None:
    """@brief The docstring's first paragraph and only the declared (tag/catalog) requirements."""
    html = _card()
    why = html.split('class="tc-why"', 1)[1].split("</div>", 1)[0]
    assert "An imported trace is drawn over its flow." in why and "@brief" not in why
    assert "REQ-W-001" in why and "REQ-X-002" not in why

Activity · 4 steps
lines 52–52html = _card()lines 53–53why = html.split('class="tc-why"', 1)[1].split("</div>", 1)[0]lines 54–54assert "An imported trace is drawn over its flow." in why and "@brief" not in whylines 55–55assert "REQ-W-001" in why and "REQ-X-002" not in why