예제 #1
0
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
예제 #2
0
 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)
예제 #3
0
 def testWorksWithoutPartOfSpeechInfo(self):
     # Works without part of speech info
     self.assertIsInstance(get_word_frequency("funny"), int)
예제 #4
0
 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)
예제 #5
0
 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)