def defender_of_fatherland_observance(holidays): # Defender of the Fatherland Day did not follow the next-non-holiday rule # these years. holidays = holidays[(holidays.year != 2013) & (holidays.year != 2014) & (holidays.year != 2019)] return pd.to_datetime([weekend_to_monday(day) for day in holidays])
def test_weekend_to_monday(self): assert weekend_to_monday(self.sa) == self.mo assert weekend_to_monday(self.su) == self.mo assert weekend_to_monday(self.mo) == self.mo
def test_weekend_to_monday(day, expected): assert weekend_to_monday(day) == expected
def test_weekend_to_monday(self): self.assertEqual(weekend_to_monday(self.sa), self.mo) self.assertEqual(weekend_to_monday(self.su), self.mo) self.assertEqual(weekend_to_monday(self.mo), self.mo)
def orthodox_christmas_observance(holidays): # Orthodox Christmas did not follow the next-non-holiday rule these years. holidays = holidays[(holidays.year != 2012) & (holidays.year != 2017)] return pd.to_datetime([weekend_to_monday(day) for day in holidays])
def new_years_holiday_observance(holidays): # New Year's Holiday did not follow the next-non-holiday rule in 2016. holidays = holidays[(holidays.year != 2016)] return pd.to_datetime([weekend_to_monday(day) for day in holidays])
def new_years_eve_observance(holidays): # For some reason New Year's Eve was not a holiday these years. holidays = holidays[(holidays.year != 2008) & (holidays.year != 2009)] return pd.to_datetime([weekend_to_monday(day) for day in holidays])
def new_years_eve_observance(holidays): # New Year's Eve is a holiday every year except for 2003 for some reason. holidays = holidays[holidays.year != 2003] return pd.to_datetime([weekend_to_monday(day) for day in holidays])