Ejemplo n.º 1
0
 def test_purim(self):
     purims = [dates.HebrewDate(5778, 12, 14),
               dates.HebrewDate(5779, 13, 14)]
     for purim in purims:
         assert holiday(purim) == 'Purim'
         assert holiday(purim + 1) == 'Shushan Purim'
     assert holiday(dates.HebrewDate(5779, 12, 14)) == 'Purim Katan'
Ejemplo n.º 2
0
 def test_pesach(self):
     pesach = dates.HebrewDate(5778, 1, 15)
     for i in range(6):
         assert (holiday(pesach + i, True) == 'Pesach'
                 and holiday(pesach + i) == 'Pesach')
     eighth = pesach + 7
     assert holiday(eighth) == 'Pesach' and holiday(eighth, True) is None
     assert holiday(eighth + 1) is None
Ejemplo n.º 3
0
 def test_purim(self):
     purims = [
         dates.HebrewDate(5778, 12, 14),
         dates.HebrewDate(5779, 13, 14)
     ]
     for purim in purims:
         assert holiday(purim) == 'Purim'
         assert holiday(purim + 1) == 'Shushan Purim'
     assert holiday(dates.HebrewDate(5779, 12, 14)) == 'Purim Katan'
Ejemplo n.º 4
0
 def test_pesach(self):
     pesach = dates.HebrewDate(5778, 1, 15)
     for i in range (6):
         assert (
                 holiday(pesach + i, True) == 'Pesach' and
                 holiday(pesach + i) == 'Pesach'
                )
     eighth = pesach + 7
     assert holiday(eighth) == 'Pesach' and holiday(eighth, True) is None
     assert holiday(eighth + 1) is None
Ejemplo n.º 5
0
 def test_roshhashana(self):
     roshhashana = dates.HebrewDate(5779, 7, 1)
     assert all([
         holiday(day, location) == 'Rosh Hashana'
         for day in [roshhashana, roshhashana + 1]
         for location in [True, False]
     ])
Ejemplo n.º 6
0
 def test_esther(self):
     fasts = [
         dates.HebrewDate(5778, 12, 13),
         dates.HebrewDate(5776, 13, 13),
         dates.HebrewDate(5777, 12, 11),  #nidche
         dates.HebrewDate(5784, 13, 11)  #ibbur and nidche
     ]
     for fast in fasts:
         assert holiday(fast) == 'Taanis Esther'
     non_fasts = [
         dates.HebrewDate(5776, 12, 13),
         dates.HebrewDate(5777, 12, 13),
         dates.HebrewDate(5784, 12, 11),
         dates.HebrewDate(5784, 13, 13)
     ]
     for non in non_fasts:
         assert holiday(non) is None
Ejemplo n.º 7
0
 def test_esther(self):
     fasts = [
         dates.HebrewDate(5778, 12, 13),
         dates.HebrewDate(5776, 13, 13),
         dates.HebrewDate(5777, 12, 11),  #nidche
         dates.HebrewDate(5784, 13, 11)  #ibbur and nidche
     ]
     for fast in fasts:
         assert holiday(fast)  == 'Taanis Esther'
     non_fasts = [
         dates.HebrewDate(5776, 12, 13),
         dates.HebrewDate(5777, 12, 13),
         dates.HebrewDate(5784, 12, 11),
         dates.HebrewDate(5784, 13, 13)
     ]
     for non in non_fasts:
         assert holiday(non) is None
Ejemplo n.º 8
0
def get_holiday(date=dates.HebrewDate.today()):
    """
    If not fast today, check if tomorrow is a holiday

    :param date: the date to check. typeof `dates.HebrewDate` from `pyluach`
    :return: tuple (name => string, is_holiday => bool) or None if no holiday
    """
    fast_table = hebrewcal._fast_day_table(date.year)
    if date in fast_table:
        return fast_table[date], False
    holiday = hebrewcal.holiday(date + 1, israel=True)
    if holiday:
        return holiday, True
    return None, None
Ejemplo n.º 9
0
 def test_chanuka(self):
     for year in [5778, 5787]:
         chanuka = dates.HebrewDate(year, 9, 25)
         for i in range(8):
             assert holiday(chanuka + i) == 'Chanuka'
         assert holiday(chanuka + 8) is None
Ejemplo n.º 10
0
 def test_shmini(self):
     shmini = dates.HebrewDate(5780, 7, 22)
     assert holiday(shmini, True) == 'Shmini Atzeres'
     assert holiday(shmini) == 'Shmini Atzeres'
     assert holiday(shmini + 1) == 'Simchas Torah'
     assert holiday(shmini + 1, True) is None
Ejemplo n.º 11
0
 def test_lagbaomer(self):
     assert holiday(dates.GregorianDate(2018, 5, 3)) == "Lag Ba'omer"
Ejemplo n.º 12
0
 def test_asara(self):
     assert holiday(dates.GregorianDate(2018, 12, 18)) == '10 of Teves'
Ejemplo n.º 13
0
 def test_tubeav(self):
     assert holiday(dates.HebrewDate(5779, 5, 15)) == "Tu B'av"
Ejemplo n.º 14
0
 def test_lagbaomer(self):
     assert holiday(dates.GregorianDate(2018, 5, 3)) == "Lag Ba'omer"
