Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/test_jewish_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,16 @@ def test_is_taanis_bechorim_for_nonstandard_year(self):
expected = ['1-12']
self.assertEqual(all_days, expected)

def test_is_shabbos_mevorchim(self):
year = test.test_helper.leap_shabbos_shelaimim()

all_days = test.test_helper.all_days_matching(year, lambda c: c.is_shabbos_mevorchim()).values()
all_days = [item for sublist in all_days for item in sublist] # flatten
expected = ['7-29', '8-27', '9-25', '10-23',
'11-29', '12-27', '13-25', '1-24',
'2-29', '3-28', '4-26', '5-25']
self.assertEqual(all_days, expected)

def test_is_rosh_chodesh(self):
year = test.test_helper.leap_shabbos_shelaimim()

Expand Down
3 changes: 3 additions & 0 deletions zmanim/hebrew_calendar/jewish_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def is_taanis_bechorim(self) -> bool:
return ((self.day_of_week != 7 and self.jewish_day == 14 and self.jewish_month == 1) or
(self.day_of_week == 5 and self.jewish_day == 12 and self.jewish_month == 1))

def is_shabbos_mevorchim(self) -> bool:
return self.day_of_week == 7 and self.jewish_month != 6 and self.jewish_day in range(23, 30)

def is_rosh_chodesh(self) -> bool:
return self.jewish_day == 30 or (self.jewish_day == 1 and self.jewish_month != 7)

Expand Down