def test_get_online_passage_range_with_excessive_values(self):
     bible = WebExtractor()
     text1 = bible.search('Ecclesiastes 1:1')
     text2 = bible.get_passage_range('Ecclesiastes', -1, -1, -1, -1)
     self.assertEqual(text1, text2, 'Passage is incorrect')
     # Starting passage is not valid
     self.assertRaises(InvalidSearchError, bible.get_passage_range,
                       'Ecclesiastes', 1000, 1000, 1000, 1000)
     # Starting passage is valid again
     text1 = bible.search('Ecclesiastes 12')
     text2 = bible.get_passage_range('Ecclesiastes', 1000, -1, 1000, 1000)
     self.assertEqual(text1, text2, 'Passage is incorrect')
 def test_get_online_passage_range_with_intermediate_chapters(self):
     bible = WebExtractor()
     text1 = bible.get_passage('Daniel', 3, 30) + '\n' + \
         bible.get_chapter('Daniel', 4) + '\n' + \
         bible.get_passage('Daniel', 5, 1)
     text2 = bible.get_passage_range('Daniel', 3, 30, 5, 1)
     # A passage range with intermediate chapters should be the same as manually putting all the passages together
     self.assertEqual(text1, text2, 'Passage is incorrect')
 def test_get_passage_range_list_from_same_chapter(self):
     bible = WebExtractor(output_as_list=True)
     text = bible.get_passage_range('1 John', 1, 8, 1, 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_passage_range_list(self):
     bible = WebExtractor(output_as_list=True)
     text = bible.get_passage_range('Ecclesiastes', 9, 18, 10, 1)
     eccl = [
         '\u00b9\u2078 Wisdom is better than weapons of war,\n'
         '    but one sinner destroys much good.',
         'As dead flies give perfume a bad smell,\n'
         '    so a little folly outweighs wisdom and honor.'
     ]
     self.assertEqual(eccl, text, 'Passage is incorrect')
def get_verse_double(book,numbers):
    bible = WebExtractor(translation="ESV",show_passage_numbers=False)
    chapter_from_ = int(numbers[0])
    verse_from_ = int(numbers[1])
    chapter_to_ = int(numbers[2])
    verse_to_ = int(numbers[3])
    #bible.get_passages()
    #print(book_,chapter_from_,verse_from_,verse_to_)
    #print()
    online = bible.get_passage_range(book_,chapter_from_,verse_from_,chapter_to_,verse_to_)
    return(online)
    def test_get_online_passage_range(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_passage(
                'Amos', 8, 14) + '\n' + bible.get_passage('Amos', 9, 1)
            text2 = bible.get_passage_range('Amos', 8, 14, 9, 1)
            # A passage range should be the same as putting all the passage together with newline separators
            self.assertEqual(text1, text2, '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')