test_wiki_slice_identity.py¶
tests/test_wiki_slice_identity.py
A test's slice is drawn as windows split at gaps, and is keyed by file and name (P4; 2.0.0: W10, W11 of the hard-coded-assumptions review).
test_a_per_test_key_carries_the_file
None test_wiki_slice_identity.test_a_per_test_key_carries_the_file()
pytest node id → `file::name`; parameters and classes dropped; setup phase ignored.
tests/test_wiki_slice_identity.py:66
Checks
assert _context_test("tests/test_a.py::TestK::test_x[p::q]|run") == "tests/test_a.py::test_x"assert _context_test("tests/test_b.py::test_x|run") == "tests/test_b.py::test_x"assert _context_test("tests/test_b.py::test_x|setup") == ""assert test_name("tests/test_b.py::test_x") == "test_x"assert test_name("an LCOV TN name") == "an LCOV TN name"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-041 | measured | test_a_per_test_key_carries_the_file → test_name |
Source · 9 lines
def test_a_per_test_key_carries_the_file() -> None:
"""@brief pytest node id → `file::name`; parameters and classes dropped; setup phase ignored."""
assert _context_test("tests/test_a.py::TestK::test_x[p::q]|run") == "tests/test_a.py::test_x"
assert _context_test("tests/test_b.py::test_x|run") == "tests/test_b.py::test_x"
assert _context_test("tests/test_b.py::test_x|setup") == ""
assert test_name("tests/test_b.py::test_x") == "test_x"
assert test_name("an LCOV TN name") == "an LCOV TN name"
Activity · 5 steps
test_a_slice_with_a_gap_is_two_windows_with_the_gap_counted
None test_wiki_slice_identity.test_a_slice_with_a_gap_is_two_windows_with_the_gap_counted()
Steps 2 and 40 of 50: two windows, the 33 steps between counted, not drawn.
tests/test_wiki_slice_identity.py:53
Checks
assert html.count("<svg") == 2assert "… 33 steps between" in htmlassert "… 45 later steps" not in html
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-041 | measured | test_a_slice_with_a_gap_is_two_windows_with_the_gap_counted → slice_svg |
Source · 8 lines
def test_a_slice_with_a_gap_is_two_windows_with_the_gap_counted() -> None:
"""@brief Steps 2 and 40 of 50: two windows, the 33 steps between counted, not drawn."""
html = slice_svg(_flow(50), Slice(exercised=(2, 40)), pad=2)
assert html.count("<svg") == 2
assert "… 33 steps between" in html
assert "… 45 later steps" not in html
Activity · 4 steps
test_adjacent_exercised_steps_stay_one_window
None test_wiki_slice_identity.test_adjacent_exercised_steps_stay_one_window()
Steps 2 and 5 with pad 2: the windows overlap, so one is drawn.
tests/test_wiki_slice_identity.py:61
Checks
assert slice_svg(_flow(50), Slice(exercised=(2, 5)), pad=2).count("<svg") == 1
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-041 | measured | test_adjacent_exercised_steps_stay_one_window → slice_svg |
Source · 5 lines
def test_adjacent_exercised_steps_stay_one_window() -> None:
"""@brief Steps 2 and 5 with pad 2: the windows overlap, so one is drawn."""
assert slice_svg(_flow(50), Slice(exercised=(2, 5)), pad=2).count("<svg") == 1
Activity · 1 steps
test_two_namesakes_keep_their_own_slices_on_the_page
None test_wiki_slice_identity.test_two_namesakes_keep_their_own_slices_on_the_page()
One page, two definitions, each with its own flows listed under its file.
tests/test_wiki_slice_identity.py:75
Checks
assert html.index("tests/test_a.py") < html.index("Flow alpha") < html.index("tests/test_b.py")assert html.index("tests/test_b.py") < html.index("Flow beta")
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-041 | measured | test_two_namesakes_keep_their_own_slices_on_the_page → _exercises |
Source · 15 lines
def test_two_namesakes_keep_their_own_slices_on_the_page() -> None:
"""@brief One page, two definitions, each with its own flows listed under its file."""
from clew.wiki.testpages import _exercises
page = lambda name: SimpleNamespace(name=name, title=f"Flow {name}", steps=3, flow=None) # noqa: E731
ctx = {
"slices": {
"tests/test_a.py::test_x": [(page("alpha"), Slice())],
"tests/test_b.py::test_x": [(page("beta"), Slice())],
}
}
defs = [SimpleNamespace(file="tests/test_a.py"), SimpleNamespace(file="tests/test_b.py")]
html = _exercises("test_x", ctx, defs)
assert html.index("tests/test_a.py") < html.index("Flow alpha") < html.index("tests/test_b.py")
assert html.index("tests/test_b.py") < html.index("Flow beta")1 more lines, not shown