Пример #1
0
    def test_three_sentences(self):
        para = Paragraph('''This is a paragraph. It has several sentences.
Three, in fact.''')
        self.assertEqual(3, para.num_sentences())
Пример #2
0
 def test_empty_paragraph(self):
     para = Paragraph('')
     self.assertEqual(0, para.num_sentences())
Пример #3
0
 def test_single_sentence(self):
     para = Paragraph('This is a paragraph with one sentence.')
     self.assertEqual(1, para.num_sentences())
 def test_several_sentences(self):
     text = """Once upon a time, a brave princess went on a dangerous journey. She
     had many adventures, and recruited other heros to her important and
     noble cause."""
     paragraph = Paragraph(text)
     self.assertEqual(2, paragraph.num_sentences())
 def test_single_sentence(self):
     paragraph = Paragraph("This is one sentence.")
     self.assertEqual(1, paragraph.num_sentences())
 def test_empty_paragraph(self):
     with self.assertRaises(ValueError):
         Paragraph("")
Пример #7
0
 def test_several_sentences(self):
     several_sentences_paragraph = Paragraph('''Hello, Alex
     How is life
     Life is ok''')
     self.assertEqual(3, several_sentences_paragraph.num_sentences())
Пример #8
0
 def test_single_sentence(self):
     single_sentence_paragraph = Paragraph('Hello, Alex')
     self.assertEqual(1, single_sentence_paragraph.num_sentences())