示例#1
0
    def test_ignores_extra_whitespace(self):
        longest_word_expected = "antidisestablismentarianism"
        text = "hello, 		my   name  is      antidisestablismentarianism."

        sentence = Sentence(text)

        (longest_word_actual, length) = sentence.get_longest_word()
        self.assertEqual(longest_word_actual, longest_word_expected)
        self.assertEqual(len(longest_word_actual), len(longest_word_expected))
示例#2
0
    def test_one_word(self):
        word_expected = "sentence"
        text = "sentence."

        sentence = Sentence(text)

        (word_actual, length) = sentence.get_longest_word()
        self.assertEqual(word_actual, word_expected)
        self.assertEqual(len(word_actual), len(word_expected))