Skip to content

Commit 85ea9cd

Browse files
committed
fix John regular expression to avoid confusion with Jonah
1 parent 6f8f706 commit 85ea9cd

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

pythonbible/pythonbible/books.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def _add_suffix(regex: str, suffix: str | None = None) -> str:
2424
_SAMUEL_REGULAR_EXPRESSION = r"(Samuel|Sam\.*|Sa\.*|Sm\.*)"
2525
_KINGS_REGULAR_EXPRESSION = r"(Kings|Kgs\.*|Kin\.*|Ki\.*)"
2626
_CHRONICLES_REGULAR_EXPRESSION = r"(Chronicles|Chron\.*|Chro\.*|Chr\.*|Ch\.*)"
27-
_JOHN_REGULAR_EXPRESSION = r"(John|Joh\.*|Jhn\.*|Jo\.*(?!shua|b|nah|el)|Jn\.*)"
27+
_JOHN_REGULAR_EXPRESSION = r"(John|Joh\.*|Jhn\.*|Jo\.*(?!shua|b|nah|el|n)|Jn\.*)"
2828
_CORINTHIANS_REGULAR_EXPRESSION = r"Co\.*(?:r\.*(?:inthians)?)?"
2929
_THESSALONIANS_REGULAR_EXPRESSION = r"Th\.*(?:(s|(es(?:s)?))\.*(?:alonians)?)?"
3030
_TIMOTHY_REGULAR_EXPRESSION = r"Ti\.*(?:m\.*(?:othy)?)?"

pythonbible/tests/parser/parser_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import pytest
4+
45
import pythonbible as bible
56

67

@@ -338,7 +339,7 @@ def test_book_abbreviations() -> None:
338339

339340

340341
@pytest.mark.parametrize(
341-
"input_reference, expected_output",
342+
("input_reference", "expected_output"),
342343
[
343344
(
344345
"micah-jon",
@@ -348,7 +349,7 @@ def test_book_abbreviations() -> None:
348349
start_verse=None,
349350
end_chapter=None,
350351
end_verse=None,
351-
end_book=None,
352+
end_book=bible.Book.JONAH,
352353
),
353354
),
354355
(
@@ -359,7 +360,7 @@ def test_book_abbreviations() -> None:
359360
start_verse=None,
360361
end_chapter=None,
361362
end_verse=None,
362-
end_book=None,
363+
end_book=bible.Book.JONAH,
363364
),
364365
),
365366
(
@@ -382,7 +383,7 @@ def test_book_abbreviations() -> None:
382383
end_chapter=None,
383384
end_verse=None,
384385
end_book=bible.Book.JOHN,
385-
)
386+
),
386387
),
387388
],
388389
)

0 commit comments

Comments
 (0)