
def test_can_define_new_format() -> None:
    def my_format_validator(value: str) -> str:
        if value == "valid value":
            return value

        raise ValueError()

    with pytest.raises(KeyError):
        validate_string_format("valid value", "my-format")

    StringFormat["my-format"] = my_format_validator

    assert validate_string_format("valid value", "my-format")