Ejemplo n.º 15
0
 def test_shmini(self):
     shmini = dates.HebrewDate(5780, 7, 22)
     assert holiday(shmini, True) == 'Shmini Atzeres'
     assert holiday(shmini) == 'Shmini Atzeres'
     assert holiday(shmini + 1) == 'Simchas Torah'
     assert holiday(shmini + 1, True) is None
Ejemplo n.º 16
0
 def test_av(self):
     fasts = [dates.HebrewDate(5777, 5, 9), dates.HebrewDate(5778, 5, 10)]
     for fast in fasts:
         assert holiday(fast) == '9 of Av'
     assert holiday(dates.HebrewDate(5778, 5, 9)) is None
Ejemplo n.º 17
0
 def test_tamuz(self):
     fasts = [dates.HebrewDate(5777, 4, 17), dates.HebrewDate(5778, 4, 18)]
     for fast in fasts:
         assert holiday(fast) == '17 of Tamuz'
     assert holiday(dates.HebrewDate(5778, 4, 17)) is None
Ejemplo n.º 18
0
 def test_asara(self):
     assert holiday(dates.GregorianDate(2018, 12, 18)) == '10 of Teves'
Ejemplo n.º 19
0
 def test_gedalia(self):
     assert holiday(dates.HebrewDate(5779, 7, 3)) == 'Tzom Gedalia'
     assert holiday(dates.HebrewDate(5778, 7, 3)) is None
     assert holiday(dates.HebrewDate(5778, 7, 4)) == 'Tzom Gedalia'
Ejemplo n.º 20
0
 def test_tubeav(self):
     assert holiday(dates.HebrewDate(5779, 5, 15)) == "Tu B'av"
Ejemplo n.º 21
0
 def test_shavuos(self):
     shavuos = dates.HebrewDate(5778, 3, 6)
     assert all([holiday(day) == 'Shavuos' for day in [shavuos, shavuos + 1]])
     assert holiday(shavuos, True) == 'Shavuos'
     assert holiday(shavuos + 1, True) is None
Ejemplo n.º 22
0
 def test_tubshvat(self):
     assert holiday(dates.HebrewDate(5779, 11, 15)) == "Tu B'shvat"
Ejemplo n.º 23
0
 def test_chanuka(self):
     chanuka = dates.HebrewDate(5778, 9, 25)
     for i in range(8):
         assert holiday(chanuka + i) == 'Chanuka'
Ejemplo n.º 24
0
 def test_roshhashana(self):
     roshhashana = dates.HebrewDate(5779, 7, 1)
     assert all([holiday(day, location) == 'Rosh Hashana'
                 for day in[roshhashana, roshhashana + 1]
                 for location in [True, False]
                ])
Ejemplo n.º 25
0
 def test_pesach_sheni(self):
     ps = dates.HebrewDate(5781, 2, 14)
     assert holiday(ps) == 'Pesach Sheni'
     assert holiday(ps + 1) is None
Ejemplo n.º 26
0
 def test_tamuz(self):
     fasts = [dates.HebrewDate(5777, 4, 17), dates.HebrewDate(5778, 4, 18)]
     for fast in fasts:
         assert holiday(fast) == '17 of Tamuz'
     assert holiday(dates.HebrewDate(5778, 4, 17)) is None
Ejemplo n.º 27
0
 def test_shavuos(self):
     shavuos = dates.HebrewDate(5778, 3, 6)
     assert all(
         [holiday(day) == 'Shavuos' for day in [shavuos, shavuos + 1]])
     assert holiday(shavuos, True) == 'Shavuos'
     assert holiday(shavuos + 1, True) is None
Ejemplo n.º 28
0
 def test_succos(self):
     day = dates.HebrewDate(5778, 7, 18)
     assert holiday(day) == 'Succos'
     day2 = dates.HebrewDate(5778, 7, 23)
     assert holiday(day2, israel=True) is None
Ejemplo n.º 29
0
 def test_gedalia(self):
     assert holiday(dates.HebrewDate(5779, 7, 3)) == 'Tzom Gedalia'
     assert holiday(dates.HebrewDate(5778, 7, 3)) is None
     assert holiday(dates.HebrewDate(5778, 7, 4)) == 'Tzom Gedalia'
Ejemplo n.º 30
0
 def test_yomkippur(self):
     assert holiday(dates.HebrewDate(5775, 7, 10)) == 'Yom Kippur'
Ejemplo n.º 31
0
 def test_succos(self):
     day = dates.HebrewDate(5778, 7, 18)
     assert holiday(day) == 'Succos'
     day2 = dates.HebrewDate(5778, 7, 23)
     assert holiday(day2, israel=True) is None
Ejemplo n.º 32
0
 def test_tubshvat(self):
     assert holiday(dates.HebrewDate(5779, 11, 15)) == "Tu B'shvat"
Ejemplo n.º 33
0
 def test_av(self):
     fasts = [dates.HebrewDate(5777, 5, 9), dates.HebrewDate(5778, 5, 10)]
     for fast in fasts:
         assert holiday(fast) == '9 of Av'
     assert holiday(dates.HebrewDate(5778, 5, 9)) is None
Ejemplo n.º 34
0
 def test_yomkippur(self):
     assert holiday(dates.HebrewDate(5775, 7, 10)) == 'Yom Kippur'