test_a_module_level_python_entry_resolves_through_its_scope

Tests › tests/test_r1_richness.py

passed Passed in the packaged run.

What this test is for

Why it exists

A MODULE-LEVEL PYTHON FUNCTION HAS NO MODULE IN ITS `definition`, and that broke this resolver for every one of them. doxygen writes the qualifier into `definition` for a CLASS method and omits it for a module-level function, recording it in `scope` instead:

Verifies REQ-DDB-SCHEMA-001 REQ-DDB-SCHEMA-002 REQ-DDB-SCHEMA-003 REQ-DDB-SCHEMA-004 REQ-DDB-SCHEMA-007

Given

  1. conn = sqlite3.connect(":memory:")
  2. conn.executescript( "CREATE TABLE memberdef (rowid INTEGER PRIMARY KEY, kind TEXT, name TEXT, " "definition TEXT, scope TEXT, file_id INTEGER, bodyfile_id INTEGER);" )
2 more
  1. conn.executemany( "INSERT INTO memberdef VALUES (?, 'function', ?, ?, ?, 1, 1)", [ # The real target: doxygen left the module out of `definition`. (1, "_write_doxyfile_stdin", " None _write_doxyfile_stdin", "clew.doxygen"), # A same-named function in ANOTHER module must not be borrowed. (2, "_write_doxyfile_stdin", " None _write_doxyfile_stdin", "other.module"), ], )
  2. conn.commit()
→

When

  1. _resolve_qualified_entry(conn, "clew.doxygen._write_doxyfile_stdin", ".")
  2. _resolve_qualified_entry(conn, "other.module._write_doxyfile_stdin", ".")
  3. _resolve_qualified_entry(conn, "third.module._write_doxyfile_stdin", ".")
  4. conn.close()
→

Then

  1. ✓ _resolve_qualified_entry(conn, "clew.doxygen._write_doxyfile_stdin", ".") equals 1
  2. ✓ _resolve_qualified_entry(conn, "other.module._write_doxyfile_stdin", ".") equals 2
  3. ✓ _resolve_qualified_entry(conn, "third.module._write_doxyfile_stdin", ".") is None

tests/test_r1_richness.py:459 · its file's page

What it checks (3)

  1. assert _resolve_qualified_entry(conn, "clew.doxygen._write_doxyfile_stdin", ".") == 1 observes _resolve_qualified_entry
  2. assert _resolve_qualified_entry(conn, "other.module._write_doxyfile_stdin", ".") == 2 observes _resolve_qualified_entry
  3. assert _resolve_qualified_entry(conn, "third.module._write_doxyfile_stdin", ".") is None observes _resolve_qualified_entry

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_a_module_level_python_entry_resolves_through_its_scope→_resolve_qualified_entry

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.

Requirements it verifies (5)

requirementlinked byimplementers exercised
REQ-DDB-SCHEMA-001catalogunknown
REQ-DDB-SCHEMA-002catalogunknown
REQ-DDB-SCHEMA-003catalogunknown
REQ-DDB-SCHEMA-004catalogunknown
REQ-DDB-SCHEMA-007catalogunknown