diff --git a/src/ytdl_sub/script/types/function.py b/src/ytdl_sub/script/types/function.py index 73ce1ef8..3f7bbde5 100644 --- a/src/ytdl_sub/script/types/function.py +++ b/src/ytdl_sub/script/types/function.py @@ -31,7 +31,6 @@ from ytdl_sub.script.utils.exceptions import FunctionRuntimeException from ytdl_sub.script.utils.exceptions import UserThrownRuntimeError from ytdl_sub.script.utils.type_checking import FunctionInputSpec from ytdl_sub.script.utils.type_checking import is_union -from ytdl_sub.utils.exceptions import StringFormattingException @dataclass(frozen=True) @@ -56,7 +55,8 @@ class CustomFunction(Function, NamedCustomFunction): if self.name in custom_functions: if len(self.args) != len(custom_functions[self.name].function_arguments): - raise StringFormattingException("Custom function arg length does not equal") + # Should be validated in the Script + raise UNREACHABLE resolved_variables_with_args = copy.deepcopy(resolved_variables) for i, arg in enumerate(resolved_args): @@ -97,7 +97,8 @@ class BuiltInFunction(Function, TypeHintedFunctionType): if hasattr(Functions, self.name + "_"): return getattr(Functions, self.name + "_") - raise StringFormattingException(f"Function name {self.name} does not exist") + # Should be validated in the parser + raise UNREACHABLE @functools.cached_property def arg_spec(self) -> FullArgSpec: diff --git a/tests/unit/script/test_parser.py b/tests/unit/script/test_parser.py index 4f518939..6a922636 100644 --- a/tests/unit/script/test_parser.py +++ b/tests/unit/script/test_parser.py @@ -8,7 +8,6 @@ from ytdl_sub.script.parser import _UNEXPECTED_CHAR_ARGUMENT from ytdl_sub.script.parser import BRACKET_NOT_CLOSED from ytdl_sub.script.parser import ParsedArgType from ytdl_sub.script.parser import parse -from ytdl_sub.script.types.array import Array from ytdl_sub.script.types.array import UnresolvedArray from ytdl_sub.script.types.function import BuiltInFunction from ytdl_sub.script.types.resolvable import Boolean @@ -19,7 +18,6 @@ from ytdl_sub.script.types.resolvable import String from ytdl_sub.script.types.syntax_tree import SyntaxTree from ytdl_sub.script.types.variable import Variable from ytdl_sub.script.utils.exceptions import InvalidSyntaxException -from ytdl_sub.utils.exceptions import StringFormattingException class TestParser: