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

Show on the map →

Called by none

Calls _row, evidence_svg

Checks

  • 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)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-022measuredtest_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
lines 40–40svg = evidence_svg(_row(553))lines 41–41assert 'class="test"' not in svglines 42–42assert ">552 passed</text>" in svg and ">1 failed</text>" in svglines 43–43assert 'data-edge="load→passed"' in svg and "tests table below" in svglines 44–44assert len(svg) < 4000, len(svg)

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

Show on the map →

Called by none

Calls _row, evidence_svg

Checks

  • assert svg.count('class="test"') == SUMMARY_TESTS and "summary" not in svg

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-022measuredtest_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
lines 34–34svg = evidence_svg(_row(SUMMARY_TESTS))lines 35–35assert svg.count('class="test"') == SUMMARY_TESTS and "summary" not in svg

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

requirementlinkedpath to the implementer
REQ-DDB-WIKI-022measuredtest_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

Activity · 9 steps
lines 53–53import relines 54–54from types import SimpleNamespacelines 56–56from clew.wiki.reqdiagram import _summary_svg, _widthlines 58–58tests = [(f"t{i}", "passed") for i in range(376)]lines 59–59row = SimpleNamespace(extent=(), implementers_uncovered=())lines 60–60svg = _summary_svg(row, ["a"], tests)lines 61–61width = float(re.search(r'width="(\d+)"', svg).group(1))lines 62–62note = "376 tests, a summary by result: every test is in the tests table below"lines 63–63assert width >= _width([note]) and width >= _width(["results (376 tests)"]) + _width(["a"])