test_requirement_dossier_fields.py

tests/test_requirement_dossier_fields.py

A requirement dossier carries the IEEE 29148 attributes and every unmapped catalog key (S4 served; 2.0.0).

test_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra

None test_requirement_dossier_fields.test_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra(Path tmp_path)

'' for an unstated attribute; `extra` absent, not {}.

tests/test_requirement_dossier_fields.py:60

Show on the map →

Called by none

Calls _db, req_trace

Checks

  • assert (t.status, t.rationale, t.verification, t.parent) == ("", "", "", "")
  • assert t.extra is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra → _db → ingest_requirements_yaml → resolve_catalog_columns
REQ-DDB-CONFIG-003measuredtest_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra → _db → ingest_requirements_yaml → _is_flat_req_list
REQ-DDB-QUERY-001measuredtest_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra → req_trace
REQ-DDB-QUERY-003measuredtest_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra → req_trace → table_exists
REQ-DDB-QUERY-010inferredtest_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra → req_trace → _req_implementers → resolve_rowid
REQ-DDB-SCHEMA-006measuredtest_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra → req_trace → _req_failure_modes
REQ-DDB-SCHEMA-015measuredtest_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra → req_trace → _req_links
REQ-DDB-WIKI-054inferredtest_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra → _db → ingest_requirements_yaml → _is_flat_req_list → all
Source · 7 lines
def test_an_entry_stating_none_of_them_has_empty_attributes_and_no_extra(tmp_path: Path) -> None:
    """@brief '' for an unstated attribute; `extra` absent, not {}."""
    t = req_trace(_db(tmp_path), "REQ-A-002")
    assert (t.status, t.rationale, t.verification, t.parent) == ("", "", "", "")
    assert t.extra is None

Activity · 3 steps
lines 62–62t = req_trace(_db(tmp_path), "REQ-A-002")lines 63–63assert (t.status, t.rationale, t.verification, t.parent) == ("", "", "", "")lines 64–64assert t.extra is None

test_an_index_from_before_the_columns_still_traces

None test_requirement_dossier_fields.test_an_index_from_before_the_columns_still_traces(Path tmp_path)

A requirements table without the S4 columns: the trace degrades, it does not raise.

tests/test_requirement_dossier_fields.py:67

Show on the map →

Called by none

Calls req_trace

Checks

  • assert t.title == "Open" and t.status == "" and t.extra is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-QUERY-001measuredtest_an_index_from_before_the_columns_still_traces → req_trace
REQ-DDB-QUERY-003measuredtest_an_index_from_before_the_columns_still_traces → req_trace → table_exists
REQ-DDB-QUERY-010inferredtest_an_index_from_before_the_columns_still_traces → req_trace → _req_implementers → resolve_rowid
REQ-DDB-SCHEMA-006measuredtest_an_index_from_before_the_columns_still_traces → req_trace → _req_failure_modes
REQ-DDB-SCHEMA-015measuredtest_an_index_from_before_the_columns_still_traces → req_trace → _req_links
Source · 10 lines
def test_an_index_from_before_the_columns_still_traces(tmp_path: Path) -> None:
    """@brief A requirements table without the S4 columns: the trace degrades, it does not raise."""
    db = tmp_path / "old.db"
    with sqlite3.connect(db) as conn:
        conn.execute(
            "CREATE TABLE requirements (id TEXT, block TEXT, title TEXT, acceptance TEXT, priority TEXT)"
        )
        conn.execute("INSERT INTO requirements VALUES ('REQ-A-001', 'A', 'Open', '', '')")
    t = req_trace(db, "REQ-A-001")
    assert t.title == "Open" and t.status == "" and t.extra is None

1 more lines, not shown

Activity · 6 steps
lines 69–69db = tmp_path / "old.db"lines 70–70with sqlite3.connect(db) as connlines 71–73conn.execute( "CREATE TABLE requirements (id TEXT, block TEXT, title TEXT, acceptance TEXT, priority TEXT)" )lines 74–74conn.execute("INSERT INTO requirements VALUES ('REQ-A-001', 'A', 'Open', '', '')")lines 75–75t = req_trace(db, "REQ-A-001")lines 76–76assert t.title == "Open" and t.status == "" and t.extra is None

test_the_29148_attributes_and_extra_are_served

None test_requirement_dossier_fields.test_the_29148_attributes_and_extra_are_served(Path tmp_path)

All four attributes, and the unmapped key under `extra`.

tests/test_requirement_dossier_fields.py:48

Show on the map →

Called by none

Calls _db, req_trace

Checks

  • assert (t.status, t.rationale, t.verification, t.parent) == ("approved", "Callers need a handle.", "test", "REQ-SYS-001", )
  • assert t.extra == {"x-owner": "platform"}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_the_29148_attributes_and_extra_are_served → _db → ingest_requirements_yaml → resolve_catalog_columns
REQ-DDB-CONFIG-003measuredtest_the_29148_attributes_and_extra_are_served → _db → ingest_requirements_yaml → _is_flat_req_list
REQ-DDB-QUERY-001measuredtest_the_29148_attributes_and_extra_are_served → req_trace
REQ-DDB-QUERY-003measuredtest_the_29148_attributes_and_extra_are_served → req_trace → table_exists
REQ-DDB-QUERY-010inferredtest_the_29148_attributes_and_extra_are_served → req_trace → _req_implementers → resolve_rowid
REQ-DDB-SCHEMA-006measuredtest_the_29148_attributes_and_extra_are_served → req_trace → _req_failure_modes
REQ-DDB-SCHEMA-015measuredtest_the_29148_attributes_and_extra_are_served → req_trace → _req_links
REQ-DDB-WIKI-054inferredtest_the_29148_attributes_and_extra_are_served → _db → ingest_requirements_yaml → _is_flat_req_list → all
Source · 12 lines
def test_the_29148_attributes_and_extra_are_served(tmp_path: Path) -> None:
    """@brief All four attributes, and the unmapped key under `extra`."""
    t = req_trace(_db(tmp_path), "REQ-A-001")
    assert (t.status, t.rationale, t.verification, t.parent) == (
        "approved",
        "Callers need a handle.",
        "test",
        "REQ-SYS-001",
    )
    assert t.extra == {"x-owner": "platform"}

Activity · 3 steps
lines 50–50t = req_trace(_db(tmp_path), "REQ-A-001")lines 51–56assert (t.status, t.rationale, t.verification, t.parent) == ( "approved", "Callers need a handle.", "test", "REQ-SYS-001", )lines 57–57assert t.extra == {"x-owner": "platform"}