test_wiki_entities.py¶
tests/test_wiki_entities.py
Entity quick views: a modal per function on a flow, with the view strip (round 5, P5.6).
test_a_brief_is_plain_text_not_doxygen_xml
None test_wiki_entities.test_a_brief_is_plain_text_not_doxygen_xml(tmp_path)
Briefs without markup.
tests/test_wiki_entities.py:75
Checks
assert _briefs(conn) == {("f", "pkg/a.py"): "Hold a lock."}
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-QUERY-003 | measured | test_a_brief_is_plain_text_not_doxygen_xml → _briefs → strip_xml |
| REQ-DDB-WIKI-048 | catalog |
Source · 20 lines
def test_a_brief_is_plain_text_not_doxygen_xml(tmp_path) -> None:
"""FOUND BY LOOKING: the quick view printed `<para>…</para>`. Briefs are read through
`strip_xml`, as the step modal's are.
@brief Briefs without markup.
"""
import sqlite3
from clew.wiki.entities import _briefs
db = tmp_path / "b.db"
conn = sqlite3.connect(db)
conn.executescript(
"CREATE TABLE path (rowid INTEGER PRIMARY KEY, name TEXT);"
"CREATE TABLE memberdef (rowid INTEGER PRIMARY KEY, name TEXT, kind TEXT, file_id INT,"
" bodyfile_id INT, briefdescription TEXT);"
"INSERT INTO path VALUES (1, 'pkg/a.py');"
"INSERT INTO memberdef VALUES (1, 'f', 'function', 1, 1, '<para>Hold a lock. </para>');"
)
assert _briefs(conn) == {("f", "pkg/a.py"): "Hold a lock."}1 more lines, not shown
Activity · 6 steps
test_a_long_list_is_capped_with_a_pointer_to_the_page
None test_wiki_entities.test_a_long_list_is_capped_with_a_pointer_to_the_page()
Eight tests: five shown, "3 more on its page" linking the function's page.
tests/test_wiki_entities.py:55
Checks
assert tests.count('href="test-t-') == 5assert "3 more on its page" in tests and 'href="sym-pkg-store-py.html#s-save"' in tests
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-022 | measured | test_a_long_list_is_capped_with_a_pointer_to_the_page → quick_view → _reqs → page_of |
| REQ-DDB-WIKI-048 | measured | test_a_long_list_is_capped_with_a_pointer_to_the_page → quick_view |
Source · 8 lines
def test_a_long_list_is_capped_with_a_pointer_to_the_page() -> None:
"""@brief Eight tests: five shown, "3 more on its page" linking the function's page."""
html = quick_view(_facts())
tests = html.split('data-view-panel="tests"', 1)[1].split("</section>", 1)[0]
assert tests.count('href="test-t-') == 5
assert "3 more on its page" in tests and 'href="sym-pkg-store-py.html#s-save"' in tests
Activity · 4 steps
test_an_empty_view_says_so
None test_wiki_entities.test_an_empty_view_says_so()
Empty views.
tests/test_wiki_entities.py:63
Checks
assert "No requirement names this function" in reqsassert "No recorded run" in replay
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-022 | inferred | test_an_empty_view_says_so → quick_view → _reqs → page_of |
| REQ-DDB-WIKI-048 | measured | test_an_empty_view_says_so → quick_view |
Source · 12 lines
def test_an_empty_view_says_so() -> None:
"""ABSENCE IS STATED: no requirement and no recorded run are sentences, not blank tabs.
@brief Empty views.
"""
html = quick_view(_facts(reqs=(), replays=()))
reqs = html.split('data-view-panel="reqs"', 1)[1].split("</section>", 1)[0]
replay = html.split('data-view-panel="replay"', 1)[1].split("</section>", 1)[0]
assert "No requirement names this function" in reqs
assert "No recorded run" in replay
Activity · 5 steps
test_each_view_carries_its_facts_and_links_the_full_view
None test_wiki_entities.test_each_view_carries_its_facts_and_links_the_full_view()
The map focuses the node; source opens the activity; flows, reqs and tests link.
tests/test_wiki_entities.py:45
Checks
assert 'href="map.html#n=save%40pkg%2Fstore.py"' in htmlassert ">Storage<" in htmlassert 'href="flow-main.html"' in html and 'href="flow-test_save.html"' in htmlassert 'href="sym-pkg-store-py.html#s-save"' in html and "#act-s-save" in htmlassert 'href="req-REQ-S-001.html"' in html
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-022 | measured | test_each_view_carries_its_facts_and_links_the_full_view → quick_view → _reqs → page_of |
| REQ-DDB-WIKI-048 | measured | test_each_view_carries_its_facts_and_links_the_full_view → quick_view |
Source · 10 lines
def test_each_view_carries_its_facts_and_links_the_full_view() -> None:
"""@brief The map focuses the node; source opens the activity; flows, reqs and tests link."""
html = quick_view(_facts())
assert 'href="map.html#n=save%40pkg%2Fstore.py"' in html
assert ">Storage<" in html
assert 'href="flow-main.html"' in html and 'href="flow-test_save.html"' in html
assert 'href="sym-pkg-store-py.html#s-save"' in html and "#act-s-save" in html
assert 'href="req-REQ-S-001.html"' in html
Activity · 6 steps
test_the_view_strip_has_every_view_in_order
None test_wiki_entities.test_the_view_strip_has_every_view_in_order()
Map · Block · Flow · Replay · Source · Tests · Reqs, a tab and a panel each.
tests/test_wiki_entities.py:37
Checks
assert VIEWS == ("map", "block", "flow", "replay", "source", "tests", "reqs")assert tabs == sorted(tabs) and all(f'data-view-panel="{v}"' in html for v in VIEWS)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-022 | measured | test_the_view_strip_has_every_view_in_order → quick_view → _reqs → page_of |
| REQ-DDB-WIKI-048 | measured | test_the_view_strip_has_every_view_in_order → quick_view |
| REQ-DDB-WIKI-054 | inferred | test_the_view_strip_has_every_view_in_order → all |
Source · 8 lines
def test_the_view_strip_has_every_view_in_order() -> None:
"""@brief Map · Block · Flow · Replay · Source · Tests · Reqs, a tab and a panel each."""
html = quick_view(_facts())
assert VIEWS == ("map", "block", "flow", "replay", "source", "tests", "reqs")
tabs = [html.split(f'data-view="{v}"', 1)[0].count("data-view=") for v in VIEWS]
assert tabs == sorted(tabs) and all(f'data-view-panel="{v}"' in html for v in VIEWS)