test_requirement_fields.py¶
tests/test_requirement_fields.py
IEEE 29148 requirement attributes reach the index; a key nothing reads is kept (S4; 2.0.0).
test_an_entry_with_nothing_extra_has_no_extra
None test_requirement_fields.test_an_entry_with_nothing_extra_has_no_extra(Path tmp_path, caplog)
`extra` is NULL (absent), not `{}`, when every key was read.
tests/test_requirement_fields.py:67
Checks
assert extra is None
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_an_entry_with_nothing_extra_has_no_extra → ingest_requirements_yaml → resolve_catalog_columns |
| REQ-DDB-CONFIG-003 | measured | test_an_entry_with_nothing_extra_has_no_extra → ingest_requirements_yaml → _is_flat_req_list |
| REQ-DDB-SCHEMA-006 | measured | test_an_entry_with_nothing_extra_has_no_extra → ingest_requirements_yaml |
| REQ-DDB-SCHEMA-015 | measured | test_an_entry_with_nothing_extra_has_no_extra → ingest_requirements_yaml |
| REQ-DDB-WIKI-054 | inferred | test_an_entry_with_nothing_extra_has_no_extra → ingest_requirements_yaml → _is_flat_req_list → all |
Source · 8 lines
def test_an_entry_with_nothing_extra_has_no_extra(tmp_path: Path, caplog) -> None:
"""@brief `extra` is NULL (absent), not `{}`, when every key was read."""
catalog = tmp_path / "requirements.yaml"
catalog.write_text("requirements:\n REQ-B-001:\n name: Close\n")
db = tmp_path / "clew.db"
ingest_requirements_yaml(db, catalog)
(extra,) = sqlite3.connect(db).execute("SELECT extra FROM requirements").fetchone()
assert extra is None1 more lines, not shown
Activity · 6 steps
test_an_unread_key_is_kept_and_named
None test_requirement_fields.test_an_unread_key_is_kept_and_named(Path tmp_path, caplog)
`risk` and `x-owner` are kept in `extra`, and the log names them.
tests/test_requirement_fields.py:60
Checks
assert json.loads(row["extra"]) == {"risk": "high", "x-owner": "platform"}assert "risk" in caplog.text and "x-owner" in caplog.text
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_an_unread_key_is_kept_and_named → _row → ingest_requirements_yaml → resolve_catalog_columns |
| REQ-DDB-CONFIG-003 | measured | test_an_unread_key_is_kept_and_named → _row → ingest_requirements_yaml → _is_flat_req_list |
| REQ-DDB-SCHEMA-006 | measured | test_an_unread_key_is_kept_and_named → _row → ingest_requirements_yaml |
| REQ-DDB-SCHEMA-015 | measured | test_an_unread_key_is_kept_and_named → _row → ingest_requirements_yaml |
| REQ-DDB-WIKI-054 | inferred | test_an_unread_key_is_kept_and_named → _row → ingest_requirements_yaml → _is_flat_req_list → all |
Source · 7 lines
def test_an_unread_key_is_kept_and_named(tmp_path: Path, caplog) -> None:
"""@brief `risk` and `x-owner` are kept in `extra`, and the log names them."""
row = _row(tmp_path, caplog)
assert json.loads(row["extra"]) == {"risk": "high", "x-owner": "platform"}
assert "risk" in caplog.text and "x-owner" in caplog.text
Activity · 3 steps
test_the_29148_attributes_are_columns
None test_requirement_fields.test_the_29148_attributes_are_columns(Path tmp_path, caplog)
status / rationale / verification / parent land in their own columns.
tests/test_requirement_fields.py:49
Checks
assert (row["status"], row["rationale"], row["verification"], row["parent"]) == ("approved", "Callers need a handle.", "test", "REQ-SYS-001", )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_the_29148_attributes_are_columns → _row → ingest_requirements_yaml → resolve_catalog_columns |
| REQ-DDB-CONFIG-003 | measured | test_the_29148_attributes_are_columns → _row → ingest_requirements_yaml → _is_flat_req_list |
| REQ-DDB-SCHEMA-006 | measured | test_the_29148_attributes_are_columns → _row → ingest_requirements_yaml |
| REQ-DDB-SCHEMA-015 | measured | test_the_29148_attributes_are_columns → _row → ingest_requirements_yaml |
| REQ-DDB-WIKI-054 | inferred | test_the_29148_attributes_are_columns → _row → ingest_requirements_yaml → _is_flat_req_list → all |
Source · 11 lines
def test_the_29148_attributes_are_columns(tmp_path: Path, caplog) -> None:
"""@brief status / rationale / verification / parent land in their own columns."""
row = _row(tmp_path, caplog)
assert (row["status"], row["rationale"], row["verification"], row["parent"]) == (
"approved",
"Callers need a handle.",
"test",
"REQ-SYS-001",
)