Add test for is_word_in_text

This commit is contained in:
Joakim Hellsén 2023-01-30 00:01:47 +01:00
commit 10e335e6e2
No known key found for this signature in database
GPG key ID: C889E6DC5EDBB36D

12
tests/test_utils.py Normal file
View file

@ -0,0 +1,12 @@
from discord_rss_bot.filter.utils import is_word_in_text
def test_is_word_in_text() -> None:
assert is_word_in_text("word1,word2", "This is a sample text containing word1 and word2.") is True
assert is_word_in_text("word1,word2", "This is a sample text containing word1.") is True
assert is_word_in_text("word1,word2", "This is a sample text containing word2.") is True
assert is_word_in_text("word1,word2", "This is a sample text containing WORD1 and WORD2.") is True
assert is_word_in_text("Alert,Forma", "Outbreak - Mutagen Mass - Rhea (Saturn)") is False
assert is_word_in_text("Alert,Forma", "Outbreak - Mutagen Mass - Rhea (Saturn)") is False
assert is_word_in_text("word1,word2", "This is a sample text containing none of the words.") is False