test_wiki_ux_small.py¶
tests/test_wiki_ux_small.py
Consistency fixes from the independent UX review (group E, owner Q/A 2026-11-22).
test_a_short_call_flow_has_no_player
None test_wiki_ux_small.test_a_short_call_flow_has_no_player()
E-15: a player for one box is a control without purpose; it appears past five boxes.
tests/test_wiki_ux_small.py:74
Checks
assert "data-slice-control" not in one and "data-slice-control" in many
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-025 | inferred | test_a_short_call_flow_has_no_player → _callflow → symbol_href |
| REQ-DDB-WIKI-045 | measured | test_a_short_call_flow_has_no_player → _callflow |
Source · 9 lines
def test_a_short_call_flow_has_no_player() -> None:
"""@brief E-15: a player for one box is a control without purpose; it appears past five boxes."""
from clew.wiki.testpages import _callflow
one = _callflow("test_x", [("f", "a.py")], {}, set())
many = _callflow("test_x", [(f"f{i}", "a.py") for i in range(6)], {}, set())
assert "data-slice-control" not in one and "data-slice-control" in many
Activity · 4 steps
test_flow_titles_read_one_way_and_an_empty_flow_says_so
None test_wiki_ux_small.test_flow_titles_read_one_way_and_an_empty_flow_says_so()
One title pattern; empty flows muted.
tests/test_wiki_ux_small.py:83
Checks
assert ">clew</a>" in html and '<span class="entry">`main` (clew/cli.py)</span>' not in htmlassert '<span class="entry"><code>main</code> (clew/cli.py)</span>' in htmlassert 'class="untraced"' in html and "not traced" in html
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-012 | measured | test_flow_titles_read_one_way_and_an_empty_flow_says_so → _role_block → table |
| REQ-DDB-WIKI-022 | inferred | test_flow_titles_read_one_way_and_an_empty_flow_says_so → _role_block → _badges → page_of |
Source · 19 lines
def test_flow_titles_read_one_way_and_an_empty_flow_says_so() -> None:
"""E-11: mixed registers ("Build this wiki…" beside `clew — main (clew/cli.py)`), and a 0-step
flow listed as a peer. A discovered title shows its readable part, with the entry and file under
it in small monospace; a flow with no steps is muted and says "not traced".
@brief One title pattern; empty flows muted.
"""
from clew.wiki.flowpage import FlowPage, _role_block
pages = [
FlowPage("flow-main", "clew — `main` (clew/cli.py)", frozenset(), role="product", steps=12),
FlowPage("flow-s", "Find a name you do not have yet", frozenset(), role="product", steps=0),
]
html = _role_block("product", pages)
assert ">clew</a>" in html and '<span class="entry">`main` (clew/cli.py)</span>' not in html
assert '<span class="entry"><code>main</code> (clew/cli.py)</span>' in html
assert 'class="untraced"' in html and "not traced" in html
Activity · 6 steps
test_the_flow_page_puts_detail_behind_counts
None test_wiki_ux_small.test_the_flow_page_puts_detail_behind_counts()
A-1: the diagram box scrolls; table and functions fold.
tests/test_wiki_ux_small.py:232
Checks
assert "data-goto" in _SCRIPT and ".flow-wrap{max-height:80vh;overflow:auto}" in _STYLEassert '<details class="fold"><summary>2 functions</summary>' in "".join(_functions({("a", "x.py"), ("b", "y.py")}) )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-025 | measured |
Source · 10 lines
def test_the_flow_page_puts_detail_behind_counts() -> None:
"""@brief A-1: the diagram box scrolls; table and functions fold."""
from clew.wiki.flowpage import _SCRIPT, _STYLE, _functions
assert "data-goto" in _SCRIPT and ".flow-wrap{max-height:80vh;overflow:auto}" in _STYLE
assert '<details class="fold"><summary>2 functions</summary>' in "".join(
_functions({("a", "x.py"), ("b", "y.py")})
)
Activity · 3 steps
test_the_sbom_drops_empty_columns_normalises_licences_and_states_coverage
None test_wiki_ux_small.test_the_sbom_drops_empty_columns_normalises_licences_and_states_coverage()
SBOM table and coverage.
tests/test_wiki_ux_small.py:139
Checks
assert (_cdx_licence({ "licenses": [ {"license": {"id": "Apache-2.0"}}, {"license": {"name": "License :: OSI Approved :: Apache Software License"}}, ] }assert "<th>digest</th>" not in html and "<th>source</th>" in htmlassert '<p class="stat"><b>600 of 44,944</b> indexed files declare a licence (1%).</p>' in html
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-051 | measured | test_the_sbom_drops_empty_columns_normalises_licences_and_states_coverage → sbom_html |
| REQ-DDB-WIKI-054 | inferred | test_the_sbom_drops_empty_columns_normalises_licences_and_states_coverage → sbom_html → _row → _accepted → all |
Source · 28 lines
def test_the_sbom_drops_empty_columns_normalises_licences_and_states_coverage() -> None:
"""E-25 / E-22: an empty Digest column in every row; "Apache-2.0 AND License :: OSI Approved ::
…" as a licence; "44344 indexed files carry no SPDX identifier" buried as a footnote.
@brief SBOM table and coverage.
"""
from clew.wiki.sbom import Component, _cdx_licence, sbom_html
assert (
_cdx_licence(
{
"licenses": [
{"license": {"id": "Apache-2.0"}},
{"license": {"name": "License :: OSI Approved :: Apache Software License"}},
]
}
)
== "Apache-2.0"
)
comps = [
Component("a", "1", "MIT", "library", "pkg:pypi/a", ""),
Component("b", "2", "MIT", "library", "pkg:pypi/b", ""),
]
html = sbom_html([("bom.cdx.json", ("clew", "MIT"), comps)], (), {"MIT": 600}, 44344)
assert "<th>digest</th>" not in html and "<th>source</th>" in html
assert '<p class="stat"><b>600 of 44,944</b> indexed files declare a licence (1%).</p>' in html
Activity · 6 steps
test_the_test_card_keeps_three_columns_and_code_in_mono
None test_wiki_ux_small.test_the_test_card_keeps_three_columns_and_code_in_mono()
Card layout.
tests/test_wiki_ux_small.py:49
Checks
assert 'class="tc-given"' in html and '<li class="none">—</li>' in htmlassert "tc-strip no-given" not in htmlassert "<details" in given and "2 more" in givenassert (".tc-then li.ck{" in (_STATIC / "clew.css").read_text() and "font-family:var(--mono)" in (_STATIC / "clew.css").read_text().split(".tc-then li.ck{", 1)[1].split("}", 1)[0] )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-026 | measured | test_the_test_card_keeps_three_columns_and_code_in_mono → test_card |
Source · 25 lines
def test_the_test_card_keeps_three_columns_and_code_in_mono() -> None:
"""E-16 (owner-approved review): a fixed Given / When / Then (Given "—" when empty, not a reflow);
Given folds past two statements; checks read in monospace like the code they describe.
SPEC CHANGED: test_a_call_inside_the_assertion… required the empty Given to disappear.
@brief Card layout.
"""
from clew.wiki.testcard import test_card
d = SimpleNamespace(name="test_s", file="tests/test_s.py", start=1)
html = test_card(["def test_s():", " assert f(1) == 2"], d, {"f"}, None)
assert 'class="tc-given"' in html and '<li class="none">—</li>' in html
assert "tc-strip no-given" not in html
src = ["def test_g():"] + [f" v{i} = {i}" for i in range(4)] + [" assert f(v0) == 1"]
given = test_card(src, SimpleNamespace(name="test_g", file="t.py", start=1), {"f"}, None).split(
'class="tc-given"', 1
)[1]
assert "<details" in given and "2 more" in given
assert (
".tc-then li.ck{" in (_STATIC / "clew.css").read_text()
and "font-family:var(--mono)"
in (_STATIC / "clew.css").read_text().split(".tc-then li.ck{", 1)[1].split("}", 1)[0]
)