Skip to content

Commit

Permalink
Fix conditional and add precedence test
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac091 committed Nov 10, 2023
1 parent d5a5b54 commit f9f477d
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 @@ -109,7 +109,7 @@ def get_chapters(chapter_selections: str) -> dict:
raise RuntimeError(f"{span} is an invalid book range.")

for i in range(book_id_to_number(ends[0]), book_id_to_number(ends[1]) + 1):
if not i in chapters:
if i not in chapters:
chapters[i] = set()

for subtraction in subtractions:
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 @@ -50,6 +50,7 @@ def test_get_chapters() -> None:
assert get_chapters("MAT400-500") == {}
assert get_chapters("MAT1-4,12,9,100") == {40: [1, 2, 3, 4, 9, 12]}
assert get_chapters("MAT-LUK") == {40: [], 41: [], 42: []}
assert get_chapters("MAT1,2,3;MAT-LUK") == {40: [1, 2, 3], 41: [], 42: []}
assert get_chapters("2JN-3JN;EXO1,8,3-5;GEN") == {1: [], 2: [1, 3, 4, 5, 8], 63: [], 64: []}

assert get_chapters("NT;OT;-MRK;-EXO") == whole_bible
Expand Down

0 comments on commit f9f477d

Please sign in to comment.