lint, unit test
This commit is contained in:
parent
6cffcf08e1
commit
01e7cfdad7
3 changed files with 6 additions and 2 deletions
|
|
@ -1216,6 +1216,9 @@ class VariableDefinitions(
|
|||
} | self.injected_variables()
|
||||
|
||||
def get(self, name: str) -> Optional[Variable]:
|
||||
"""
|
||||
Returns the variable attribute if it exists. None otherwise.
|
||||
"""
|
||||
if not hasattr(self, name):
|
||||
return None
|
||||
return getattr(self, name)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ from ytdl_sub.script.utils.name_validation import is_function
|
|||
# pylint: disable=too-many-return-statements
|
||||
# pylint: disable=too-many-branches
|
||||
|
||||
|
||||
class ScriptUtils:
|
||||
@classmethod
|
||||
def add_sanitized_variables(cls, variables: Dict[str, str]) -> Dict[str, str]:
|
||||
|
|
|
|||
|
|
@ -113,12 +113,12 @@ class TestUnstructuredDictFormatterValidator(object):
|
|||
assert len(validator.dict) == 8
|
||||
assert all(isinstance(val, expected_formatter_class) for val in validator.dict.values())
|
||||
assert validator.dict_with_format_strings == {
|
||||
"key1": '{ %concat( "string with ", variable ) }',
|
||||
"key1": "string with { variable }",
|
||||
"key2": "no variables",
|
||||
"key3": "{ %int(3) }",
|
||||
"key4": "{ %float(4.132) }",
|
||||
"key5": "{ %bool(True) }",
|
||||
"key6": '{ { %concat( variable, "_key" ): "value", "static_key": %concat( variable, "_value" ) } }',
|
||||
"key7": '{ [ "list_1", %concat( "list_", variable_2 ) ] }',
|
||||
"key8": '{ %concat( "string ", variable1, " with multiple ", variable2 ) }',
|
||||
"key8": "string { variable1 } with multiple { variable2 }",
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue