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_book_list(self): bible = WebExtractor(output_as_list=True, translation=self.get_test_translation()) text = bible.get_book('Philemon') static_file = '{0}/test_get_book_list.txt'.format( self.get_test_directory()) with open(static_file, 'r', encoding='utf-8') as file: phil = file.read() # To avoid having to paste the entire contents of Philemon in the test, this is tested by joining all the # lines of the list into a single string and comparing against a test file self.assertEqual(phil, ''.join(text), 'Passage is incorrect')
def test_get_base_book_list(self): online_bible = WebExtractor(output_as_list=True, 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, default_directory=self.get_test_directory(), translation=self.get_test_translation()) text = bible.get_book('Philemon') eccl = online_bible.get_book('Philemon') # Results should be identical between the web and base extractor self.assertEqual(eccl, text, 'Passage is incorrect')
def test_get_base_book_list_with_ascii_punctuation(self): online_bible = WebExtractor(output_as_list=True, translation=self.get_test_translation(), show_passage_numbers=False, use_ascii_punctuation=True) bible = BaseExtractor(file_reading_function=yaml_file_interface.read, file_extension=self.get_test_file_extension(), output_as_list=True, default_directory=self.get_test_directory(), translation=self.get_test_translation(), show_passage_numbers=False, use_ascii_punctuation=True) text = bible.get_book('Ecclesiastes') eccl = online_bible.get_book('Ecclesiastes') # Results should be identical between the web and base extractor self.assertEqual(eccl, text, 'Passage is incorrect')