test_python_recovers_functions_and_still_no_module_variables

Tests › tests/test_ast_symbols.py

passed Passed in the packaged run.

What this test is for

Why it exists

INVERTED, NOT DELETED (gh#397). This test used to assert that Python is REFUSED, on the ground its own name gave: "because doxygen already indexes it". Its docstring said "Pinned so that enabling Python later is a decision rather than a side effect" — this is that decision, and the premise it rested on was MEASURED FALSE:

Given

  1. src = b"TOP_LEVEL = 3\n\n\ndef top():\n return 1\n"
  2. tree = SubstrateParser("python").parse(src)
  3. payload = _FunctionDefinitionHarvester().harvest(tree, src)
→

When

  1. —
→

Then

  1. ✓ [row[0] for row in payload.get(_PAYLOAD_FUNCTIONS, [])] equals ["top"]
  2. ✓ payload.get(_PAYLOAD_VARIABLES, []) equals []

tests/test_ast_symbols.py:665 · its file's page

What it checks (2)

  1. assert [row[0] for row in payload.get(_PAYLOAD_FUNCTIONS, [])] == ["top"] not attributed
  2. assert payload.get(_PAYLOAD_VARIABLES, []) == [], ( "TOP_LEVEL is a module-level assignment doxygen already indexes; recovering it " "would double-count every Python constant in the repo" ) not attributed

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.

Also reaches 2 requirements

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