test_harvest_docstrings_lines_are_the_def_lines

Tests › tests/test_pydocs.py

passed Passed in the packaged run.

What this test is for

Why it exists

The test says nothing about why.

Given

  1. tree = lps.parse_tree("python", SRC.encode())
→

When

  1. found = {(kind, name): line for kind, line, name, _ in harvest_docstrings(tree)}
  2. lines = SRC.splitlines()
  3. def line_of(prefix: str) -> int: return next(i for i, text in enumerate(lines, 1) if text.lstrip().startswith(prefix))
→

Then

  1. ✓ found equals { ("function", "doxy"): line_of("def doxy"), ("function", "pep"): line_of("def pep"), ("class", "Thing"): line_of("class Thing"), ("function", "method"): line_of("def method"), }
  2. ✓ found[("function", "pep")] equals line_of("@decorated") + 1

tests/test_pydocs.py:58 · its file's page

What it checks (2)

  1. assert found == { ("function", "doxy"): line_of("def doxy"), ("function", "pep"): line_of("def pep"), ("class", "Thing"): line_of("class Thing"), ("function", "method"): line_of("def method"), }, "the def line, not the decorator's: that is the line doxygen records" observes harvest_docstrings via found
  2. assert found[("function", "pep")] == line_of("@decorated") + 1 observes harvest_docstrings via found

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_harvest_docstrings_lines_are_the_def_lines→harvest_docstrings

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_harvest_docstrings_lines_are_the_def_lines · 2 checksharvest_docstringsREQ-DDB-PIPE-013 · measured
Also reaches 1 requirement

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