Add function to validate formatting strings

This commit is contained in:
Serene-Arc
2021-03-02 14:06:21 +10:00
committed by Ali Parlakci
parent c01fc39671
commit ea42471932
2 changed files with 27 additions and 0 deletions

View File

@@ -42,6 +42,20 @@ def test_format_name_mock(format_string: str, expected: str, submission: Mock):
assert result == expected
@pytest.mark.parametrize(('test_string', 'expected'), (
('', False),
('test', False),
('{POSTID}', True),
('POSTID', False),
('{POSTID}_test', True),
('test_{TITLE}', True),
('TITLE_POSTID', False),
))
def test_check_format_string_validity(test_string: str, expected: bool):
result = FileNameFormatter.validate_string(test_string)
assert result == expected
@pytest.mark.online
@pytest.mark.reddit
@pytest.mark.parametrize(('format_string', 'expected'),