diff --git a/src/ytdl_sub/downloaders/url/validators.py b/src/ytdl_sub/downloaders/url/validators.py index 4a22789b..bafe846a 100644 --- a/src/ytdl_sub/downloaders/url/validators.py +++ b/src/ytdl_sub/downloaders/url/validators.py @@ -263,7 +263,7 @@ class MultiUrlValidator(OptionsValidator): if unresolved := used_variables & unresolved_variables: raise self._validation_exception( f"variable {variable_name} cannot use the variables " - f"{', '.join(sorted(list(unresolved)))} because they depend on other" + f"{', '.join(sorted(list(unresolved)))} because it depends on other" " variables that are computed later in execution" ) diff --git a/tests/unit/config/test_preset.py b/tests/unit/config/test_preset.py index c3273787..239a46c6 100644 --- a/tests/unit/config/test_preset.py +++ b/tests/unit/config/test_preset.py @@ -333,3 +333,26 @@ class TestPreset: "overrides": {"the_bad_one": "ack"}, }, ) + + def test_preset_error_added_url_variable_cannot_resolve(self, config_file, output_options): + with pytest.raises( + ValidationException, + match=re.escape( + "variable the_bad_one cannot use the variables subtitles_ext because it " + "depends on other variables that are computed later in execution" + ), + ): + _ = Preset( + config=config_file, + name="test", + value={ + "download": { + "url": "youtube.com/watch?v=123abc", + "variables": {"the_bad_one": "{subtitles_ext}"}, + }, + "subtitles": { + "embed_subtitles": True, + }, + "output_options": {"output_directory": "dir", "file_name": "acjk"}, + }, + )