test_wiki_reqdiagram.py¶
tests/test_wiki_reqdiagram.py
The evidence diagram stays readable, and light, at any size (2.0.0, P5.4 follow-up).
test_a_large_requirement_is_summarised_by_result
None test_wiki_reqdiagram.test_a_large_requirement_is_summarised_by_result()
Above it: buckets with counts, a pointer to the table, and a bounded size.
tests/test_wiki_reqdiagram.py:38
Checks
assert 'class="test"' not in svgassert ">552 passed</text>" in svg and ">1 failed</text>" in svgassert 'data-edge="load→passed"' in svg and "tests table below" in svgassert len(svg) < 4000, len(svg)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-022 | measured | test_a_large_requirement_is_summarised_by_result → evidence_svg |
Source · 9 lines
def test_a_large_requirement_is_summarised_by_result() -> None:
"""@brief Above it: buckets with counts, a pointer to the table, and a bounded size."""
svg = evidence_svg(_row(553))
assert 'class="test"' not in svg
assert ">552 passed</text>" in svg and ">1 failed</text>" in svg
assert 'data-edge="load→passed"' in svg and "tests table below" in svg
assert len(svg) < 4000, len(svg)
Activity · 5 steps
test_a_small_requirement_draws_every_test
None test_wiki_reqdiagram.test_a_small_requirement_draws_every_test()
Up to the threshold: one row per test, one edge per measured link.
tests/test_wiki_reqdiagram.py:32
Checks
assert svg.count('class="test"') == SUMMARY_TESTS and "summary" not in svg
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-022 | measured | test_a_small_requirement_draws_every_test → evidence_svg |
Source · 6 lines
def test_a_small_requirement_draws_every_test() -> None:
"""@brief Up to the threshold: one row per test, one edge per measured link."""
svg = evidence_svg(_row(SUMMARY_TESTS))
assert svg.count('class="test"') == SUMMARY_TESTS and "summary" not in svg
Activity · 2 steps
test_the_summary_is_wide_enough_for_its_own_header_and_note
None test_wiki_reqdiagram.test_the_summary_is_wide_enough_for_its_own_header_and_note()
The SVG fits its header and its note.
tests/test_wiki_reqdiagram.py:47
Checks
assert width >= _width([note]) and width >= _width(["results (376 tests)"]) + _width(["a"])
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-022 | measured | test_the_summary_is_wide_enough_for_its_own_header_and_note → _summary_svg |
Source · 17 lines
def test_the_summary_is_wide_enough_for_its_own_header_and_note() -> None:
"""W-9 (owner review 2026-11-22, req-REQ-DDB-CONFIG-006): the summary form clipped "results (376
tests" and "every test is in the tests tab…" — its width counted the column labels only.
@brief The SVG fits its header and its note.
"""
import re
from types import SimpleNamespace
from clew.wiki.reqdiagram import _summary_svg, _width
tests = [(f"t{i}", "passed") for i in range(376)]
row = SimpleNamespace(extent=(), implementers_uncovered=())
svg = _summary_svg(row, ["a"], tests)
width = float(re.search(r'width="(\d+)"', svg).group(1))
note = "376 tests, a summary by result: every test is in the tests table below"
assert width >= _width([note]) and width >= _width(["results (376 tests)"]) + _width(["a"])1 more lines, not shown