示例#1
0
 def test_delta_verse_with_passage_end(self):
     #Adding verses to the end of a passage
     self.assertEqual(P('Gen', 1, 1) + D(verses=1), P('Gen', 1, 1, 1, 2))
     #Pushing reference out into next chapter
     self.assertEqual(P('Gen', 1, 1) + D(verses=50), P('Gen', 1, 1, 2, 20))
     #Pushing reference out into next book
     self.assertEqual(
         P('Gen', 1, 1) + D(verses=1533), P('Gen', 1, 1, 1, 1, 'Exo'))
     #Delta chapter taking through to end of the bible
     self.assertEqual(
         P('Rev', 20, 1) + D(verses=500), P('Rev', 20, 1, 22, 21))
示例#2
0
 def test_delta_chapter_with_passage_end(self):
     #Adding chapters to the end of a passage
     #Normal behaviour is to increment end_chapter; leaving end_verse
     #unchanged
     self.assertEqual(
         P('Gen', 1, 1, 2, 3) + D(chapters=1), P('Gen', 1, 1, 3, 3))
     self.assertEqual(
         D(chapters=1) + P('Gen', 1, 1, 2, 3), P('Gen', 1, 1, 3, 3))
     #If incrementing end_chapter means end_verse is past end of chapter,
     #end_verse is truncated
     self.assertEqual(
         P('Gen', 1, 1, 1, 27) + D(chapters=1), P('Gen', 1, 1, 2, 25))
     #Special case for passages that finish at the end of a chapter already:
     #here end verse is equal to the last verse of incremented chapter
     self.assertEqual(
         P('Gen', 3, 1, 3, 24) + D(chapters=1), P('Gen', 3, 1, 4, 26))
     #Delta chapter pushing reference out into next book (NB: Gen has 50
     #chapters, Exo has 40)
     self.assertEqual(
         P('Gen', 1, 1) + D(chapters=50), P('Gen', 1, 1, 1, 1, 'Exo'))
     self.assertEqual(
         P('Gen', 3, 1, 3, 24) + D(chapters=50), P('Gen', 3, 1, 3, 22,
                                                   'Exo'))
     self.assertEqual(
         P('Gen', 1, 1) + D(chapters=90), P('Gen', 1, 1, 1, 1, 'Lev'))
     #Delta chapter taking through to end of the bible (NB: total of 1189
     #chapters in the bible)
     self.assertEqual(
         P('Gen', 1, 1) + D(chapters=1190), P('Gen', 1, 1, 22, 21, 'Rev'))
示例#3
0
 def test_delta_chapter_with_passage_start(self):
     #Adding chapters to the START of a passage
     self.assertEqual(
         P('Gen', 2, 1) + D(chapters=1, passage_start=True),
         P('Gen', 1, 1, 2, 1))
     #Adding more chapters than are available
     self.assertEqual(
         P('Gen', 2, 1) + D(chapters=3, passage_start=True),
         P('Gen', 1, 1, 2, 1))
     #Delta chapter pushing reference out into previous book
     self.assertEqual(
         P('Exo', 2, 1) + D(chapters=3, passage_start=True),
         P('Gen', 49, 1, 2, 1, 'Exo'))
     #Truncation of start_verse
     self.assertEqual(
         P('Gen', 4, 26) + D(chapters=1, passage_start=True),
         P('Gen', 3, 24, 4, 26))
示例#4
0
 def test_negative_delta_chapter_with_passage_end(self):
     #Here we want to REMOVE chapters from the end of the passage;
     #leaving passage shorter than it was
     self.assertEqual(
         P('Gen', 1, 1, 3, 1) + D(chapters=-1), P('Gen', 1, 1, 2, 1))
     #Automatic truncation of end verse
     self.assertEqual(
         P('Gen', 3, 1, 4, 26) + D(chapters=-1), P('Gen', 3, 1, 3, 24))
     #Special case for passages finishing at the end of a chapter
     self.assertEqual(
         P('Gen', 1, 1, 2, 25) + D(chapters=-1), P('Gen', 1, 1, 1, 31))
     #Delta chapter pushing reference back into previous book
     self.assertEqual(
         P('Gen', 1, 1, 10, 1, 'Exo') + D(chapters=-10),
         P('Gen', 1, 1, 50, 1))
     self.assertEqual(
         P('Gen', 1, 1, 10, 1, 'Exo') + D(chapters=-20),
         P('Gen', 1, 1, 40, 1))
     #Delta chapter greater than length of passage
     try:
         p = P('Gen', 2, 1) + D(chapters=-1)
     except InvalidPassageException:
         pass
     #Special case where passage had started in Gen 1:1
     self.assertEqual(
         P('Gen', 1, 1, 2, 25) + D(chapters=-2), P('Gen', 1, 1))
示例#5
0
 def test_negative_delta_verse_with_passage_start(self):
     #Removing verses from the start of a passage
     self.assertEqual(
         P('Gen', 1, 1, 1, 31) + D(verses=-1, passage_start=True),
         P('Gen', 1, 2, 1, 31))
     #Shorter by a chapter
     self.assertEqual(
         P('Gen', 1, 31, 2, 1) + D(verses=-1, passage_start=True),
         P('Gen', 2, 1))
     #Shorter by a book
     self.assertEqual(
         P('Gen', 50, 26, 1, 1, 'Exo') + D(verses=-1, passage_start=True),
         P('Exo', 1, 1))
     #Delta verse greater than length of passage
     try:
         p = P('Gen', 1, 1) + D(verses=-1, passage_start=True)
     except InvalidPassageException:
         pass
示例#6
0
 def test_negative_delta_chapter_with_passage_start(self):
     #REMOVING chapters from the start of a passage
     self.assertEqual(
         P('Gen', 4, 1, 5, 32) + D(chapters=-1, passage_start=True),
         P('Gen', 5, 1, 5, 32))
     #Delta chapter pushing reference back into next book
     self.assertEqual(
         P('Gen', 1, 1, 40, 38, 'Exo') +
         D(chapters=-50, passage_start=True), P('Exo', 1, 1, 40, 38))
     #Delta chapter greater than length of passage
     try:
         p = P('Gen', 1, 1) + D(chapters=-1, passage_start=True)
     except InvalidPassageException:
         pass
     #Truncation of start_verse
     self.assertEqual(
         P('Gen', 1, 31, 5, 32) + D(chapters=-1, passage_start=True),
         P('Gen', 2, 25, 5, 32))
示例#7
0
 def test_delta_verse_with_passage_start(self):
     #Adding verses to the start of a passage
     self.assertEqual(
         P('Gen', 1, 2) + D(verses=1, passage_start=True),
         P('Gen', 1, 1, 1, 2))
     #Back into previous chapter
     self.assertEqual(
         P('Gen', 2, 1) + D(verses=1, passage_start=True),
         P('Gen', 1, 31, 2, 1))
     self.assertEqual(
         P('Gen', 2, 1) + D(verses=31, passage_start=True),
         P('Gen', 1, 1, 2, 1))
     #Back into previous book
     self.assertEqual(
         P('Exo', 1, 1) + D(verses=1, passage_start=True),
         P('Gen', 50, 26, 1, 1, 'Exo'))
     #Back to start of bible
     self.assertEqual(
         P('Gen', 2, 1) + D(verses=100, passage_start=True),
         P('Gen', 1, 1, 2, 1))
示例#8
0
 def test_negative_delta_verse_with_passage_end(self):
     #Removing verses from the end of a passage
     self.assertEqual(
         P('Gen', 1, 1, 1, 31) + D(verses=-1), P('Gen', 1, 1, 1, 30))