Skip to content

Commit

Permalink
Added test for no parsha and fixed bug in Purim within 2 days of Shab…
Browse files Browse the repository at this point in the history
…bos.
  • Loading branch information
simlist committed Sep 11, 2024
1 parent 8f236ff commit e23b577
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pyluach/parshios.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _get_four_parshios(date):
return _FourParshiosEnum.ZACHOR
if shabbos > purim and (shabbos - purim) in [8, 9]:
return _FourParshiosEnum.PARAH
if shabbos > purim and shabbos - purim < 7:
if shabbos > purim and 2 < (shabbos - purim) < 7:
return _FourParshiosEnum.PARAH
if (rc_nisan - date) < 7:
return _FourParshiosEnum.HACHODESH
Expand Down
2 changes: 2 additions & 0 deletions tests/test_parshios.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def test_parah():
date = dates.HebrewDate(5784, 13, 14)
assert parshios.four_parshios(date, hebrew=True) == 'פרה'
assert parshios.four_parshios(date - 1) != 'Parah'
date = dates.GregorianDate(2025, 3, 9)
assert parshios.four_parshios(date) == ''


def test_hachodesh():
Expand Down

0 comments on commit e23b577

Please sign in to comment.