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
Checks
assert '<li class="none">—</li>' in givenassert "strip_xml("<p>a < 2</p>")" in when
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-026 | measured | test_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("<p>a < 2</p>")" in when
Activity · 7 steps
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
Checks
assert "Checks c." in html and 'class="tc-when"' not in html
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-026 | measured | test_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
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
Checks
assert "make_repo(tmp_path)" in when and "build_wiki(repo)" in whenassert "panel = site["flow-x.html"]" in when, ("a statement after the first product call is When" )assert ("panel contains "traces/run.json"" in then and "panel contains "confirmed"" in then )assert "len(site) equals 3" in then and "site.get("error") is false" in thenassert then.count('class="ck passed"') == 4
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-026 | measured | test_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["flow-x.html"]" in when, (
"a statement after the first product call is When"
)
assert (
"panel contains "traces/run.json"" in then
and "panel contains "confirmed"" in then
)
assert "len(site) equals 3" in then and "site.get("error") is false" in then
assert then.count('class="ck passed"') == 4
Activity · 8 steps
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
Checks
assert "from x import y" not in given and "v0 = 0" in givenassert "<details" in given and "5 more" in given # Given shows two (UX review E-16)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-026 | measured | test_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
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
Checks
assert then.count('class="ck ') == 7 and "<details" not in then
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-026 | measured | test_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 then1 more lines, not shown
Activity · 4 steps
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
Checks
assert "An imported trace is drawn over its flow." in why and "@brief" not in whyassert "REQ-W-001" in why and "REQ-X-002" not in why
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-026 | measured | test_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