def test_example(config): cz = CustomizeCommitsCz(config) assert "feature: this feature eanable customize through config file" in cz.example( )
def test_schema(config): cz = CustomizeCommitsCz(config) assert "<type>: <body>" in cz.schema()
def test_initialize_cz_customize_failed(): with pytest.raises(MissingCzCustomizeConfigError) as excinfo: config = BaseConfig() _ = CustomizeCommitsCz(config) assert MissingCzCustomizeConfigError.message in str(excinfo.value)
def test_bump_pattern(config): cz = CustomizeCommitsCz(config) assert cz.bump_pattern == "^(break|new|fix|hotfix)"
def test_change_type_map(config): cz = CustomizeCommitsCz(config) assert cz.change_type_map == {"feature": "Feat", "bug fix": "Fix"}
def test_info(config): cz = CustomizeCommitsCz(config) assert "This is a customized cz." in cz.info()
def test_changelog_pattern(config): cz = CustomizeCommitsCz(config) assert cz.changelog_pattern == "^(feature|bug fix)?(!)?"
def test_commit_parser(config): cz = CustomizeCommitsCz(config) assert cz.commit_parser == "^(?P<change_type>feature|bug fix):\\s(?P<message>.*)?"
def test_info_without_info(config_without_info): cz = CustomizeCommitsCz(config_without_info) assert cz.info() is None
def test_schema_pattern(config): cz = CustomizeCommitsCz(config) assert r"(feature|bug fix):(\s.*)" in cz.schema_pattern()
def test_initialize_cz_customize_failed(): with pytest.raises(SystemExit) as excinfo: config = BaseConfig() _ = CustomizeCommitsCz(config) assert excinfo.value.code == MISSING_CONFIG