Exemplo n.º 1
0
    def test_no_chapters(self):
        lines = """\
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Sed do eiusmod tempor.

Incididunt ut labore et dolore magna aliqua.""".splitlines()
        chapter_line_numbers = [0]
        wordcounts = get_chapter_wordcounts(chapter_line_numbers, lines)
        self.assertEqual(wordcounts, [19])
Exemplo n.º 2
0
    def test_default_run(self):
        lines = """\
>> CHAPTER 1
Lorem ipsum.
Line 2.

>> CHAPTER 2
Exciting ending!
What will happen next!""".splitlines()
        chapter_line_numbers = [0, 1, 5]
        wordcounts = get_chapter_wordcounts(chapter_line_numbers, lines)
        self.assertEqual(wordcounts, [0, 4, 6])
Exemplo n.º 3
0
    def test_empty_chapters(self):
        lines = """\

>> CHAPTER 1
>> CHAPTER 2


>> CHAPTER 3


""".splitlines()
        chapter_line_numbers = [0, 2, 3, 6]
        wordcounts = get_chapter_wordcounts(chapter_line_numbers, lines)
        self.assertEqual(wordcounts, [0, 0, 0, 0])
Exemplo n.º 4
0
    def test_default_run_with_prologue(self):
        lines = """\
A prologue! Yes! How exciting.
And some more...
>> CHAPTER 1
Lorem ipsum.
Line 2.

>> CHAPTER 2
Exciting ending!
What will happen next!""".splitlines()
        chapter_line_numbers = [0, 3, 7]
        wordcounts = get_chapter_wordcounts(chapter_line_numbers, lines)
        self.assertEqual(wordcounts, [8, 4, 6])
Exemplo n.º 5
0
 def test_no_lines_at_all(self):
     lines = []
     chapter_line_numbers = []
     wordcounts = get_chapter_wordcounts(chapter_line_numbers, lines)
     self.assertEqual(wordcounts, [])