test_guard_config.py

tests/guard/test_guard_config.py

Tests for clew.guard.config (absorbed from doxygen-guard).

test_absolute_path_rejected

test_guard_config.TestValidateOutputPath.test_absolute_path_rejected(self)

tests/guard/test_guard_config.py:313

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measured
REQ-DDB-GUARD-016inferredtest_absolute_path_rejected → validate_output_path → resolve_contained_path
Source · 4 lines
    def test_absolute_path_rejected(self):
        with pytest.raises(ConfigError, match="must be relative"):
            validate_output_path("/etc/cron.d")
Activity · 2 steps
lines 314–314with pytest.raises(ConfigError, match="must be relative")lines 315–315validate_output_path("/etc/cron.d")

test_an_x_key_is_an_unknown_key

test_guard_config.TestNoPassthroughKeys.test_an_x_key_is_an_unknown_key(self)

tests/guard/test_guard_config.py:365

Checks

  • assert len(errors) == 1
  • assert "x-tool" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_an_x_key_is_an_unknown_key → validate_config_schema
Source · 5 lines
    def test_an_x_key_is_an_unknown_key(self):
        errors = validate_config_schema({"x-tool": {}})
        assert len(errors) == 1
        assert "x-tool" in errors[0]
Activity · 3 steps
lines 366–366errors = validate_config_schema({"x-tool": {}})lines 367–367assert len(errors) == 1lines 368–368assert "x-tool" in errors[0]

test_basic

test_guard_config.TestParseVersion.test_basic(self)

tests/guard/test_guard_config.py:272

Checks

  • assert parse_version("v1.8.2") == (1, 8, 2)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measuredtest_basic → parse_version
REQ-DDB-GUARD-022measured
Source · 3 lines
    def test_basic(self):
        assert parse_version("v1.8.2") == (1, 8, 2)
Activity · 1 steps
lines 273–273assert parse_version("v1.8.2") == (1, 8, 2)

test_build_metadata

test_guard_config.TestParseVersion.test_build_metadata(self)

tests/guard/test_guard_config.py:287

Checks

  • assert parse_version("v2.1.0+build123") == (2, 1, 0)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measuredtest_build_metadata → parse_version
Source · 3 lines
    def test_build_metadata(self):
        assert parse_version("v2.1.0+build123") == (2, 1, 0)
Activity · 1 steps
lines 288–288assert parse_version("v2.1.0+build123") == (2, 1, 0)

test_c_file

test_guard_config.TestGetLanguageConfig.test_c_file(self)

tests/guard/test_guard_config.py:174

