From 08039f3b6ef7504ed250ef3ccbdb80201666ebae Mon Sep 17 00:00:00 2001 From: julesbertrand Date: Mon, 6 Feb 2023 19:09:46 +0100 Subject: [PATCH] test: add tests for issue #269 --- tests/test_preprocessor.py | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/tests/test_preprocessor.py b/tests/test_preprocessor.py index b179ae9..4321ad2 100644 --- a/tests/test_preprocessor.py +++ b/tests/test_preprocessor.py @@ -501,27 +501,22 @@ def test_custom_preprocess(): assert expected_result == result -def test_apply_preprocessor(): +@pytest.mark.parametrize( + "input_str, expected_str", + [ + ( + "Some text with @mentions and whitespaces and #hashtags", + "Some text with and whitespaces and", + ), + ("@twitteruser ✊", ""), + ], +) +def test_apply_preprocessor(input_str, expected_str): # Given - text = "Some text with @mentions and whitespaces and #hashtags" - operations: List[Callable[[Any], Any]] = [ - remove_html_tags, - remove_mentions, - remove_emoji, - remove_hashtag, - remove_eol_characters, - fix_bad_unicode, - normalize_whitespace, - ] - preprocessor = Preprocessor() - expected_result = text - for function in operations: - expected_result = function(expected_result) - # When - result = preprocessor.run(text) + result = preprocessor.run(input_str) # Then - assert expected_result == result + assert expected_str == result