tests: Add tests for %regex_sub script function
This commit is contained in:
parent
20a94d9a4f
commit
6630d3ec97
1 changed files with 16 additions and 0 deletions
|
|
@ -43,3 +43,19 @@ class TestNumericFunctions:
|
|||
def test_regex_fullmatch(self, values: str, expected_output: str):
|
||||
output = single_variable_output(f"{{%regex_fullmatch({values})}}")
|
||||
assert output == expected_output
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"values, expected_output",
|
||||
[
|
||||
("'[^A-Za-z0-9 ]', '', 'This title is AWESOME!!'", "This title is AWESOME"),
|
||||
("'\s+', '_', 'Consolidate spaces'", "Consolidate_spaces"),
|
||||
(
|
||||
"'(words) are (reordered)', '\\2 are \\1', 'Oh words are reordered'",
|
||||
"Oh reordered are words",
|
||||
),
|
||||
("'MATCH', '', 'matcha is great'", "matcha is great"),
|
||||
],
|
||||
)
|
||||
def test_regex_sub(self, values: str, expected_output: str):
|
||||
output = single_variable_output(f"{{%regex_sub({values})}}")
|
||||
assert output == expected_output
|
||||
|
|
|
|||
Loading…
Reference in a new issue