Checks

  • assert result is not None
  • assert ".c" in result["extensions"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-013measuredtest_c_file → get_language_config
Source · 6 lines
    def test_c_file(self):
        config = CONFIG_DEFAULTS
        result = get_language_config(config, "src/main.c")
        assert result is not None
        assert ".c" in result["extensions"]
Activity · 4 steps
lines 175–175config = CONFIG_DEFAULTSlines 176–176result = get_language_config(config, "src/main.c")lines 177–177assert result is not Nonelines 178–178assert ".c" in result["extensions"]

test_config_error_is_caught_by_except_exception

test_guard_config.TestConfigErrorContract.test_config_error_is_caught_by_except_exception(self, tmp_path)

The whole point of issue #5: SystemExit escaped `except Exception`.

tests/guard/test_guard_config.py:346

Show on the map →

Called by none

Calls _write, load_config

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_config_error_is_caught_by_except_exception → load_config
REQ-DDB-GUARD-014measured
REQ-DDB-GUARD-024inferredtest_config_error_is_caught_by_except_exception → load_config → apply_opt_in_languages
Source · 9 lines
    def test_config_error_is_caught_by_except_exception(self, tmp_path):
        """The whole point of issue #5: SystemExit escaped `except Exception`."""
        config_file = self._write(tmp_path, "bogus_key: 1\n")
        try:
            load_config(config_file)
        except Exception:
            return
        pytest.fail("load_config did not raise a catchable Exception")
Activity · 6 steps
lines 348–348config_file = self._write(tmp_path, "bogus_key: 1\n")lines 349–349trylines 350–350load_config(config_file)lines 351–351except Exceptionlines 352–352returnlines 353–353pytest.fail("load_config did not raise a catchable Exception")

test_cpp_file

test_guard_config.TestGetLanguageConfig.test_cpp_file(self)

tests/guard/test_guard_config.py:186

Checks

  • assert result is not None
  • assert ".cpp" in result["extensions"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-013measuredtest_cpp_file → get_language_config
Source · 6 lines
    def test_cpp_file(self):
        config = CONFIG_DEFAULTS
        result = get_language_config(config, "src/app.cpp")
        assert result is not None
        assert ".cpp" in result["extensions"]
Activity · 4 steps
lines 187–187config = CONFIG_DEFAULTSlines 188–188result = get_language_config(config, "src/app.cpp")lines 189–189assert result is not Nonelines 190–190assert ".cpp" in result["extensions"]

test_custom_tags

test_guard_config.TestLoadConfig.test_custom_tags(self, tmp_path)

tests/guard/test_guard_config.py:95

Show on the map →

Called by none

Calls guard_yaml, load_config

Checks

  • assert "req" in config["validate"]["tags"]
  • assert config["validate"]["tags"]["req"]["pattern"] == r"^REQ-\w+$"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_custom_tags → load_config
REQ-DDB-GUARD-024measuredtest_custom_tags → load_config → apply_opt_in_languages
Source · 16 lines
    def test_custom_tags(self, tmp_path):
        config_file = tmp_path / ".clew.yaml"
        config_file.write_text(
            guard_yaml(
                dedent("""\
                validate:
                  tags:
                    req:
                      pattern: "^REQ-\\\\w+$"
            """)
            )
        )
        config = load_config(config_file)
        assert "req" in config["validate"]["tags"]
        assert config["validate"]["tags"]["req"]["pattern"] == r"^REQ-\w+$"
Activity · 5 steps
lines 96–96config_file = tmp_path / ".clew.yaml"lines 97–106config_file.write_text( guard_yaml( dedent("""\ validate: tags: req: pattern: "^REQ-\\\\w+$" """) ) )lines 107–107config = load_config(config_file)lines 108–108assert "req" in config["validate"]["tags"]lines 109–109assert config["validate"]["tags"]["req"]["pattern"] == r"^REQ-\w+$"

test_empty_config_file_returns_defaults

test_guard_config.TestLoadConfig.test_empty_config_file_returns_defaults(self, tmp_path)

tests/guard/test_guard_config.py:73

Show on the map →

Called by none

Calls guard_yaml, load_config

Checks

  • assert config == CONFIG_DEFAULTS

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_empty_config_file_returns_defaults → load_config
REQ-DDB-GUARD-024inferredtest_empty_config_file_returns_defaults → load_config → apply_opt_in_languages
Source · 6 lines
    def test_empty_config_file_returns_defaults(self, tmp_path):
        config_file = tmp_path / ".clew.yaml"
        config_file.write_text(guard_yaml(""))
        config = load_config(config_file)
        assert config == CONFIG_DEFAULTS
Activity · 4 steps
lines 74–74config_file = tmp_path / ".clew.yaml"lines 75–75config_file.write_text(guard_yaml(""))lines 76–76config = load_config(config_file)lines 77–77assert config == CONFIG_DEFAULTS

test_empty_config_passes

test_guard_config.TestValidateConfigSchema.test_empty_config_passes(self)

tests/guard/test_guard_config.py:206

Checks

  • assert validate_config_schema({}) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_empty_config_passes → validate_config_schema
Source · 3 lines
    def test_empty_config_passes(self):
        assert validate_config_schema({}) == []
Activity · 1 steps
lines 207–207assert validate_config_schema({}) == []

test_every_default_key_is_permitted_by_the_schema

test_guard_config.TestSchemaMatchesImplementation.test_every_default_key_is_permitted_by_the_schema(self)

Anything with a default must be settable, or the default is unreachable.

tests/guard/test_guard_config.py:413

Checks

  • assert errors == [], errors

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_every_default_key_is_permitted_by_the_schema → validate_config_schema
Source · 5 lines
    def test_every_default_key_is_permitted_by_the_schema(self):
        """Anything with a default must be settable, or the default is unreachable."""
        errors = validate_config_schema({"validate": CONFIG_DEFAULTS["validate"]})
        assert errors == [], errors
Activity · 2 steps
lines 415–415errors = validate_config_schema({"validate": CONFIG_DEFAULTS["validate"]})lines 416–416assert errors == [], errors

test_every_documented_presence_key_loads

test_guard_config.TestSchemaMatchesImplementation.test_every_documented_presence_key_loads(self, tmp_path)

tests/guard/test_guard_config.py:406

Show on the map →

Called by none

Calls guard_yaml, load_config

Checks

  • assert config["validate"]["presence"][key] is True, key

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_every_documented_presence_key_loads → load_config
REQ-DDB-GUARD-024measuredtest_every_documented_presence_key_loads → load_config → apply_opt_in_languages
Source · 7 lines
    def test_every_documented_presence_key_loads(self, tmp_path):
        for key in ("require_doxygen", "require_return", "require_file_doxygen"):
            config_file = tmp_path / ".clew.yaml"
            config_file.write_text(guard_yaml(f"validate:\n  presence:\n    {key}: true\n"))
            config = load_config(config_file)
            assert config["validate"]["presence"][key] is True, key
Activity · 5 steps
lines 407–407◇ for key in ("require_doxygen", "require_return", "require_file_doxygen")lines 408–408config_file = tmp_path / ".clew.yaml"lines 409–409config_file.write_text(guard_yaml(f"validate:\n presence:\n {key}: true\n"))lines 410–410config = load_config(config_file)lines 411–411assert config["validate"]["presence"][key] is True, key

test_exclude_patterns

test_guard_config.TestLoadConfig.test_exclude_patterns(self, tmp_path)

tests/guard/test_guard_config.py:154

Show on the map →

Called by none

Calls guard_yaml, load_config

Checks

  • assert config["validate"]["exclude"] == ["re:^gen/", "vendor/"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_exclude_patterns → load_config
REQ-DDB-GUARD-024measuredtest_exclude_patterns → load_config → apply_opt_in_languages
Source · 17 lines
    def test_exclude_patterns(self, tmp_path):
        config_file = tmp_path / ".clew.yaml"
        config_file.write_text(
            guard_yaml(
                dedent("""\
                validate:
                  exclude:
                    - "re:^gen/"
                    - "vendor/"
            """)
            )
        )
        ## 2.0.0 (R5-CFG F18): excludes are globs; a regex is written `re:`.
        config = load_config(config_file)
        assert config["validate"]["exclude"] == ["re:^gen/", "vendor/"]

Activity · 4 steps
lines 155–155config_file = tmp_path / ".clew.yaml"lines 156–165config_file.write_text( guard_yaml( dedent("""\ validate: exclude: - "re:^gen/" - "vendor/" """) ) )lines 167–167config = load_config(config_file)lines 168–168assert config["validate"]["exclude"] == ["re:^gen/", "vendor/"]

test_full_config

test_guard_config.TestLoadConfig.test_full_config(self, tmp_path)

tests/guard/test_guard_config.py:122

Show on the map →

Called by none

Calls guard_yaml, load_config

Checks

  • assert "kotlin" in config["validate"]["languages"]
  • assert config["validate"]["version"]["tag"] == "@ver"
  • assert config["validate"]["exclude"] == ["gen/**"]
  • assert config["impact"]["report_dir"] == "docs/out/"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_full_config → load_config
REQ-DDB-GUARD-024measuredtest_full_config → load_config → apply_opt_in_languages
Source · 26 lines
    def test_full_config(self, tmp_path):
        config_file = tmp_path / ".clew.yaml"
        config_file.write_text(
            guard_yaml(
                dedent("""\
                impact:
                  report_dir: docs/out/
                validate:
                  languages:
                    kotlin:
                      extensions: [.kt]
                      function_pattern: "public\\\\s+\\\\w+"
                      exclude_names: []
                  version:
                    tag: "@ver"
                  exclude:
                    - "gen/**"
            """)
            )
        )
        config = load_config(config_file)
        assert "kotlin" in config["validate"]["languages"]
        assert config["validate"]["version"]["tag"] == "@ver"
        assert config["validate"]["exclude"] == ["gen/**"]
        assert config["impact"]["report_dir"] == "docs/out/"
Activity · 7 steps
lines 123–123config_file = tmp_path / ".clew.yaml"lines 124–141config_file.write_text( guard_yaml( dedent("""\ impact: report_dir: docs/out/ validate: languages: kotlin: extensions: [.kt] function_pattern: "public\\\\s+\\\\w+" exclude_names: [] version: tag: "@ver" exclude: - "gen/**" """) ) )lines 142–142config = load_config(config_file)lines 143–143assert "kotlin" in config["validate"]["languages"]lines 144–144assert config["validate"]["version"]["tag"] == "@ver"lines 145–145assert config["validate"]["exclude"] == ["gen/**"]lines 146–146assert config["impact"]["report_dir"] == "docs/out/"

test_header_file

test_guard_config.TestGetLanguageConfig.test_header_file(self)

tests/guard/test_guard_config.py:180

Checks

  • assert result is not None
  • assert ".h" in result["extensions"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-013measuredtest_header_file → get_language_config
Source · 6 lines
    def test_header_file(self):
        config = CONFIG_DEFAULTS
        result = get_language_config(config, "include/driver.h")
        assert result is not None
        assert ".h" in result["extensions"]
Activity · 4 steps
lines 181–181config = CONFIG_DEFAULTSlines 182–182result = get_language_config(config, "include/driver.h")lines 183–183assert result is not Nonelines 184–184assert ".h" in result["extensions"]

test_impact_section_override

test_guard_config.TestLoadConfig.test_impact_section_override(self, tmp_path)

tests/guard/test_guard_config.py:111

Show on the map →

Called by none

Calls guard_yaml, load_config

Checks

  • assert config["requirements"]["file"] == "reqs.csv"
  • assert config["impact"]["report_dir"] == "out/impact/"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_impact_section_override → load_config
REQ-DDB-GUARD-024measuredtest_impact_section_override → load_config → apply_opt_in_languages
Source · 11 lines
    def test_impact_section_override(self, tmp_path):
        ## 2.0.0 (R5-CFG F7/F9/F14): the key this tested moved; the test follows it.
        config_file = tmp_path / ".clew.yaml"
        config_file.write_text(
            "requirements:\n  file: reqs.csv\n  format: csv\n"
            + guard_yaml("impact:\n  report_dir: out/impact/\n")
        )
        config = load_config(config_file)
        assert config["requirements"]["file"] == "reqs.csv"
        assert config["impact"]["report_dir"] == "out/impact/"
Activity · 5 steps
lines 113–113config_file = tmp_path / ".clew.yaml"lines 114–117config_file.write_text( "requirements:\n file: reqs.csv\n format: csv\n" + guard_yaml("impact:\n report_dir: out/impact/\n") )lines 118–118config = load_config(config_file)lines 119–119assert config["requirements"]["file"] == "reqs.csv"lines 120–120assert config["impact"]["report_dir"] == "out/impact/"

test_invalid_raises

test_guard_config.TestParseVersion.test_invalid_raises(self)

An unparseable version must fail loudly, not sort as (0,).

tests/guard/test_guard_config.py:290

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measuredtest_invalid_raises → parse_version
Source · 12 lines
    def test_invalid_raises(self):
        """An unparseable version must fail loudly, not sort as (0,).

        Returning (0,) made every catalogued requirement compare as not-yet-active,
        which silently disabled the whole @req coverage gate while the run still
        exited 0 — the worst case being a shallow CI clone where "auto:git" resolves
        to nothing.
        """
        with pytest.raises(ConfigError, match="Could not parse version"):
            parse_version("not-a-version")

Activity · 2 steps
lines 298–298with pytest.raises(ConfigError, match="Could not parse version")lines 299–299parse_version("not-a-version")

test_language_dicts_are_deep_copied

test_guard_config.TestDefaultsAreNotAliased.test_language_dicts_are_deep_copied(self, tmp_path)

tests/guard/test_guard_config.py:466

Show on the map →

Called by none

Calls load_config

Checks

  • assert ".leaked" not in CONFIG_DEFAULTS["validate"]["languages"]["c"]["extensions"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_language_dicts_are_deep_copied → load_config
REQ-DDB-GUARD-024inferredtest_language_dicts_are_deep_copied → load_config → apply_opt_in_languages
Source · 4 lines
    def test_language_dicts_are_deep_copied(self, tmp_path):
        config = load_config(tmp_path / "nonexistent.yaml")
        config["validate"]["languages"]["c"]["extensions"].append(".leaked")
        assert ".leaked" not in CONFIG_DEFAULTS["validate"]["languages"]["c"]["extensions"]

1 more lines, not shown

Activity · 3 steps
lines 467–467config = load_config(tmp_path / "nonexistent.yaml")lines 468–468config["validate"]["languages"]["c"]["extensions"].append(".leaked")lines 469–469assert ".leaked" not in CONFIG_DEFAULTS["validate"]["languages"]["c"]["extensions"]

test_mid_path_traversal_rejected

test_guard_config.TestValidateOutputPath.test_mid_path_traversal_rejected(self)

tests/guard/test_guard_config.py:321

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measured
REQ-DDB-GUARD-016inferredtest_mid_path_traversal_rejected → validate_output_path → resolve_contained_path
Source · 5 lines
    def test_mid_path_traversal_rejected(self):
        with pytest.raises(ConfigError, match="directory traversal"):
            validate_output_path("docs/../../etc")

Activity · 2 steps
lines 322–322with pytest.raises(ConfigError, match="directory traversal")lines 323–323validate_output_path("docs/../../etc")

test_multiple_errors

test_guard_config.TestValidateConfigSchema.test_multiple_errors(self)

tests/guard/test_guard_config.py:264

Checks

  • assert len(errors) == 2

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_multiple_errors → validate_config_schema
Source · 5 lines
    def test_multiple_errors(self):
        errors = validate_config_schema({"bogus1": 1, "bogus2": 2})
        assert len(errors) == 2

Activity · 2 steps
lines 265–265errors = validate_config_schema({"bogus1": 1, "bogus2": 2})lines 266–266assert len(errors) == 2

test_mutating_a_loaded_config_does_not_touch_the_defaults

test_guard_config.TestDefaultsAreNotAliased.test_mutating_a_loaded_config_does_not_touch_the_defaults(self, tmp_path)

tests/guard/test_guard_config.py:452

Checks

  • assert CONFIG_DEFAULTS["validate"]["exclude"] == before
  • assert "_resolved" not in CONFIG_DEFAULTS["validate"].get("version_gate", {})

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_mutating_a_loaded_config_does_not_touch_the_defaults → load_config
REQ-DDB-GUARD-024inferredtest_mutating_a_loaded_config_does_not_touch_the_defaults → load_config → apply_opt_in_languages
Source · 8 lines
    def test_mutating_a_loaded_config_does_not_touch_the_defaults(self, tmp_path):
        before = list(CONFIG_DEFAULTS["validate"]["exclude"])
        config = load_config(tmp_path / "nonexistent.yaml")
        config["validate"]["exclude"].append("^leaked/")
        config["validate"].setdefault("version_gate", {})["_resolved"] = "v9.9.9"
        assert CONFIG_DEFAULTS["validate"]["exclude"] == before
        assert "_resolved" not in CONFIG_DEFAULTS["validate"].get("version_gate", {})
Activity · 6 steps
lines 453–453before = list(CONFIG_DEFAULTS["validate"]["exclude"])lines 454–454config = load_config(tmp_path / "nonexistent.yaml")lines 455–455config["validate"]["exclude"].append("^leaked/")lines 456–456config["validate"].setdefault("version_gate", {})["_resolved"] = "v9.9.9"lines 457–457assert CONFIG_DEFAULTS["validate"]["exclude"] == beforelines 458–458assert "_resolved" not in CONFIG_DEFAULTS["validate"].get("version_gate", {})

test_nested_relative_passes

test_guard_config.TestValidateOutputPath.test_nested_relative_passes(self)

tests/guard/test_guard_config.py:309

Checks

  • assert len(result.parts) == 3

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-016measuredtest_nested_relative_passes → validate_output_path → resolve_contained_path
Source · 4 lines
    def test_nested_relative_passes(self):
        result = validate_output_path("docs/generated/sequences")
        assert len(result.parts) == 3
Activity · 2 steps
lines 310–310result = validate_output_path("docs/generated/sequences")lines 311–311assert len(result.parts) == 3

test_nested_sections_are_independent_objects

test_guard_config.TestDefaultsAreNotAliased.test_nested_sections_are_independent_objects(self, tmp_path)

tests/guard/test_guard_config.py:447

Show on the map →

Called by none

Calls load_config

Checks

  • assert config["validate"] is not CONFIG_DEFAULTS["validate"]
  • assert config["impact"] is not CONFIG_DEFAULTS["impact"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_nested_sections_are_independent_objects → load_config
REQ-DDB-GUARD-024inferredtest_nested_sections_are_independent_objects → load_config → apply_opt_in_languages
Source · 5 lines
    def test_nested_sections_are_independent_objects(self, tmp_path):
        config = load_config(tmp_path / "nonexistent.yaml")
        assert config["validate"] is not CONFIG_DEFAULTS["validate"]
        assert config["impact"] is not CONFIG_DEFAULTS["impact"]
Activity · 3 steps
lines 448–448config = load_config(tmp_path / "nonexistent.yaml")lines 449–449assert config["validate"] is not CONFIG_DEFAULTS["validate"]lines 450–450assert config["impact"] is not CONFIG_DEFAULTS["impact"]

test_no_config_file_returns_defaults

test_guard_config.TestLoadConfig.test_no_config_file_returns_defaults(self, tmp_path)

tests/guard/test_guard_config.py:69

Show on the map →

Called by none

Calls load_config

Checks

  • assert config == CONFIG_DEFAULTS

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_no_config_file_returns_defaults → load_config
REQ-DDB-GUARD-024inferredtest_no_config_file_returns_defaults → load_config → apply_opt_in_languages
Source · 4 lines
    def test_no_config_file_returns_defaults(self, tmp_path):
        config = load_config(tmp_path / "nonexistent.yaml")
        assert config == CONFIG_DEFAULTS
Activity · 2 steps
lines 70–70config = load_config(tmp_path / "nonexistent.yaml")lines 71–71assert config == CONFIG_DEFAULTS

test_no_extension

test_guard_config.TestGetLanguageConfig.test_no_extension(self)

tests/guard/test_guard_config.py:197

Checks

  • assert result is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-013measuredtest_no_extension → get_language_config
Source · 6 lines
    def test_no_extension(self):
        config = CONFIG_DEFAULTS
        result = get_language_config(config, "Makefile")
        assert result is None

Activity · 3 steps
lines 198–198config = CONFIG_DEFAULTSlines 199–199result = get_language_config(config, "Makefile")lines 200–200assert result is None

test_no_prefix

test_guard_config.TestParseVersion.test_no_prefix(self)

tests/guard/test_guard_config.py:275

Checks

  • assert parse_version("1.8.2") == (1, 8, 2)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measuredtest_no_prefix → parse_version
Source · 3 lines
    def test_no_prefix(self):
        assert parse_version("1.8.2") == (1, 8, 2)
Activity · 1 steps
lines 276–276assert parse_version("1.8.2") == (1, 8, 2)

test_no_suggestion_when_nothing_is_close

test_guard_config.TestDidYouMean.test_no_suggestion_when_nothing_is_close(self)

tests/guard/test_guard_config.py:391

Checks

  • assert "did you mean" not in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_no_suggestion_when_nothing_is_close → validate_config_schema
Source · 5 lines
    def test_no_suggestion_when_nothing_is_close(self):
        errors = validate_config_schema({"zzzzzzzz": {}})
        assert "did you mean" not in errors[0]

Activity · 2 steps
lines 392–392errors = validate_config_schema({"zzzzzzzz": {}})lines 393–393assert "did you mean" not in errors[0]

test_non_dict_where_dict_expected

test_guard_config.TestValidateConfigSchema.test_non_dict_where_dict_expected(self)

tests/guard/test_guard_config.py:259

Checks

  • assert len(errors) == 1
  • assert "expected dict" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_non_dict_where_dict_expected → validate_config_schema
Source · 5 lines
    def test_non_dict_where_dict_expected(self):
        errors = validate_config_schema({"validate": "garbage"})
        assert len(errors) == 1
        assert "expected dict" in errors[0]
Activity · 3 steps
lines 260–260errors = validate_config_schema({"validate": "garbage"})lines 261–261assert len(errors) == 1lines 262–262assert "expected dict" in errors[0]

test_non_mapping_config_returns_defaults

test_guard_config.TestLoadConfig.test_non_mapping_config_returns_defaults(self, tmp_path)

tests/guard/test_guard_config.py:148

Show on the map →

Called by none

Calls load_config

Checks

  • assert config == CONFIG_DEFAULTS

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_non_mapping_config_returns_defaults → load_config
REQ-DDB-GUARD-024inferredtest_non_mapping_config_returns_defaults → load_config → apply_opt_in_languages
Source · 6 lines
    def test_non_mapping_config_returns_defaults(self, tmp_path):
        config_file = tmp_path / ".clew.yaml"
        config_file.write_text("just a string")
        config = load_config(config_file)
        assert config == CONFIG_DEFAULTS
Activity · 4 steps
lines 149–149config_file = tmp_path / ".clew.yaml"lines 150–150config_file.write_text("just a string")lines 151–151config = load_config(config_file)lines 152–152assert config == CONFIG_DEFAULTS

test_open_dict_allows_custom_languages

test_guard_config.TestValidateConfigSchema.test_open_dict_allows_custom_languages(self)

tests/guard/test_guard_config.py:234

Checks

  • assert errors == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_open_dict_allows_custom_languages → validate_config_schema
Source · 6 lines
    def test_open_dict_allows_custom_languages(self):
        errors = validate_config_schema(
            {"validate": {"languages": {"rust": {"extensions": [".rs"]}}}}
        )
        assert errors == []
Activity · 2 steps
lines 235–237errors = validate_config_schema( {"validate": {"languages": {"rust": {"extensions": [".rs"]}}}} )lines 238–238assert errors == []

test_open_dict_allows_custom_tags

test_guard_config.TestValidateConfigSchema.test_open_dict_allows_custom_tags(self)

tests/guard/test_guard_config.py:240

Checks

  • assert errors == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_open_dict_allows_custom_tags → validate_config_schema
Source · 4 lines
    def test_open_dict_allows_custom_tags(self):
        errors = validate_config_schema({"validate": {"tags": {"custom_tag": {"pattern": ".*"}}}})
        assert errors == []
Activity · 2 steps
lines 241–241errors = validate_config_schema({"validate": {"tags": {"custom_tag": {"pattern": ".*"}}}})lines 242–242assert errors == []

test_partial_validate_override

test_guard_config.TestLoadConfig.test_partial_validate_override(self, tmp_path)

tests/guard/test_guard_config.py:79

Show on the map →

Called by none

Calls guard_yaml, load_config

Checks

  • assert config["validate"]["presence"]["require_doxygen"] is False
  • assert "c" in config["validate"]["languages"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_partial_validate_override → load_config
REQ-DDB-GUARD-024measuredtest_partial_validate_override → load_config → apply_opt_in_languages
Source · 16 lines
    def test_partial_validate_override(self, tmp_path):
        config_file = tmp_path / ".clew.yaml"
        config_file.write_text(
            guard_yaml(
                dedent("""\
                validate:
                  presence:
                    require_doxygen: false
            """)
            )
        )
        config = load_config(config_file)
        assert config["validate"]["presence"]["require_doxygen"] is False
        # Other defaults preserved
        assert "c" in config["validate"]["languages"]
Activity · 5 steps
lines 80–80config_file = tmp_path / ".clew.yaml"lines 81–89config_file.write_text( guard_yaml( dedent("""\ validate: presence: require_doxygen: false """) ) )lines 90–90config = load_config(config_file)lines 91–91assert config["validate"]["presence"]["require_doxygen"] is Falselines 93–93assert "c" in config["validate"]["languages"]

test_prerelease_version

test_guard_config.TestParseVersion.test_prerelease_version(self)

tests/guard/test_guard_config.py:284

Checks

  • assert parse_version("v1.0.0-rc1") == (1, 0, 0)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measuredtest_prerelease_version → parse_version
Source · 3 lines
    def test_prerelease_version(self):
        assert parse_version("v1.0.0-rc1") == (1, 0, 0)
Activity · 1 steps
lines 285–285assert parse_version("v1.0.0-rc1") == (1, 0, 0)

test_relative_path_passes

test_guard_config.TestValidateOutputPath.test_relative_path_passes(self)

tests/guard/test_guard_config.py:305

Checks

  • assert result.parts[0] == "docs"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-016measuredtest_relative_path_passes → validate_output_path → resolve_contained_path
Source · 4 lines
    def test_relative_path_passes(self):
        result = validate_output_path("docs/generated/")
        assert result.parts[0] == "docs"
Activity · 2 steps
lines 306–306result = validate_output_path("docs/generated/")lines 307–307assert result.parts[0] == "docs"

test_removed_trace_section_rejected

test_guard_config.TestValidateConfigSchema.test_removed_trace_section_rejected(self)

tests/guard/test_guard_config.py:244

Checks

  • assert len(errors) == 1
  • assert "trace" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_removed_trace_section_rejected → validate_config_schema
Source · 5 lines
    def test_removed_trace_section_rejected(self):
        errors = validate_config_schema({"trace": {"format": "plantuml"}})
        assert len(errors) == 1
        assert "trace" in errors[0]
Activity · 3 steps
lines 245–245errors = validate_config_schema({"trace": {"format": "plantuml"}})lines 246–246assert len(errors) == 1lines 247–247assert "trace" in errors[0]

test_schema_leaves_round_trip_through_load_config

test_guard_config.TestSchemaMatchesImplementation.test_schema_leaves_round_trip_through_load_config(self, tmp_path)

Every scalar schema leaf under validate.* must survive load_config.

tests/guard/test_guard_config.py:418

Show on the map →

Called by none

Calls guard_yaml, load_config

Checks

  • assert scalars, "expected scalar leaves under validate.*"
  • assert config["validate"][key] == sample[kind], key

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_schema_leaves_round_trip_through_load_config → load_config
REQ-DDB-GUARD-024measuredtest_schema_leaves_round_trip_through_load_config → load_config → apply_opt_in_languages
Source · 20 lines
    def test_schema_leaves_round_trip_through_load_config(self, tmp_path):
        """Every scalar schema leaf under validate.* must survive load_config.

        Guards the drift class directly: a schema key with no default, or a default
        with no schema key, is caught here rather than by a user hitting it.
        """
        import yaml as _yaml

        from clew.guard.config import CONFIG_SCHEMA

        scalars = {k: v for k, v in CONFIG_SCHEMA["validate"].items() if v in (bool, str, list)}
        sample = {bool: True, str: "x", list: []}
        assert scalars, "expected scalar leaves under validate.*"
        for key, kind in scalars.items():
            config_file = tmp_path / ".clew.yaml"
            config_file.write_text(guard_yaml(_yaml.safe_dump({"validate": {key: sample[kind]}})))
            config = load_config(config_file)
            assert config["validate"][key] == sample[kind], key

Activity · 10 steps
lines 424–424import yaml as _yamllines 426–426from clew.guard.config import CONFIG_SCHEMAlines 428–428scalars = {k: v for k, v in CONFIG_SCHEMA["validate"].items() if v in (bool, str, list)}lines 429–429sample = {bool: True, str: "x", list: []}lines 430–430assert scalars, "expected scalar leaves under validate.*"lines 431–431◇ for key, kind in scalars.items()lines 432–432config_file = tmp_path / ".clew.yaml"lines 433–433config_file.write_text(guard_yaml(_yaml.safe_dump({"validate": {key: sample[kind]}})))lines 434–434config = load_config(config_file)lines 435–435assert config["validate"][key] == sample[kind], key

test_single_part

test_guard_config.TestParseVersion.test_single_part(self)

tests/guard/test_guard_config.py:281

Checks

  • assert parse_version("v3") == (3,)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measuredtest_single_part → parse_version
Source · 3 lines
    def test_single_part(self):
        assert parse_version("v3") == (3,)
Activity · 1 steps
lines 282–282assert parse_version("v3") == (3,)

test_stale_test_mapping_rejected

test_guard_config.TestValidateConfigSchema.test_stale_test_mapping_rejected(self)

tests/guard/test_guard_config.py:249

Checks

  • assert len(errors) == 1
  • assert "test_mapping" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_stale_test_mapping_rejected → validate_config_schema
Source · 5 lines
    def test_stale_test_mapping_rejected(self):
        errors = validate_config_schema({"impact": {"test_mapping": []}})
        assert len(errors) == 1
        assert "test_mapping" in errors[0]
Activity · 3 steps
lines 250–250errors = validate_config_schema({"impact": {"test_mapping": []}})lines 251–251assert len(errors) == 1lines 252–252assert "test_mapping" in errors[0]

test_suggests_close_nested_key

test_guard_config.TestDidYouMean.test_suggests_close_nested_key(self)

tests/guard/test_guard_config.py:387

Checks

  • assert "did you mean 'exclude'?" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_suggests_close_nested_key → validate_config_schema
Source · 4 lines
    def test_suggests_close_nested_key(self):
        errors = validate_config_schema({"validate": {"exclud": []}})
        assert "did you mean 'exclude'?" in errors[0]
Activity · 2 steps
lines 388–388errors = validate_config_schema({"validate": {"exclud": []}})lines 389–389assert "did you mean 'exclude'?" in errors[0]

test_suggests_close_top_level_key

test_guard_config.TestDidYouMean.test_suggests_close_top_level_key(self)

tests/guard/test_guard_config.py:383

Checks

  • assert "did you mean 'validate'?" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_suggests_close_top_level_key → validate_config_schema
Source · 4 lines
    def test_suggests_close_top_level_key(self):
        errors = validate_config_schema({"validat": {}})
        assert "did you mean 'validate'?" in errors[0]
Activity · 2 steps
lines 384–384errors = validate_config_schema({"validat": {}})lines 385–385assert "did you mean 'validate'?" in errors[0]

test_the_rest_of_clew_yaml_is_not_the_gates

test_guard_config.TestNoPassthroughKeys.test_the_rest_of_clew_yaml_is_not_the_gates(self, tmp_path)

tests/guard/test_guard_config.py:370

Show on the map →

Called by none

Calls guard_yaml, load_config

Checks

  • assert config["impact"]["report_dir"] == "o/"
  • assert "index_scope" not in config

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_the_rest_of_clew_yaml_is_not_the_gates → load_config
REQ-DDB-GUARD-024measuredtest_the_rest_of_clew_yaml_is_not_the_gates → load_config → apply_opt_in_languages
Source · 10 lines
    def test_the_rest_of_clew_yaml_is_not_the_gates(self, tmp_path):
        config_file = tmp_path / ".clew.yaml"
        config_file.write_text(
            "index_scope:\n  roots: [src]\n" + guard_yaml("impact:\n  report_dir: o/\n")
        )
        config = load_config(config_file)
        assert config["impact"]["report_dir"] == "o/"
        assert "index_scope" not in config

Activity · 5 steps
lines 371–371config_file = tmp_path / ".clew.yaml"lines 372–374config_file.write_text( "index_scope:\n roots: [src]\n" + guard_yaml("impact:\n report_dir: o/\n") )lines 375–375config = load_config(config_file)lines 376–376assert config["impact"]["report_dir"] == "o/"lines 377–377assert "index_scope" not in config

test_traversal_rejected

test_guard_config.TestValidateOutputPath.test_traversal_rejected(self)

tests/guard/test_guard_config.py:317

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measured
REQ-DDB-GUARD-016inferredtest_traversal_rejected → validate_output_path → resolve_contained_path
Source · 4 lines
    def test_traversal_rejected(self):
        with pytest.raises(ConfigError, match="directory traversal"):
            validate_output_path("../outside")
Activity · 2 steps
lines 318–318with pytest.raises(ConfigError, match="directory traversal")lines 319–319validate_output_path("../outside")

test_two_loads_are_independent

test_guard_config.TestDefaultsAreNotAliased.test_two_loads_are_independent(self, tmp_path)

tests/guard/test_guard_config.py:460

Show on the map →

Called by none

Calls load_config

Checks

  • assert "^from-first/" not in second["validate"]["exclude"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_two_loads_are_independent → load_config
REQ-DDB-GUARD-024inferredtest_two_loads_are_independent → load_config → apply_opt_in_languages
Source · 6 lines
    def test_two_loads_are_independent(self, tmp_path):
        first = load_config(tmp_path / "nonexistent.yaml")
        first["validate"]["exclude"].append("^from-first/")
        second = load_config(tmp_path / "nonexistent.yaml")
        assert "^from-first/" not in second["validate"]["exclude"]
Activity · 4 steps
lines 461–461first = load_config(tmp_path / "nonexistent.yaml")lines 462–462first["validate"]["exclude"].append("^from-first/")lines 463–463second = load_config(tmp_path / "nonexistent.yaml")lines 464–464assert "^from-first/" not in second["validate"]["exclude"]

test_two_parts

test_guard_config.TestParseVersion.test_two_parts(self)

tests/guard/test_guard_config.py:278

Checks

  • assert parse_version("v1.0") == (1, 0)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-014measuredtest_two_parts → parse_version
Source · 3 lines
    def test_two_parts(self):
        assert parse_version("v1.0") == (1, 0)
Activity · 1 steps
lines 279–279assert parse_version("v1.0") == (1, 0)

test_unknown_extension

test_guard_config.TestGetLanguageConfig.test_unknown_extension(self)

tests/guard/test_guard_config.py:192

Checks

  • assert result is None

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-013measuredtest_unknown_extension → get_language_config
REQ-DDB-GUARD-020measured
Source · 5 lines
    def test_unknown_extension(self):
        config = CONFIG_DEFAULTS
        result = get_language_config(config, "script.rs")
        assert result is None
Activity · 3 steps
lines 193–193config = CONFIG_DEFAULTSlines 194–194result = get_language_config(config, "script.rs")lines 195–195assert result is None

test_unknown_key_raises_config_error

test_guard_config.TestConfigErrorContract.test_unknown_key_raises_config_error(self, tmp_path)

tests/guard/test_guard_config.py:334

Show on the map →

Called by none

Calls _write, load_config

Checks

  • assert any("shared_key_patterns" in p for p in exc.value.problems)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_unknown_key_raises_config_error → load_config
REQ-DDB-GUARD-014measured
REQ-DDB-GUARD-024inferredtest_unknown_key_raises_config_error → load_config → apply_opt_in_languages
Source · 12 lines
    def test_unknown_key_raises_config_error(self, tmp_path):
        config_file = self._write(
            tmp_path,
            """\
            shared_key_patterns:
              - foo
        """,
        )
        with pytest.raises(ConfigError) as exc:
            load_config(config_file)
        assert any("shared_key_patterns" in p for p in exc.value.problems)
Activity · 4 steps
lines 335–341config_file = self._write( tmp_path, """\ shared_key_patterns: - foo """, )lines 342–342with pytest.raises(ConfigError) as exclines 343–343load_config(config_file)lines 344–344assert any("shared_key_patterns" in p for p in exc.value.problems)

test_unknown_nested_key

test_guard_config.TestValidateConfigSchema.test_unknown_nested_key(self)

tests/guard/test_guard_config.py:218

Checks

  • assert len(errors) == 1
  • assert "validate.bogus" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_unknown_nested_key → validate_config_schema
Source · 5 lines
    def test_unknown_nested_key(self):
        errors = validate_config_schema({"validate": {"bogus": 1}})
        assert len(errors) == 1
        assert "validate.bogus" in errors[0]
Activity · 3 steps
lines 219–219errors = validate_config_schema({"validate": {"bogus": 1}})lines 220–220assert len(errors) == 1lines 221–221assert "validate.bogus" in errors[0]

test_unknown_top_level_key

test_guard_config.TestValidateConfigSchema.test_unknown_top_level_key(self)

tests/guard/test_guard_config.py:213

Checks

  • assert len(errors) == 1
  • assert "bogus" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_unknown_top_level_key → validate_config_schema
Source · 5 lines
    def test_unknown_top_level_key(self):
        errors = validate_config_schema({"bogus": 1})
        assert len(errors) == 1
        assert "bogus" in errors[0]
Activity · 3 steps
lines 214–214errors = validate_config_schema({"bogus": 1})lines 215–215assert len(errors) == 1lines 216–216assert "bogus" in errors[0]

test_unreadable_yaml_raises_config_error

test_guard_config.TestConfigErrorContract.test_unreadable_yaml_raises_config_error(self, tmp_path)

tests/guard/test_guard_config.py:355

Show on the map →

Called by none

Calls _write, load_config

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_unreadable_yaml_raises_config_error → load_config
REQ-DDB-GUARD-014measured
REQ-DDB-GUARD-024inferredtest_unreadable_yaml_raises_config_error → load_config → apply_opt_in_languages
Source · 6 lines
    def test_unreadable_yaml_raises_config_error(self, tmp_path):
        config_file = self._write(tmp_path, "validate: [unclosed\n")
        with pytest.raises(ConfigError):
            load_config(config_file)

Activity · 3 steps
lines 356–356config_file = self._write(tmp_path, "validate: [unclosed\n")lines 357–357with pytest.raises(ConfigError)lines 358–358load_config(config_file)

test_valid_output_dir

test_guard_config.TestValidateConfigSchema.test_valid_output_dir(self)

tests/guard/test_guard_config.py:209

Checks

  • assert validate_config_schema({"impact": {"report_dir": "docs/"}}) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_valid_output_dir → validate_config_schema
Source · 4 lines
    def test_valid_output_dir(self):
        ## 2.0.0 (R5-CFG F7/F9/F14): the key this tested moved; the test follows it.
        assert validate_config_schema({"impact": {"report_dir": "docs/"}}) == []
Activity · 1 steps
lines 211–211assert validate_config_schema({"impact": {"report_dir": "docs/"}}) == []

test_version_gate_accepted

test_guard_config.TestValidateConfigSchema.test_version_gate_accepted(self)

tests/guard/test_guard_config.py:254

Checks

  • assert errors == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_version_gate_accepted → validate_config_schema
Source · 5 lines
    def test_version_gate_accepted(self):
        ## 2.0.0 (R5-CFG F7/F9/F14): the key this tested moved; the test follows it.
        errors = validate_config_schema({"validate": {"current_version": "v1.0"}})
        assert errors == []
Activity · 2 steps
lines 256–256errors = validate_config_schema({"validate": {"current_version": "v1.0"}})lines 257–257assert errors == []

test_wrong_type_bool

test_guard_config.TestValidateConfigSchema.test_wrong_type_bool(self)

tests/guard/test_guard_config.py:229

Checks

  • assert len(errors) == 1
  • assert "expected bool" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_wrong_type_bool → validate_config_schema
Source · 5 lines
    def test_wrong_type_bool(self):
        errors = validate_config_schema({"validate": {"presence": {"require_doxygen": "yes"}}})
        assert len(errors) == 1
        assert "expected bool" in errors[0]
Activity · 3 steps
lines 230–230errors = validate_config_schema({"validate": {"presence": {"require_doxygen": "yes"}}})lines 231–231assert len(errors) == 1lines 232–232assert "expected bool" in errors[0]

test_wrong_type_string

test_guard_config.TestValidateConfigSchema.test_wrong_type_string(self)

tests/guard/test_guard_config.py:223

Checks

  • assert len(errors) == 1
  • assert "expected str" in errors[0]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_wrong_type_string → validate_config_schema
Source · 6 lines
    def test_wrong_type_string(self):
        ## 2.0.0 (R5-CFG F7/F9/F14): the key this tested moved; the test follows it.
        errors = validate_config_schema({"impact": {"report_dir": 123}})
        assert len(errors) == 1
        assert "expected str" in errors[0]
Activity · 3 steps
lines 225–225errors = validate_config_schema({"impact": {"report_dir": 123}})lines 226–226assert len(errors) == 1lines 227–227assert "expected str" in errors[0]