test_guard_checks_extended.py

tests/guard/test_guard_checks_extended.py

Tests for extended validation checks (Phase 5).

test_analyze_coverage_structure

test_guard_checks_extended.TestCoverageSubcommand.test_analyze_coverage_structure(self)

tests/guard/test_guard_checks_extended.py:175

Checks

  • assert "total_requirements" in report
  • assert "covered" in report
  • assert "uncovered" in report
  • assert "orphan_refs" in report
  • assert isinstance(report["covered"], list)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_analyze_coverage_structure → analyze_coverage → covered_via → read_catalog_at → git_text → git_argv
REQ-DDB-CONFIG-009measuredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → find_source_files → gate_exclusion
REQ-DDB-GUARD-011measuredtest_analyze_coverage_structure → analyze_coverage → load_requirements_full
REQ-DDB-GUARD-013measuredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → find_source_files
REQ-DDB-GUARD-016measuredtest_analyze_coverage_structure → analyze_coverage → load_requirements_full → _get_requirements_config → resolve_contained_path
REQ-DDB-GUARD-018measuredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → _process_source_file → parse_source_file_with_content
REQ-DDB-GUARD-019measuredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → _process_source_file → parse_source_file_with_content → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → parse_doxygen_tags
REQ-DDB-GUARD-020measuredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → _process_source_file → parse_source_file_with_content → parse_content_for_file → language_for_file
REQ-DDB-GUARD-021inferredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → _process_source_file → parse_source_file_with_content → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _find_preceding_doxygen → _find_python_docstring_block
REQ-DDB-GUARD-022measuredtest_analyze_coverage_structure → analyze_coverage
REQ-DDB-GUARD-024inferredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → _process_source_file → parse_source_file_with_content → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _is_rust_test_item
REQ-DDB-GUARD-025measuredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → _process_source_file → parse_source_file_with_content → parse_content_for_file → parse_functions → parse_functions_ts → _collect_functions → _js_returns_void
REQ-DDB-GUARD-027inferredtest_analyze_coverage_structure → analyze_coverage → covered_via → read_catalog_at
REQ-DDB-PIPE-011measuredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → find_source_files → gate_exclusion → binary_file
REQ-DDB-SCHEMA-015inferredtest_analyze_coverage_structure → analyze_coverage → covered_via → _realised → link_ids
REQ-DDB-WIKI-054inferredtest_analyze_coverage_structure → analyze_coverage → collect_tagged_functions → find_source_files → gate_exclusion → _gate_matcher → load_toolchain_config → _string_list → all
Source · 22 lines
    def test_analyze_coverage_structure(self):
        from clew.guard.coverage import analyze_coverage

        source_dir = str(FIXTURES_DIR / "sources")
        config = deep_merge(
            BASE_CONFIG,
            {
                "requirements": {
                    "file": str(FIXTURES_DIR / "sources" / "requirements.csv"),
                    "id_column": "Req ID",
                    "name_column": "Name",
                    "format": "csv",
                },
            },
        )
        report = analyze_coverage([source_dir], config)
        assert "total_requirements" in report
        assert "covered" in report
        assert "uncovered" in report
        assert "orphan_refs" in report
        assert isinstance(report["covered"], list)
Activity · 9 steps
lines 176–176from clew.guard.coverage import analyze_coveragelines 178–178source_dir = str(FIXTURES_DIR / "sources")lines 179–189config = deep_merge( BASE_CONFIG, { "requirements": { "file": str(FIXTURES_DIR / "sources" / "requirements.csv"), "id_column": "Req ID", "name_column": "Name", "format": "csv", }, }, )lines 190–190report = analyze_coverage([source_dir], config)lines 191–191assert "total_requirements" in reportlines 192–192assert "covered" in reportlines 193–193assert "uncovered" in reportlines 194–194assert "orphan_refs" in reportlines 195–195assert isinstance(report["covered"], list)

test_c_file_missing_tags_fails

test_guard_checks_extended.TestCheckFilePresence.test_c_file_missing_tags_fails(self)

tests/guard/test_guard_checks_extended.py:121

Checks

  • assert len(violations) >= 1
  • assert any("@brief" in v.message or "@version" in v.message for v in violations)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-006measuredtest_c_file_missing_tags_fails → check_file_presence
REQ-DDB-GUARD-019measuredtest_c_file_missing_tags_fails → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_c_file_missing_tags_fails → check_file_presence → _check_file_block_tags → apply_autobrief
Source · 7 lines
    def test_c_file_missing_tags_fails(self):
        content = "/** @file sensor_driver.c */\nvoid func(void) {}\n"
        config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})
        violations = check_file_presence("a.c", content, config)
        assert len(violations) >= 1
        assert any("@brief" in v.message or "@version" in v.message for v in violations)
Activity · 5 steps
lines 122–122content = "/** @file sensor_driver.c */\nvoid func(void) {}\n"lines 123–123config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})lines 124–124violations = check_file_presence("a.c", content, config)lines 125–125assert len(violations) >= 1lines 126–126assert any("@brief" in v.message or "@version" in v.message for v in violations)

test_c_file_with_complete_block_passes

test_guard_checks_extended.TestCheckFilePresence.test_c_file_with_complete_block_passes(self)

tests/guard/test_guard_checks_extended.py:113

Checks

  • assert len(violations) == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-006measuredtest_c_file_with_complete_block_passes → check_file_presence
REQ-DDB-GUARD-019measuredtest_c_file_with_complete_block_passes → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_c_file_with_complete_block_passes → check_file_presence → _check_file_block_tags → apply_autobrief
Source · 8 lines
    def test_c_file_with_complete_block_passes(self):
        content = (
            "/**\n * @file\n * @brief Sensor driver.\n * @version 1.0\n */\nvoid func(void) {}\n"
        )
        config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})
        violations = check_file_presence("a.c", content, config)
        assert len(violations) == 0
Activity · 4 steps
lines 114–116content = ( "/**\n * @file\n * @brief Sensor driver.\n * @version 1.0\n */\nvoid func(void) {}\n" )lines 117–117config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})lines 118–118violations = check_file_presence("a.c", content, config)lines 119–119assert len(violations) == 0

test_c_file_without_file_block_fails

test_guard_checks_extended.TestCheckFilePresence.test_c_file_without_file_block_fails(self)

tests/guard/test_guard_checks_extended.py:128

Checks

  • assert len(violations) == 1

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-006measuredtest_c_file_without_file_block_fails → check_file_presence
REQ-DDB-GUARD-019inferredtest_c_file_without_file_block_fails → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_c_file_without_file_block_fails → check_file_presence → _check_file_block_tags → apply_autobrief
Source · 6 lines
    def test_c_file_without_file_block_fails(self):
        content = "void func(void) {}\n"
        config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})
        violations = check_file_presence("a.c", content, config)
        assert len(violations) == 1
Activity · 4 steps
lines 129–129content = "void func(void) {}\n"lines 130–130config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})lines 131–131violations = check_file_presence("a.c", content, config)lines 132–132assert len(violations) == 1

test_disabled_by_config

test_guard_checks_extended.TestCheckUnknownTags.test_disabled_by_config(self)

tests/guard/test_guard_checks_extended.py:83

Show on the map →

Called by none

Calls _make_func, check_unknown_tags, deep_merge

Checks

  • assert len(violations) == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_disabled_by_config → check_unknown_tags
Source · 7 lines
    def test_disabled_by_config(self):
        config = deep_merge(BASE_CONFIG, {"validate": {"known_tags_warn": False}})
        func = _make_func("f", tags={"brief": ["desc"], "bogus": ["val"]})
        violations = check_unknown_tags(func, "a.c", config)
        assert len(violations) == 0

Activity · 4 steps
lines 84–84config = deep_merge(BASE_CONFIG, {"validate": {"known_tags_warn": False}})lines 85–85func = _make_func("f", tags={"brief": ["desc"], "bogus": ["val"]})lines 86–86violations = check_unknown_tags(func, "a.c", config)lines 87–87assert len(violations) == 0

test_disabled_by_default

test_guard_checks_extended.TestCheckFilePresence.test_disabled_by_default(self)

tests/guard/test_guard_checks_extended.py:140

Checks

  • assert len(violations) == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-006measuredtest_disabled_by_default → check_file_presence
REQ-DDB-GUARD-019inferredtest_disabled_by_default → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_disabled_by_default → check_file_presence → _check_file_block_tags → apply_autobrief
Source · 5 lines
    def test_disabled_by_default(self):
        content = "void func(void) {}\n"
        violations = check_file_presence("a.c", content, BASE_CONFIG)
        assert len(violations) == 0
Activity · 3 steps
lines 141–141content = "void func(void) {}\n"lines 142–142violations = check_file_presence("a.c", content, BASE_CONFIG)lines 143–143assert len(violations) == 0

test_extra_tags_accepted

test_guard_checks_extended.TestCheckUnknownTags.test_extra_tags_accepted(self)

tests/guard/test_guard_checks_extended.py:77

Show on the map →

Called by none

Calls _make_func, check_unknown_tags, deep_merge

Checks

  • assert len(violations) == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_extra_tags_accepted → check_unknown_tags
Source · 6 lines
    def test_extra_tags_accepted(self):
        config = deep_merge(BASE_CONFIG, {"validate": {"extra_tags": ["custom"]}})
        func = _make_func("f", tags={"brief": ["desc"], "custom": ["val"]})
        violations = check_unknown_tags(func, "a.c", config)
        assert len(violations) == 0
Activity · 4 steps
lines 78–78config = deep_merge(BASE_CONFIG, {"validate": {"extra_tags": ["custom"]}})lines 79–79func = _make_func("f", tags={"brief": ["desc"], "custom": ["val"]})lines 80–80violations = check_unknown_tags(func, "a.c", config)lines 81–81assert len(violations) == 0

test_format_coverage_markdown

test_guard_checks_extended.TestCoverageSubcommand.test_format_coverage_markdown(self)

tests/guard/test_guard_checks_extended.py:197

Checks

  • assert "# Requirements Coverage" in md
  • assert "REQ-003" in md

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-022measuredtest_format_coverage_markdown → format_coverage_markdown
Source · 14 lines
    def test_format_coverage_markdown(self):
        from clew.guard.coverage import format_coverage_markdown

        report = {
            "total_requirements": 5,
            "covered": ["REQ-001", "REQ-002"],
            "uncovered": ["REQ-003"],
            "supports_only": [],
            "orphan_refs": [],
            "unmapped_functions": ["helper"],
        }
        md = format_coverage_markdown(report)
        assert "# Requirements Coverage" in md
        assert "REQ-003" in md

1 more lines, not shown

Activity · 5 steps
lines 198–198from clew.guard.coverage import format_coverage_markdownlines 200–207report = { "total_requirements": 5, "covered": ["REQ-001", "REQ-002"], "uncovered": ["REQ-003"], "supports_only": [], "orphan_refs": [], "unmapped_functions": ["helper"], }lines 208–208md = format_coverage_markdown(report)lines 209–209assert "# Requirements Coverage" in mdlines 210–210assert "REQ-003" in md

test_include_guards_skipped

test_guard_checks_extended.TestCheckFilePresence.test_include_guards_skipped(self)

tests/guard/test_guard_checks_extended.py:145

Checks

  • assert len(violations) == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-006measuredtest_include_guards_skipped → check_file_presence
REQ-DDB-GUARD-019measuredtest_include_guards_skipped → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_include_guards_skipped → check_file_presence → _check_file_block_tags → apply_autobrief
Source · 11 lines
    def test_include_guards_skipped(self):
        content = (
            "#ifndef FOO_H\n#define FOO_H\n"
            "/**\n * @file\n * @brief Header.\n * @version 1.0\n */\n"
            "void f(void);\n#endif\n"
        )
        config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})
        violations = check_file_presence("a.h", content, config)
        assert len(violations) == 0

Activity · 4 steps
lines 146–150content = ( "#ifndef FOO_H\n#define FOO_H\n" "/**\n * @file\n * @brief Header.\n * @version 1.0\n */\n" "void f(void);\n#endif\n" )lines 151–151config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})lines 152–152violations = check_file_presence("a.h", content, config)lines 153–153assert len(violations) == 0

