def test_get_online_passages_with_excessive_values(self): bible = WebExtractor() text1 = bible.search('Ecclesiastes 1:1') text2 = bible.get_passages('Ecclesiastes', -1, -1, -1) self.assertEqual(text1, text2, 'Passage is incorrect') # Starting passage is not valid self.assertRaises(InvalidSearchError, bible.get_passages, 'Ecclesiastes', 1000, 1000, 1000) # Starting passage is valid again text1 = bible.search('Ecclesiastes 12') text2 = bible.get_passages('Ecclesiastes', 1000, 1, 1000) self.assertEqual(text1, text2, 'Passage is incorrect')
def test_get_passages_list(self): bible = WebExtractor(output_as_list=True) text = bible.get_passages('1 John', 1, 8, 9) john = [ '\u2078 If we claim to be without sin, we deceive ourselves and the truth is not in us. ', '\u2079 If we confess our sins, he is faithful and just and will forgive us our sins and purify ' 'us from all unrighteousness.' ] self.assertEqual(john, text, 'Passage is incorrect')
def test_get_online_passages(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.search('Ezekiel 40:19-20') text2 = bible.get_passages('Ezekiel', 40, 19, 20) self.assertEqual(text1, text2, 'Passage is incorrect')
def get_verse(book,numbers): bible = WebExtractor(translation="ESV",show_passage_numbers=False) chapter_from_ = int(numbers[0]) verse_from_ = int(numbers[1]) #chapter_to_ = input("upto which chpater? ") verse_to_ = int(numbers[2]) #bible.get_passages() #print(book_,chapter_from_,verse_from_,verse_to_) #print() online = bible.get_passages(book_,chapter_from_,verse_from_,verse_to_) return(online)
def test_get_passages_list_with_stripped_whitespace(self): bible = WebExtractor(output_as_list=True, strip_excess_whitespace_from_list=True) text = bible.get_passages('Ecclesiastes', 11, 6, 7) eccl11 = [ '\u2076 Sow your seed in the morning,\n' ' and at evening let your hands not be idle,\n' 'for you do not know which will succeed,\n' ' whether this or that,\n' ' or whether both will do equally well.', '\u2077 Light is sweet,\n' ' and it pleases the eyes to see the sun.' ] # These two passages are normally in a poetic format, each ending with a newline. # Toggling the flag parameter should not preserve these newline characters, but the inner newlines are kept. self.assertEqual(eccl11, text, 'Passage is incorrect')
def test_get_online_passage_range_from_same_chapter(self): bible = WebExtractor() text1 = bible.get_passages('Ezekiel', 40, 19, 20) # A passage range in the same chapter should be the same as calling the passages extraction method text2 = bible.get_passage_range('Ezekiel', 40, 19, 40, 20) self.assertEqual(text1, text2, 'Passage is incorrect')