test_an_elif_is_a_condition_at_the_same_depth

Tests › tests/test_wiki_activity.py

passed Passed in the packaged run.

What this test is for

Why it exists

`elif` is not `else` + nested `if`; a final `else` keeps its own line.

Given

  1. src = ( "def f(x):\n if x > 1:\n a()\n elif x:\n b()\n else:\n c()\n" )
→

When

  1. steps = steps_of(src.splitlines(), "m.py", 1)
→

Then

  1. ✓ [(s.kind, s.text, s.first, s.depth) for s in steps] equals [ (COND, "if x > 1", 2, 0), (STMT, "a()", 3, 1), (COND, "elif x", 4, 0), (STMT, "b()", 5, 1), (ELSE, "else", 6, 0), (STMT, "c()", 7, 1), ]

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

Build this wiki from the index · 9 of 400 steps

… 273 earlier steps

callercallercallercallerclew/wiki/symbols.pyclew/wiki/symbols.pyclew/wiki/symbols.pyclew/wiki/symbols.pyclew/wiki/activity.pyclew/wiki/activity.pyclew/wiki/activity.pyclew/wiki/activity.pyloop (line 360)loopopt (line 374)optopt (line 64)optopt (line 160)optloop (line 187)loopelif (line 195)elifbuild_wiki274. _section → _activity274_activity275. _activity → steps_of275steps_of276. steps_of → _py_steps276_py_steps▶ test enters277–283. _py_steps → _py_block277_py_block +6 more284. _py_block → _py_block284_py_block285. _py_block → 285… 3 calls not run286. _py_steps → _without_docstring286_without_docstring287–288. steps_of → _c_steps287_c_steps +1 more

… 112 later steps

tests/test_wiki_activity.py:77 · its file's page

What it checks (1)

  1. assert [(s.kind, s.text, s.first, s.depth) for s in steps] == [ (COND, "if x > 1", 2, 0), (STMT, "a()", 3, 1), (COND, "elif x", 4, 0), (STMT, "b()", 5, 1), (ELSE, "else", 6, 0), (STMT, "c()", 7, 1), ] observes steps_of via steps

Where the product reaches it

  • build_wiki → _build_site → symbol_pages → _section → _activity → steps_of (flow)

Call flow

test_an_elif_is_a_condition_at_the_same_depth→steps_of

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

test_an_elif_is_a_condition_at_the_same_depth · 1 checkssteps_ofREQ-DDB-WIKI-045 · measured
Also reaches 1 requirement

Its run touches their code; that is reach, not proof.