test_known_tag_no_violation

test_guard_checks_extended.TestCheckUnknownTags.test_known_tag_no_violation(self)

tests/guard/test_guard_checks_extended.py:43

Show on the map →

Called by none

Calls _make_func, check_unknown_tags

Checks

  • assert len(violations) == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_known_tag_no_violation → check_unknown_tags
Source · 5 lines
    def test_known_tag_no_violation(self):
        func = _make_func("f", tags={"brief": ["desc"], "version": ["1.0"]})
        violations = check_unknown_tags(func, "a.c", BASE_CONFIG)
        assert len(violations) == 0
Activity · 3 steps
lines 44–44func = _make_func("f", tags={"brief": ["desc"], "version": ["1.0"]})lines 45–45violations = check_unknown_tags(func, "a.c", BASE_CONFIG)lines 46–46assert len(violations) == 0

test_levenshtein_suggestion

test_guard_checks_extended.TestCheckUnknownTags.test_levenshtein_suggestion(self)

tests/guard/test_guard_checks_extended.py:54

Show on the map →

Called by none

Calls _make_func, check_unknown_tags

Checks

  • assert "did you mean @version?" in violations[0].message

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_levenshtein_suggestion → check_unknown_tags
Source · 5 lines
    def test_levenshtein_suggestion(self):
        func = _make_func("f", tags={"brief": ["desc"], "verison": ["1.0"]})
        violations = check_unknown_tags(func, "a.c", BASE_CONFIG)
        assert "did you mean @version?" in violations[0].message
Activity · 3 steps
lines 55–55func = _make_func("f", tags={"brief": ["desc"], "verison": ["1.0"]})lines 56–56violations = check_unknown_tags(func, "a.c", BASE_CONFIG)lines 57–57assert "did you mean @version?" in violations[0].message

test_missing_brief_has_fix_hint

test_guard_checks_extended.TestFixHints.test_missing_brief_has_fix_hint(self)

tests/guard/test_guard_checks_extended.py:164

Show on the map →

Called by none

Calls _make_func, check_presence

Checks

  • assert len(brief_violations) == 1
  • assert "add" in brief_violations[0].message.lower()

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_missing_brief_has_fix_hint → check_presence
REQ-DDB-GUARD-005inferredtest_missing_brief_has_fix_hint → check_presence → _is_void_function
Source · 8 lines
    def test_missing_brief_has_fix_hint(self):
        func = _make_func("f", tags={"version": ["1.0"]})
        violations = check_presence([func], "a.c", BASE_CONFIG)
        brief_violations = [v for v in violations if "brief" in v.message.lower()]
        assert len(brief_violations) == 1
        assert "add" in brief_violations[0].message.lower()

Activity · 5 steps
lines 165–165func = _make_func("f", tags={"version": ["1.0"]})lines 166–166violations = check_presence([func], "a.c", BASE_CONFIG)lines 167–167brief_violations = [v for v in violations if "brief" in v.message.lower()]lines 168–168assert len(brief_violations) == 1lines 169–169assert "add" in brief_violations[0].message.lower()

test_missing_doxygen_has_fix_hint

test_guard_checks_extended.TestFixHints.test_missing_doxygen_has_fix_hint(self)

tests/guard/test_guard_checks_extended.py:159

Checks

  • assert any("@brief" in v.message for v in violations)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_missing_doxygen_has_fix_hint → check_presence
REQ-DDB-GUARD-005inferredtest_missing_doxygen_has_fix_hint → check_presence → _is_void_function
Source · 5 lines
    def test_missing_doxygen_has_fix_hint(self):
        func = Function(name="helper", def_line=5, body_end=7, doxygen=None)
        violations = check_presence([func], "a.c", BASE_CONFIG)
        assert any("@brief" in v.message for v in violations)
Activity · 3 steps
lines 160–160func = Function(name="helper", def_line=5, body_end=7, doxygen=None)lines 161–161violations = check_presence([func], "a.c", BASE_CONFIG)lines 162–162assert any("@brief" in v.message for v in violations)

