def test_get_online_chapters_with_excessive_values(self):
     bible = WebExtractor()
     text1 = bible.search('Ecclesiastes 1')
     text2 = bible.get_chapters('Ecclesiastes', -1, -1)
     self.assertEqual(text1, text2, 'Passage is incorrect')
     # This should scale down to the last chapter number of the book
     text1 = bible.search('Ecclesiastes 12')
     text2 = bible.get_chapters('Ecclesiastes', 1000, 1000)
     self.assertEqual(text1, text2, 'Passage is incorrect')
    def test_get_online_book(self):
        bible = WebExtractor()
        options = self.get_alternative_interface_options()
        for option in options:
            bible.translation = option['translation']
            bible.show_passage_numbers = option['show_passage_numbers']

            text1 = bible.get_chapters('2 Thessalonians', 1, 3)
            text2 = bible.get_book('2 Thessalonians')
            # A book should be the same ass getting all the chapters in a given book
            self.assertEqual(text1, text2, 'Passage is incorrect')
    def test_get_online_chapters(self):
        bible = WebExtractor()
        options = self.get_alternative_interface_options()
        for option in options:
            bible.translation = option['translation']
            bible.show_passage_numbers = option['show_passage_numbers']

            text1 = bible.get_chapter('Amos', 8) + '\n' + bible.get_chapter(
                'Amos', 9)
            text2 = bible.get_chapters('Amos', 8, 9)
            # Chapters interface should be the same as requesting the individual chapters with newline separators
            self.assertEqual(text1, text2, 'Passage is incorrect')
 def test_get_base_chapters_list(self):
     online_bible = WebExtractor(output_as_list=True,
                                 show_passage_numbers=False,
                                 translation=self.get_test_translation())
     bible = BaseExtractor(file_reading_function=yaml_file_interface.read,
                           file_extension=self.get_test_file_extension(),
                           output_as_list=True,
                           show_passage_numbers=False,
                           default_directory=self.get_test_directory(),
                           translation=self.get_test_translation())
     text = bible.get_chapters('Ecclesiastes', 11, 12)
     eccl = online_bible.get_chapters('Ecclesiastes', 11, 12)
     # Results should be identical between the web and base extractor
     # Ignoring passage numbers, as the web extractor omits this for the first passage of each chapter
     self.assertEqual(eccl, text, 'Passage is incorrect')
 def test_get_chapters_list(self):
     bible = WebExtractor(output_as_list=True)
     text = bible.get_chapters('1 John', 1, 2)
     john = bible.get_chapter('1 John', 1) + bible.get_chapter('1 John', 2)
     # Getting multiple sequential chapters should be the same as appending multiple chapters manually
     self.assertEqual(john, text, 'Passage is incorrect')