Exemplo n.º 1
0
    def test_get_reading_diaspora(self, year, parshiyot):
        mydate = HDate(hebrew=False, diaspora=True)
        mydate.hdate = HebrewDate(year, 1, 1)

        # Get next Saturday
        tdelta = datetime.timedelta((12 - mydate.gdate.weekday()) % 7)
        mydate.gdate += tdelta

        shabatot = [item for subl in parshiyot for item in subl]
        for shabat in shabatot:
            print("Testing: ", mydate)
            assert mydate.get_reading() == shabat
            mydate.gdate += datetime.timedelta(days=7)
        mydate.hdate = HebrewDate(year, 1, 23)
        # VeZot Habracha in Israel always falls on 22 of Tishri
        assert mydate.get_reading() == 54
Exemplo n.º 2
0
 def test_vayelech_or_haazinu_always_after_rosh_hashana(self, year):
     mydate = HDate(hebrew=False, diaspora=True)
     mydate.hdate = HebrewDate(year, Months.Tishrei, 1)
     tdelta = datetime.timedelta((12 - mydate.gdate.weekday()) % 7)
     # Go to the next shabbat (unless shabbat falls on Rosh Hashana)
     mydate.gdate += tdelta
     print("Testing date: {} which is {} days after Rosh Hashana".format(
         mydate, tdelta))
     assert mydate.get_reading() in [52, 53, 0]
Exemplo n.º 3
0
 def test_nitzavim_always_before_rosh_hashana(self, year):
     mydate = HDate(hebrew=False, diaspora=False)
     mydate.hdate = HebrewDate(year, Months.Tishrei, 1)
     tdelta = datetime.timedelta((12 - mydate.gdate.weekday()) % 7 - 7)
     # Go back to the previous shabbat
     mydate.gdate += tdelta
     print("Testing date: {} which is {} days before Rosh Hashana".format(
         mydate, tdelta))
     assert mydate.get_reading() in [51, 61]
Exemplo n.º 4
0
 def test_rosh_hashana_diaspora_edge_case(self):
     mydate = HDate(hebrew=False, diaspora=True)
     mydate.hdate = HebrewDate(5778, Months.Elul, 29)
     assert mydate.get_reading() == 52
Exemplo n.º 5
0
 def test_last_week_of_the_year(self):
     mydate = HDate()
     mydate.hdate = HebrewDate(5779, Months.Elul, 29)
     assert mydate.get_reading() == 52