test_a_field_doxygen_already_emitted_is_not_duplicated

Tests › tests/test_python_class_fields.py

passed Passed in the packaged run.

What this test is for

Why it exists

The harvest deliberately collects EVERY annotated field, including the ones doxygen emitted, because which are present is a fact about the database rather than the source. The dedup therefore has to happen here, against the existing links — and if it does not, a class ends up with two rows for one attribute, which is gh#19's defect reintroduced through the back door.

Given

  1. conn = _index()
  2. conn.execute( "INSERT INTO memberdef (rowid, name, type, kind, file_id, line) " "VALUES (99, 'brief', 'str', 'variable', 1, 9)" )
2 more
  1. conn.execute("INSERT INTO member (scope_rowid, memberdef_rowid, prot, virt) VALUES (10,99,0,0)")
  2. harvested = [ (1, {"class_fields": [["brief", "Config", "str", 9], ["name", "Config", "str", 7]]}) ]
→

When

  1. _recover_class_fields_into(conn, harvested)
→

Then

  1. ✓ _recover_class_fields_into(conn, harvested) equals 1
  2. ✓ _members(conn, "a::Config") equals [("brief", "str", "doxygen"), ("name", "str", "ast")]

tests/test_python_class_fields.py:214 · its file's page

What it checks (2)

  1. assert _recover_class_fields_into(conn, harvested) == 1, "only the missing one is inserted" observes _recover_class_fields_into
  2. assert _members(conn, "a::Config") == [("brief", "str", "doxygen"), ("name", "str", "ast")] observes _members

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_field_doxygen_already_emitted_is_not_duplicated→_index→_recover_class_fields_into→_members

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_a_field_doxygen_already_emitted_is_not_duplicated · 2 checks_recover_class_fields_intoREQ-DDB-INDEX-004 · measured_recover_class_fields_intoallREQ-DDB-WIKI-054 · inferred
Also reaches 2 requirements

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