diff --git a/src/ytdl_sub/script/script.py b/src/ytdl_sub/script/script.py index 2a2b592a..786d7645 100644 --- a/src/ytdl_sub/script/script.py +++ b/src/ytdl_sub/script/script.py @@ -62,6 +62,8 @@ class Script: self._ensure_no_cycle( name=variable_name, dep=dep.name, deps=deps, definitions=self._variables ) + if dep.name not in self._variables: + print("h") self._traverse_variable_dependencies( variable_name=variable_name, variable_dependency=self._variables[dep.name], diff --git a/src/ytdl_sub/validators/string_formatter_validators.py b/src/ytdl_sub/validators/string_formatter_validators.py index 7d7dce9a..9d73bbb1 100644 --- a/src/ytdl_sub/validators/string_formatter_validators.py +++ b/src/ytdl_sub/validators/string_formatter_validators.py @@ -251,14 +251,6 @@ def _validate_formatter( variable_names = {var.name for var in parsed.variables} custom_function_names = {f"%{func.name}" for func in parsed.custom_functions} - if resolve_partial and not is_static_formatter: - formatter_hash = get_md5_hash(formatter_validator.format_string) - - parsed = mock_script.resolve_partial_once( - variable_definitions={formatter_hash: formatter_validator.parsed}, - unresolvable=unresolved_variables, - )[formatter_hash] - # Add lambda functions to custom function names, if it's custom for lambda_func in parsed.lambdas: if lambda_func in mock_script.function_names: @@ -279,6 +271,15 @@ def _validate_formatter( "contains the following variables that are unresolved when executing this " f"formatter: {', '.join(sorted(unresolved))}" ) + + if resolve_partial and not is_static_formatter: + formatter_hash = get_md5_hash(formatter_validator.format_string) + + parsed = mock_script.resolve_partial_once( + variable_definitions={formatter_hash: formatter_validator.parsed}, + unresolvable=unresolved_variables, + )[formatter_hash] + try: if is_static_formatter: return mock_script.resolve_once_parsed( diff --git a/tests/resources.py b/tests/resources.py index 4a2b9e71..a327be02 100644 --- a/tests/resources.py +++ b/tests/resources.py @@ -5,7 +5,7 @@ from pathlib import Path from typing import Dict DISABLE_YOUTUBE_TESTS: bool = True -REGENERATE_FIXTURES: bool = True +REGENERATE_FIXTURES: bool = False RESOURCE_PATH: Path = Path("tests") / "resources" _FILE_FIXTURE_PATH: Path = RESOURCE_PATH / "file_fixtures"