Skip to content

Commit

Permalink
Merge a70eb96 into 3ff0f27
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmun committed Nov 26, 2019
2 parents 3ff0f27 + a70eb96 commit 06907de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MyCapytain/resources/texts/local/capitains/cts.py
Expand Up @@ -659,7 +659,7 @@ def siblingsId(self) -> Tuple[CtsReference, CtsReference]:
if start + 1 == len(document_references) or end + 1 == len(document_references):
# If the passage is already at the end
_next = None
elif end + range_length > len(document_references):
elif end + range_length >= len(document_references):
if start == end:
_next = document_references[-1]
else:
Expand Down
4 changes: 4 additions & 0 deletions tests/resources/texts/local/commonTests.py
Expand Up @@ -716,6 +716,10 @@ def test_siblingsId(self, simple):
self.assertEqual(("1-4", "9-12"), (str(p), str(n)), "Middle node should have right siblings")
p, n = self.FULL_EPIGRAMMATA.getTextualNode(CtsReference("5-10"), simple=simple).siblingsId
self.assertEqual(("1-4", "11-14"), (str(p), str(n)), "Middle node should have right siblings")
# This test makes sure that siblingsId functions when end + range_length == len(document_references)
# Previously when this was the case siblingsId would throw an IndexError
p, n = self.FULL_EPIGRAMMATA.getTextualNode(CtsReference("2-8"), simple=simple).siblingsId
self.assertEqual(("1-1", "9-14"), (str(p), str(n)), "Middle node should have right siblings")
# NONE !
p, n = self.FULL_EPIGRAMMATA.getTextualNode(CtsReference("1-14"), simple=simple).siblingsId
self.assertEqual((None, None), (p, n), "If whole range, nothing !")
Expand Down

0 comments on commit 06907de

Please sign in to comment.