From f9f477d34ba2cf3d4fbd428b355ccf732764bfd4 Mon Sep 17 00:00:00 2001 From: Isaac Schifferer Date: Fri, 10 Nov 2023 10:19:41 -0600 Subject: [PATCH] Fix conditional and add precedence test --- machine/scripture/parse.py | 2 +- tests/scripture/test_parse.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/machine/scripture/parse.py b/machine/scripture/parse.py index 87a18f4..d6c3650 100644 --- a/machine/scripture/parse.py +++ b/machine/scripture/parse.py @@ -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: diff --git a/tests/scripture/test_parse.py b/tests/scripture/test_parse.py index 4454383..a10aba3 100644 --- a/tests/scripture/test_parse.py +++ b/tests/scripture/test_parse.py @@ -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