def test_get_word_frequency() -> None: words = ["Hello", "Hello", "There"] words_stats_template = {"hello": 2, "there": 1} words_stats = wf.get_word_frequency(words) assert words_stats == words_stats_template
def testWorksWhenWordIsntPresent(self): # Works when word isn't present self.assertIsInstance(get_word_frequency("bingobango", pos="v"), int) self.assertIsInstance(get_word_frequency("bingobango", pos="d"), int) self.assertIsInstance(get_word_frequency("bingobango"), int)
def testWorksWithoutPartOfSpeechInfo(self): # Works without part of speech info self.assertIsInstance(get_word_frequency("funny"), int)
def testWorksWithWrongPartOfSpeechInfo(self): # Works with wrong part of speech info self.assertIsInstance(get_word_frequency("funny", "a"), int) self.assertIsInstance(get_word_frequency("funny", "s"), int) self.assertIsInstance(get_word_frequency("funny", "d"), int)
def testReturnsNumber(self): # Works with part of speech info self.assertIsInstance(get_word_frequency("funny", "n"), int) self.assertIsInstance(get_word_frequency("funny", "v"), int)