Skip to content

Commit

Permalink
Fixes issue when specifying PS2 or PS3 (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 authored Apr 16, 2024
1 parent 5d05e6d commit 2a80929
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion machine/scripture/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def parse_selection(selection: str, versification: Versification) -> Dict[int, L
selection = selection.strip()
chapters = {}

if selection[-1].isdigit(): # Specific chapters from one book
if selection[-1].isdigit() and len(selection) > 3: # Specific chapters from one book
book = book_id_to_number(selection[:3])
if book == 0:
raise ValueError(f"{selection[:3]} is an invalid book ID.")
Expand Down
1 change: 1 addition & 0 deletions tests/scripture/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def test_get_books() -> None:
def test_get_chapters() -> None:
assert get_chapters([]) == {}
assert get_chapters("MAL") == {39: []}
assert get_chapters("PS2") == {84: []}
assert get_chapters("GEN,EXO") == {1: [], 2: []}
assert get_chapters("1JN,2JN") == {62: [], 63: []}
assert get_chapters("OT") == {i: [] for i in range(1, 40)}
Expand Down

0 comments on commit 2a80929

Please sign in to comment.