test_wiki_web.py

tests/test_wiki_web.py

The repository web: one zoomable, walkable view of every function (round 4, R3).

test_a_flow_is_played_by_its_functions_in_call_order

None test_wiki_web.test_a_flow_is_played_by_its_functions_in_call_order(Path db)

Flow steps on the web.

tests/test_wiki_web.py:145

Show on the map →

Called by none

Calls _data

Checks

  • assert steps == ["handle", "save", "clean"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_a_flow_is_played_by_its_functions_in_call_order → _data → build_graph → connect
REQ-DDB-QUERY-003measuredtest_a_flow_is_played_by_its_functions_in_call_order → _data → build_graph → _links → table_exists
REQ-DDB-WIKI-019measuredtest_a_flow_is_played_by_its_functions_in_call_order → _data → build_graph
REQ-DDB-WIKI-022measuredtest_a_flow_is_played_by_its_functions_in_call_order → _data → web_data → _index_requirements
Source · 27 lines
def test_a_flow_is_played_by_its_functions_in_call_order(db: Path) -> None:
    """OWNER 2026-11-15: "an animated core flow traced across the map". A flow's steps are its
    functions in call order (caller, then callee, each once in a row); a step whose function is
    not drawn is skipped, never invented.

    @brief Flow steps on the web.
    """
    from types import SimpleNamespace

    from clew.wiki.web import _flow

    data = _data(db)
    slot = {(n["name"], n["file"]): i for i, n in enumerate(data["nodes"])}
    page = SimpleNamespace(
        name="flow-handle",
        title="Handle",
        calls=(("handle", "save"), ("save", "clean"), ("clean", "nowhere")),
        hops=(
            ("pkg/api/handlers.py", "pkg/core/store.py"),
            ("pkg/core/store.py", "pkg/util.py"),
            ("pkg/util.py", "elsewhere.py"),
        ),
    )
    steps = [data["nodes"][i]["name"] for i in _flow(page, slot)["steps"]]
    assert steps == ["handle", "save", "clean"]

Activity · 7 steps
lines 152–152from types import SimpleNamespacelines 154–154from clew.wiki.web import _flowlines 156–156data = _data(db)lines 157–157slot = {(n["name"], n["file"]): i for i, n in enumerate(data["nodes"])}lines 158–167page = SimpleNamespace( name="flow-handle", title="Handle", calls=(("handle", "save"), ("save", "clean"), ("clean", "nowhere")), hops=( ("pkg/api/handlers.py", "pkg/core/store.py"), ("pkg/core/store.py", "pkg/util.py"), ("pkg/util.py", "elsewhere.py"), ), )lines 168–168steps = [data["nodes"][i]["name"] for i in _flow(page, slot)["steps"]]lines 169–169assert steps == ["handle", "save", "clean"]

test_calls_between_files_are_counted

None test_wiki_web.test_calls_between_files_are_counted(Path db)

`file_links` = [from file slice, to file slice, calls], across files only.

tests/test_wiki_web.py:290

Show on the map →

Called by none

Calls _data

Checks

  • assert a != b and calls >= 1
  • assert total == cross and total > 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_calls_between_files_are_counted → _data → build_graph → connect
REQ-DDB-QUERY-003measuredtest_calls_between_files_are_counted → _data → build_graph → _links → table_exists
REQ-DDB-WIKI-019measuredtest_calls_between_files_are_counted → _data → build_graph
REQ-DDB-WIKI-022measuredtest_calls_between_files_are_counted → _data → web_data → _index_requirements
Source · 19 lines
def test_calls_between_files_are_counted(db: Path) -> None:
    """@brief `file_links` = [from file slice, to file slice, calls], across files only."""
    data = _data(db)
    files = data["files"]
    total = 0
    for a, b, calls in data["file_links"]:
        assert a != b and calls >= 1
        total += calls
    nodes = data["nodes"]
    index = {(f["block"], f["file"]): i for i, f in enumerate(files)}
    cross = sum(
        1
        for x, y in data["edges"]
        if index[(nodes[x]["block"], nodes[x]["file"])]
        != index[(nodes[y]["block"], nodes[y]["file"])]
    )
    assert total == cross and total > 0

Activity · 10 steps
lines 292–292data = _data(db)lines 293–293files = data["files"]lines 294–294total = 0lines 295–295◇ for a, b, calls in data["file_links"]lines 296–296assert a != b and calls >= 1lines 297–297total += callslines 298–298nodes = data["nodes"]lines 299–299index = {(f["block"], f["file"]): i for i, f in enumerate(files)}lines 300–305cross = sum( 1 for x, y in data["edges"] if index[(nodes[x]["block"], nodes[x]["file"])] != index[(nodes[y]["block"], nodes[y]["file"])] )lines 306–306assert total == cross and total > 0

test_each_file_is_one_slice_of_its_block

None test_wiki_web.test_each_file_is_one_slice_of_its_block(Path db)

Files as slices.

tests/test_wiki_web.py:269

Show on the map →

Called by none

Calls _data, all

Checks

  • assert [f["file"] for f in mine] == sorted(f["file"] for f in mine)
  • assert abs(mine[0]["a0"] - block["a0"]) < 1e-6 and abs(mine[-1]["a1"] - block["a1"]) < 1e-6
  • assert all(mine[i]["a1"] <= mine[i + 1]["a0"] + 1e-9 for i in range(len(mine) - 1))
  • assert s["a0"] - 1e-6 <= angle <= s["a1"] + 1e-6, (n["name"], n["file"])

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_each_file_is_one_slice_of_its_block → _data → build_graph → connect
REQ-DDB-QUERY-003measuredtest_each_file_is_one_slice_of_its_block → _data → build_graph → _links → table_exists
REQ-DDB-WIKI-019measuredtest_each_file_is_one_slice_of_its_block → _data → build_graph
REQ-DDB-WIKI-022measuredtest_each_file_is_one_slice_of_its_block → _data → web_data → _index_requirements
REQ-DDB-WIKI-054inferredtest_each_file_is_one_slice_of_its_block → all
Source · 21 lines
def test_each_file_is_one_slice_of_its_block(db: Path) -> None:
    """OWNER (2026-11-22): "the by file divides and interconnects on zoom in the map". A file is one
    contiguous slice of its block's wedge (ordered by file, sized by its functions, disjoint), the
    same slice on every ring, and each of its functions sits inside it.

    @brief Files as slices.
    """
    data = _data(db)
    files = data["files"]
    for bi, block in enumerate(data["blocks"]):
        mine = [f for f in files if f["block"] == bi]
        assert [f["file"] for f in mine] == sorted(f["file"] for f in mine)
        assert abs(mine[0]["a0"] - block["a0"]) < 1e-6 and abs(mine[-1]["a1"] - block["a1"]) < 1e-6
        assert all(mine[i]["a1"] <= mine[i + 1]["a0"] + 1e-9 for i in range(len(mine) - 1))
    slices = {(f["block"], f["file"]): f for f in files}
    for n in data["nodes"]:
        s = slices[(n["block"], n["file"])]
        angle = math.atan2(n["y"], n["x"]) % (2 * math.pi)
        assert s["a0"] - 1e-6 <= angle <= s["a1"] + 1e-6, (n["name"], n["file"])

Activity · 12 steps
lines 276–276data = _data(db)lines 277–277files = data["files"]lines 278–278◇ for bi, block in enumerate(data["blocks"])lines 279–279mine = [f for f in files if f["block"] == bi]lines 280–280assert [f["file"] for f in mine] == sorted(f["file"] for f in mine)lines 281–281assert abs(mine[0]["a0"] - block["a0"]) < 1e-6 and abs(mine[-1]["a1"] - block["a1"]) < 1e-6lines 282–282assert all(mine[i]["a1"] <= mine[i + 1]["a0"] + 1e-9 for i in range(len(mine) - 1))lines 283–283slices = {(f["block"], f["file"]): f for f in files}lines 284–284◇ for n in data["nodes"]lines 285–285s = slices[(n["block"], n["file"])]lines 286–286angle = math.atan2(n["y"], n["x"]) % (2 * math.pi)lines 287–287assert s["a0"] - 1e-6 <= angle <= s["a1"] + 1e-6, (n["name"], n["file"])

test_each_function_carries_the_requirements_it_implements

None test_wiki_web.test_each_function_carries_the_requirements_it_implements(Path db)

P5.4: per-function requirement ids, compact, and the `#req=` hash.

tests/test_wiki_web.py:172

Checks

  • assert data["req_ids"] == ["R-1", "R-2"]
  • assert by_name["save"] == [0, 1] and by_name["clean"] == [0] and by_name["handle"] is None
  • assert "req=" in WEB_JS, "the map reads the overlay's hash"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_each_function_carries_the_requirements_it_implements → build_graph → connect
REQ-DDB-QUERY-003measuredtest_each_function_carries_the_requirements_it_implements → build_graph → _links → table_exists
REQ-DDB-WIKI-019measuredtest_each_function_carries_the_requirements_it_implements → build_graph
REQ-DDB-WIKI-022measuredtest_each_function_carries_the_requirements_it_implements → web_data → _index_requirements
Source · 27 lines
def test_each_function_carries_the_requirements_it_implements(db: Path) -> None:
    """OWNER (round 5, P5.4): the requirement overlay. A requirement page's "Show on the map"
    opens `map.html#req=<id>`, which lights that requirement's implementing functions. The map
    data carries ONE table of ids and, per function, indices into it: a site of thousands of
    functions does not repeat each id string on every node it implements.

    @brief P5.4: per-function requirement ids, compact, and the `#req=` hash.
    """
    from types import SimpleNamespace

    rows = [
        SimpleNamespace(
            req_id="R-2", tier="PASS", implementer_sites=(("save", "pkg/core/store.py", 4),)
        ),
        SimpleNamespace(
            req_id="R-1",
            tier="UNTESTED",
            implementer_sites=(("save", "pkg/core/store.py", 4), ("clean", "pkg/util.py", 1)),
        ),
    ]
    data = web_data(db, build_graph(db, rows, None, _DECLARED, exclude_tests=True))
    assert data["req_ids"] == ["R-1", "R-2"]
    by_name = {n["name"]: n.get("r") for n in data["nodes"]}
    assert by_name["save"] == [0, 1] and by_name["clean"] == [0] and by_name["handle"] is None
    assert "req=" in WEB_JS, "the map reads the overlay's hash"

Activity · 7 steps
lines 180–180from types import SimpleNamespacelines 182–191rows = [ SimpleNamespace( req_id="R-2", tier="PASS", implementer_sites=(("save", "pkg/core/store.py", 4),) ), SimpleNamespace( req_id="R-1", tier="UNTESTED", implementer_sites=(("save", "pkg/core/store.py", 4), ("clean", "pkg/util.py", 1)), ), ]lines 192–192data = web_data(db, build_graph(db, rows, None, _DECLARED, exclude_tests=True))lines 193–193assert data["req_ids"] == ["R-1", "R-2"]lines 194–194by_name = {n["name"]: n.get("r") for n in data["nodes"]}lines 195–195assert by_name["save"] == [0, 1] and by_name["clean"] == [0] and by_name["handle"] is Nonelines 196–196assert "req=" in WEB_JS, "the map reads the overlay's hash"

test_every_block_is_a_wedge_and_wedges_do_not_overlap

None test_wiki_web.test_every_block_is_a_wedge_and_wedges_do_not_overlap(Path db)

Spokes: one angular range per block, in declared order, disjoint, inside one turn.

tests/test_wiki_web.py:81

Show on the map →

Called by none

Calls _data, all

Checks

  • assert [b["id"] for b in blocks] == ["API", "Core"]
  • assert all(0 <= a0 < a1 <= 2 * math.pi + 1e-9 for a0, a1 in spans)
  • assert all(spans[i][1] <= spans[i + 1][0] for i in range(len(spans) - 1))

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_every_block_is_a_wedge_and_wedges_do_not_overlap → _data → build_graph → connect
REQ-DDB-QUERY-003measuredtest_every_block_is_a_wedge_and_wedges_do_not_overlap → _data → build_graph → _links → table_exists
REQ-DDB-WIKI-019measuredtest_every_block_is_a_wedge_and_wedges_do_not_overlap → _data → build_graph
REQ-DDB-WIKI-022measuredtest_every_block_is_a_wedge_and_wedges_do_not_overlap → _data → web_data → _index_requirements
REQ-DDB-WIKI-054inferredtest_every_block_is_a_wedge_and_wedges_do_not_overlap → all
Source · 9 lines
def test_every_block_is_a_wedge_and_wedges_do_not_overlap(db: Path) -> None:
    """@brief Spokes: one angular range per block, in declared order, disjoint, inside one turn."""
    blocks = _data(db)["blocks"]
    assert [b["id"] for b in blocks] == ["API", "Core"]
    spans = [(b["a0"], b["a1"]) for b in blocks]
    assert all(0 <= a0 < a1 <= 2 * math.pi + 1e-9 for a0, a1 in spans)
    assert all(spans[i][1] <= spans[i + 1][0] for i in range(len(spans) - 1))

Activity · 5 steps
lines 83–83blocks = _data(db)["blocks"]lines 84–84assert [b["id"] for b in blocks] == ["API", "Core"]lines 85–85spans = [(b["a0"], b["a1"]) for b in blocks]lines 86–86assert all(0 <= a0 < a1 <= 2 * math.pi + 1e-9 for a0, a1 in spans)lines 87–87assert all(spans[i][1] <= spans[i + 1][0] for i in range(len(spans) - 1))

test_functions_sit_in_their_block_on_rings_by_call_depth

None test_wiki_web.test_functions_sit_in_their_block_on_rings_by_call_depth(Path db)

Rings by depth; every point inside its wedge.

tests/test_wiki_web.py:90

Show on the map →

Called by none

Calls _data

Checks

  • assert "test_save" not in nodes
  • assert (nodes["handle"]["ring"], nodes["save"]["ring"], nodes["clean"]["ring"]) == (0, 1, 2)
  • assert block["a0"] - 1e-6 <= angle <= block["a1"] + 1e-6, n["name"]
  • assert nodes["clean"]["block"] == [b["id"] for b in data["blocks"]].index("Core")
  • assert blocks["Core"]["inferred_files"] == ["pkg/util.py"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_functions_sit_in_their_block_on_rings_by_call_depth → _data → build_graph → connect
REQ-DDB-QUERY-003measuredtest_functions_sit_in_their_block_on_rings_by_call_depth → _data → build_graph → _links → table_exists
REQ-DDB-WIKI-019measuredtest_functions_sit_in_their_block_on_rings_by_call_depth → _data → build_graph
REQ-DDB-WIKI-022measuredtest_functions_sit_in_their_block_on_rings_by_call_depth → _data → web_data → _index_requirements
Source · 19 lines
def test_functions_sit_in_their_block_on_rings_by_call_depth(db: Path) -> None:
    """THE WEB'S THREADS: an entry point (no non-test caller) is ring 0 at the centre; each call
    takes its callee one ring out. Test code is not drawn — it is a lens, not a block.

    @brief Rings by depth; every point inside its wedge.
    """
    data = _data(db)
    nodes = {n["name"]: n for n in data["nodes"]}
    assert "test_save" not in nodes
    assert (nodes["handle"]["ring"], nodes["save"]["ring"], nodes["clean"]["ring"]) == (0, 1, 2)
    blocks = {b["id"]: b for b in data["blocks"]}
    for n in data["nodes"]:
        block = data["blocks"][n["block"]]
        angle = math.atan2(n["y"], n["x"]) % (2 * math.pi)
        assert block["a0"] - 1e-6 <= angle <= block["a1"] + 1e-6, n["name"]
    assert nodes["clean"]["block"] == [b["id"] for b in data["blocks"]].index("Core")
    assert blocks["Core"]["inferred_files"] == ["pkg/util.py"]

Activity · 11 steps
lines 96–96data = _data(db)lines 97–97nodes = {n["name"]: n for n in data["nodes"]}lines 98–98assert "test_save" not in nodeslines 99–99assert (nodes["handle"]["ring"], nodes["save"]["ring"], nodes["clean"]["ring"]) == (0, 1, 2)lines 100–100blocks = {b["id"]: b for b in data["blocks"]}lines 101–101◇ for n in data["nodes"]lines 102–102block = data["blocks"][n["block"]]lines 103–103angle = math.atan2(n["y"], n["x"]) % (2 * math.pi)lines 104–104assert block["a0"] - 1e-6 <= angle <= block["a1"] + 1e-6, n["name"]lines 105–105assert nodes["clean"]["block"] == [b["id"] for b in data["blocks"]].index("Core")lines 106–106assert blocks["Core"]["inferred_files"] == ["pkg/util.py"]

test_the_change_lens_exists_only_with_an_impact_report

None test_wiki_web.test_the_change_lens_exists_only_with_an_impact_report(Path db)

Lens options follow their sources.

tests/test_wiki_web.py:130

Checks

  • assert "Change</option>" not in web_html(web_data(db, plain))
  • assert "Change</option>" in web_html(data)
  • assert {n["name"]: n.get("changed") for n in data["nodes"]}["save"] is True

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_the_change_lens_exists_only_with_an_impact_report → build_graph → connect
REQ-DDB-QUERY-003measuredtest_the_change_lens_exists_only_with_an_impact_report → build_graph → _links → table_exists
REQ-DDB-WIKI-019measuredtest_the_change_lens_exists_only_with_an_impact_report → build_graph
REQ-DDB-WIKI-021measuredtest_the_change_lens_exists_only_with_an_impact_report → web_html
REQ-DDB-WIKI-022measuredtest_the_change_lens_exists_only_with_an_impact_report → web_data → _index_requirements
Source · 15 lines
def test_the_change_lens_exists_only_with_an_impact_report(db: Path) -> None:
    """NO IMPACT REPORT, NO CHANGE LENS (ported from the box map, which the web replaced): with a
    report the lens exists and a changed function carries `changed`.

    @brief Lens options follow their sources.
    """
    plain = build_graph(db, [], None, _DECLARED, exclude_tests=True)
    assert "Change</option>" not in web_html(web_data(db, plain))
    impact = [{"req_id": "R-1", "functions": [{"name": "save", "file": "pkg/core/store.py"}]}]
    measured = build_graph(db, [], impact, _DECLARED, exclude_tests=True)
    data = web_data(db, measured)
    assert "Change</option>" in web_html(data)
    assert {n["name"]: n.get("changed") for n in data["nodes"]}["save"] is True

Activity · 7 steps
lines 136–136plain = build_graph(db, [], None, _DECLARED, exclude_tests=True)lines 137–137assert "Change</option>" not in web_html(web_data(db, plain))lines 138–138impact = [{"req_id": "R-1", "functions": [{"name": "save", "file": "pkg/core/store.py"}]}]lines 139–139measured = build_graph(db, [], impact, _DECLARED, exclude_tests=True)lines 140–140data = web_data(db, measured)lines 141–141assert "Change</option>" in web_html(data)lines 142–142assert {n["name"]: n.get("changed") for n in data["nodes"]}["save"] is True

test_the_file_layer_is_its_own_budgeted_script

None test_wiki_web.test_the_file_layer_is_its_own_budgeted_script()

web-files.js.

tests/test_wiki_web.py:309

Show on the map →

Called by none

Calls web_html

Checks

  • assert "function webFiles(" in js and len(js.encode()) <= 8192 assert "window.webFiles" in WEB_JS page = web_html({"nodes": [], "blocks": [], "links": []}) assert page.index("web-files.js") < page.index("_static/web.js")

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-021measuredtest_the_file_layer_is_its_own_budgeted_script → web_html
Source · 15 lines
def test_the_file_layer_is_its_own_budgeted_script() -> None:
    """web.js is at its 16 KB budget, so the file layer is a second script with its own budget (the
    clew-views.js precedent), loaded BEFORE web.js; web.js calls it when zoomed in.

    @brief web-files.js.
    """
    import clew.wiki

    js = (Path(clew.wiki.__file__).parent / "themes/clew/static/web-files.js").read_text()
    assert "function webFiles(" in js and len(js.encode()) <= 8192
    assert "window.webFiles" in WEB_JS
    page = web_html({"nodes": [], "blocks": [], "links": []})
    assert page.index("web-files.js") < page.index("_static/web.js")

Activity · 6 steps
lines 315–315import clew.wikilines 317–317js = (Path(clew.wiki.__file__).parent / "themes/clew/static/web-files.js").read_text()lines 318–318assert "function webFiles(" in js and len(js.encode()) <= 8192lines 319–319assert "window.webFiles" in WEB_JSlines 320–320page = web_html({"nodes": [], "blocks": [], "links": []})lines 321–321assert page.index("web-files.js") < page.index("_static/web.js")

test_the_map_controls_are_grouped_and_sized_to_content

None test_wiki_web.test_the_map_controls_are_grouped_and_sized_to_content()

C-14: zoom as one group; labels never wrap a word per line; selects size to content.

tests/test_wiki_web.py:339

Show on the map →

Called by none

Calls web_html

Checks

  • assert '<span class="seg">' in html
  • assert (".web-bar label{white-space:nowrap}" in css and ".web-bar select{width:auto;max-width:18rem}" in css )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-021measuredtest_the_map_controls_are_grouped_and_sized_to_content → web_html
Source · 11 lines
def test_the_map_controls_are_grouped_and_sized_to_content() -> None:
    """@brief C-14: zoom as one group; labels never wrap a word per line; selects size to content."""
    html = web_html({"nodes": [], "blocks": [], "links": []})
    assert '<span class="seg">' in html
    import clew.wiki

    css = (Path(clew.wiki.__file__).parent / "themes/clew/static/clew.css").read_text()
    assert (
        ".web-bar label{white-space:nowrap}" in css
        and ".web-bar select{width:auto;max-width:18rem}" in css
    )

1 more lines, not shown

Activity · 5 steps
lines 341–341html = web_html({"nodes": [], "blocks": [], "links": []})lines 342–342assert '<span class="seg">' in htmllines 343–343import clew.wikilines 345–345css = (Path(clew.wiki.__file__).parent / "themes/clew/static/clew.css").read_text()lines 346–349assert ( ".web-bar label{white-space:nowrap}" in css and ".web-bar select{width:auto;max-width:18rem}" in css )

test_the_page_embeds_the_data_a_canvas_and_a_table_view

None test_wiki_web.test_the_page_embeds_the_data_a_canvas_and_a_table_view(Path db)

Canvas + inline JSON + the same blocks as a table; web.js local and budgeted.

tests/test_wiki_web.py:118

Show on the map →

Called by none

Calls _data, web_html

Checks

  • assert "<canvas" in html and 'class="web"' in html
  • assert payload and json.loads(payload.group(1))["blocks"]
  • assert "<table" in html and "Core" in html.split("<table", 1)[1]
  • assert "http://" not in WEB_JS and "https://" not in WEB_JS
  • assert len(WEB_JS.encode()) <= 16384
  • assert "prefers-reduced-motion" in WEB_JS

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_the_page_embeds_the_data_a_canvas_and_a_table_view → _data → build_graph → connect
REQ-DDB-QUERY-003measuredtest_the_page_embeds_the_data_a_canvas_and_a_table_view → _data → build_graph → _links → table_exists
REQ-DDB-WIKI-019measuredtest_the_page_embeds_the_data_a_canvas_and_a_table_view → _data → build_graph
REQ-DDB-WIKI-021measuredtest_the_page_embeds_the_data_a_canvas_and_a_table_view → web_html
REQ-DDB-WIKI-022measuredtest_the_page_embeds_the_data_a_canvas_and_a_table_view → _data → web_data → _index_requirements
Source · 12 lines
def test_the_page_embeds_the_data_a_canvas_and_a_table_view(db: Path) -> None:
    """@brief Canvas + inline JSON + the same blocks as a table; web.js local and budgeted."""
    html = web_html(_data(db))
    assert "<canvas" in html and 'class="web"' in html
    payload = re.search(r'<script type="application/json" id="web-data">(.*?)</script>', html, re.S)
    assert payload and json.loads(payload.group(1))["blocks"]
    assert "<table" in html and "Core" in html.split("<table", 1)[1]
    assert "http://" not in WEB_JS and "https://" not in WEB_JS
    assert len(WEB_JS.encode()) <= 16384
    assert "prefers-reduced-motion" in WEB_JS

Activity · 8 steps
lines 120–120html = web_html(_data(db))lines 121–121assert "<canvas" in html and 'class="web"' in htmllines 122–122payload = re.search(r'<script type="application/json" id="web-data">(.*?)</script>', html, re.S)lines 123–123assert payload and json.loads(payload.group(1))["blocks"]lines 124–124assert "<table" in html and "Core" in html.split("<table", 1)[1]lines 125–125assert "http://" not in WEB_JS and "https://" not in WEB_JSlines 126–126assert len(WEB_JS.encode()) <= 16384lines 127–127assert "prefers-reduced-motion" in WEB_JS

test_zoomed_out_blocks_and_a_legend_show_the_lens

None test_wiki_web.test_zoomed_out_blocks_and_a_legend_show_the_lens()

Wedge pies and the lens legend.

tests/test_wiki_web.py:230

Show on the map →

Called by none

Calls web_html

Checks

  • assert ("function cat(n)" in WEB_JS and "function pies()" in WEB_JS and "function legend()" in WEB_JS )
  • assert "data-web-legend" in web_html({"nodes": [], "blocks": [], "links": []})

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-WIKI-021measuredtest_zoomed_out_blocks_and_a_legend_show_the_lens → web_html
Source · 16 lines
def test_zoomed_out_blocks_and_a_legend_show_the_lens() -> None:
    """OWNER MAP NOTES (2026-11-22): change impact → map showed the changed dots but nothing zoomed
    out, and there was no colour legend. Owner Q/A: a folded block is drawn as the active lens's
    status pie (sub-arcs in proportion), and a legend names each colour with its count. One
    category function (`cat`) serves the dots, the pies and the legend, so they cannot disagree.

    @brief Wedge pies and the lens legend.
    """
    assert (
        "function cat(n)" in WEB_JS
        and "function pies()" in WEB_JS
        and "function legend()" in WEB_JS
    )
    assert "data-web-legend" in web_html({"nodes": [], "blocks": [], "links": []})

Activity · 2 steps
lines 238–242assert ( "function cat(n)" in WEB_JS and "function pies()" in WEB_JS and "function legend()" in WEB_JS )lines 243–243assert "data-web-legend" in web_html({"nodes": [], "blocks": [], "links": []})