ytdl-sub/tests/unit/script/functions/test_conditional_functions.py
Jesse Bannon 308c76a8f2
[FEATURE] Filter plugins, regex helper script functions (#848)
Adds generic `filter_include` and `filter_exclude` plugins in anticipation for function script usage. Will detail it more with official docs at a later time!
2023-12-20 09:52:12 -08:00

35 lines
929 B
Python

import pytest
from unit.script.conftest import single_variable_output
class TestConditionalFunction:
@pytest.mark.parametrize(
"function_str, expected_output",
[
("{%if(True, True, False)}", True),
("{%if(False, True, False)}", False),
],
)
def test_if_function(self, function_str: str, expected_output: bool):
output = single_variable_output(function_str)
assert output == expected_output
def test_nested_if_function(self):
output = single_variable_output(
"""{
%if(
True,
%if(
True,
%if(
True,
"winner",
True
),
True
),
True
)
}"""
)
assert output == "winner"