test_no_req_ids_skips

test_guard_checks_extended.TestCheckReqExists.test_no_req_ids_skips(self)

tests/guard/test_guard_checks_extended.py:104

Show on the map →

Called by none

Calls _make_func, check_req_exists

Checks

  • assert len(violations) == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_no_req_ids_skips → check_req_exists
REQ-DDB-GUARD-027inferredtest_no_req_ids_skips → check_req_exists → _uncheckable
Source · 6 lines
    def test_no_req_ids_skips(self):
        func = _make_func("f", tags={"brief": ["d"], "req": ["REQ-001"]})
        violations = check_req_exists(func, "a.c", BASE_CONFIG, req_ids=None)
        assert len(violations) == 0

Activity · 3 steps
lines 105–105func = _make_func("f", tags={"brief": ["d"], "req": ["REQ-001"]})lines 106–106violations = check_req_exists(func, "a.c", BASE_CONFIG, req_ids=None)lines 107–107assert len(violations) == 0

test_python_file_with_complete_block_passes

test_guard_checks_extended.TestCheckFilePresence.test_python_file_with_complete_block_passes(self)

tests/guard/test_guard_checks_extended.py:134

Checks

  • assert len(violations) == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-006measuredtest_python_file_with_complete_block_passes → check_file_presence
REQ-DDB-GUARD-019measuredtest_python_file_with_complete_block_passes → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_python_file_with_complete_block_passes → check_file_presence → _check_file_block_tags → apply_autobrief
Source · 6 lines
    def test_python_file_with_complete_block_passes(self):
        content = "## @file\n## @brief Module.\n## @version 1.0\ndef func(): pass\n"
        config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})
        violations = check_file_presence("a.py", content, config)
        assert len(violations) == 0
Activity · 4 steps
lines 135–135content = "## @file\n## @brief Module.\n## @version 1.0\ndef func(): pass\n"lines 136–136config = deep_merge(BASE_CONFIG, {"validate": {"presence": {"require_file_doxygen": True}}})lines 137–137violations = check_file_presence("a.py", content, config)lines 138–138assert len(violations) == 0

test_retired_tags_can_be_readmitted_via_extra_tags

test_guard_checks_extended.TestCheckUnknownTags.test_retired_tags_can_be_readmitted_via_extra_tags(self)

Migration path for repos still carrying them.

tests/guard/test_guard_checks_extended.py:71

Show on the map →

Called by none

Calls _make_func, check_unknown_tags, deep_merge

Checks

  • assert check_unknown_tags(func, "a.c", config) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_retired_tags_can_be_readmitted_via_extra_tags → check_unknown_tags
Source · 6 lines
    def test_retired_tags_can_be_readmitted_via_extra_tags(self):
        """Migration path for repos still carrying them."""
        config = deep_merge(BASE_CONFIG, {"validate": {"extra_tags": ["participant", "loop"]}})
        func = _make_func("f", tags={"brief": ["d"], "participant": ["E"], "loop": ["E2"]})
        assert check_unknown_tags(func, "a.c", config) == []
Activity · 3 steps
lines 73–73config = deep_merge(BASE_CONFIG, {"validate": {"extra_tags": ["participant", "loop"]}})lines 74–74func = _make_func("f", tags={"brief": ["d"], "participant": ["E"], "loop": ["E2"]})lines 75–75assert check_unknown_tags(func, "a.c", config) == []

test_retired_tracer_tags_are_unknown

test_guard_checks_extended.TestCheckUnknownTags.test_retired_tracer_tags_are_unknown(self)

The diagram tags went with the tracer; a tag the tool cannot act on is unknown.

tests/guard/test_guard_checks_extended.py:59

Show on the map →

Called by none

Calls _make_func, check_unknown_tags

Checks

  • assert len(violations) == 1
  • assert "@participant" in violations[0].message

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_retired_tracer_tags_are_unknown → check_unknown_tags
Source · 12 lines
    def test_retired_tracer_tags_are_unknown(self):
        """The diagram tags went with the tracer; a tag the tool cannot act on is unknown.

        2.0.0 (R5-CFG F10): `@sends` and `@receives` are also EVENT words the index reads (they build
        event edges), so they are known through the shared event vocabulary; a retired tracer tag
        that is not an event word — `@participant` — stays unknown.
        """
        func = _make_func("f", tags={"brief": ["desc"], "participant": ["Bus"]})
        violations = check_unknown_tags(func, "a.c", BASE_CONFIG)
        assert len(violations) == 1
        assert "@participant" in violations[0].message
Activity · 4 steps
lines 66–66func = _make_func("f", tags={"brief": ["desc"], "participant": ["Bus"]})lines 67–67violations = check_unknown_tags(func, "a.c", BASE_CONFIG)lines 68–68assert len(violations) == 1lines 69–69assert "@participant" in violations[0].message

test_stale_req_violation

test_guard_checks_extended.TestCheckReqExists.test_stale_req_violation(self)

tests/guard/test_guard_checks_extended.py:98

Show on the map →

Called by none

Calls _make_func, check_req_exists

Checks

  • assert len(violations) == 1
  • assert "REQ-MISSING" in violations[0].message

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_stale_req_violation → check_req_exists
REQ-DDB-GUARD-027inferredtest_stale_req_violation → check_req_exists → _uncheckable
Source · 6 lines
    def test_stale_req_violation(self):
        func = _make_func("f", tags={"brief": ["d"], "req": ["REQ-MISSING"]})
        violations = check_req_exists(func, "a.c", BASE_CONFIG, req_ids={"REQ-001"})
        assert len(violations) == 1
        assert "REQ-MISSING" in violations[0].message
Activity · 4 steps
lines 99–99func = _make_func("f", tags={"brief": ["d"], "req": ["REQ-MISSING"]})lines 100–100violations = check_req_exists(func, "a.c", BASE_CONFIG, req_ids={"REQ-001"})lines 101–101assert len(violations) == 1lines 102–102assert "REQ-MISSING" in violations[0].message

test_unknown_tag_produces_violation

test_guard_checks_extended.TestCheckUnknownTags.test_unknown_tag_produces_violation(self)

tests/guard/test_guard_checks_extended.py:48

Show on the map →

Called by none

Calls _make_func, check_unknown_tags

Checks

  • assert len(violations) == 1
  • assert "sendd" in violations[0].message

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_unknown_tag_produces_violation → check_unknown_tags
Source · 6 lines
    def test_unknown_tag_produces_violation(self):
        func = _make_func("f", tags={"brief": ["desc"], "sendd": ["EVENT_X"]})
        violations = check_unknown_tags(func, "a.c", BASE_CONFIG)
        assert len(violations) == 1
        assert "sendd" in violations[0].message
Activity · 4 steps
lines 49–49func = _make_func("f", tags={"brief": ["desc"], "sendd": ["EVENT_X"]})lines 50–50violations = check_unknown_tags(func, "a.c", BASE_CONFIG)lines 51–51assert len(violations) == 1lines 52–52assert "sendd" in violations[0].message

test_valid_req_no_violation

test_guard_checks_extended.TestCheckReqExists.test_valid_req_no_violation(self)

tests/guard/test_guard_checks_extended.py:93

Show on the map →

Called by none

Calls _make_func, check_req_exists

Checks

  • assert len(violations) == 0

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-001measuredtest_valid_req_no_violation → check_req_exists
REQ-DDB-GUARD-027inferredtest_valid_req_no_violation → check_req_exists → _uncheckable
Source · 5 lines
    def test_valid_req_no_violation(self):
        func = _make_func("f", tags={"brief": ["d"], "req": ["REQ-001"]})
        violations = check_req_exists(func, "a.c", BASE_CONFIG, req_ids={"REQ-001"})
        assert len(violations) == 0
Activity · 3 steps
lines 94–94func = _make_func("f", tags={"brief": ["d"], "req": ["REQ-001"]})lines 95–95violations = check_req_exists(func, "a.c", BASE_CONFIG, req_ids={"REQ-001"})lines 96–96assert len(violations) == 0