Skip to content

Commit

Permalink
3.0.1
Browse files Browse the repository at this point in the history
Corrected problem with siblingId
  • Loading branch information
PonteIneptique committed Jan 29, 2020
2 parents ecaef76 + e5dc297 commit 983e4a1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -25,3 +25,5 @@ lxml-3.4.4-py3.4-linux-x86_64.egg/
*.egg
/.eggs/
/venv*/
.directory
python3.5
4 changes: 4 additions & 0 deletions CHANGES.md
@@ -1,3 +1,7 @@
### 2020-10-29 3.0.1 @sonofmun

- Corrected an error when calculating the siblings for a range when the end of the range + the length equaled doc length

### 2019-07-01 3.0.0 @ponteineptique

- Added DTS !
Expand Down
2 changes: 1 addition & 1 deletion MyCapytain/__init__.py
Expand Up @@ -9,4 +9,4 @@
"""

__version__ = "3.0.0"
__version__ = "3.0.1"
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 983e4a1

Please sign in to comment.