Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_all_holidays_present(self):
de_2015 = sum(holidays.DE(years=[2015], prov=p)
for p in holidays.DE.PROVINCES)
in_2015 = sum((de_2015.get_list(key) for key in de_2015), [])
all = ["Neujahr",
"Heilige Drei Könige",
"Karfreitag",
"Ostern",
"Ostermontag",
"Maifeiertag",
"Christi Himmelfahrt",
"Pfingsten",
"Pfingstmontag",
"Fronleichnam",
"Mariä Himmelfahrt",
"Tag der Deutschen Einheit",
"Reformationstag",
"Allerheiligen",
"Buß- und Bettag",
def test_christi_himmelfahrt(self):
known_good = [(2014, 5, 29), (2015, 5, 14), (2016, 5, 5),
(2017, 5, 25), (2018, 5, 10), (2019, 5, 30),
(2020, 5, 21), (2021, 5, 13), (2022, 5, 26),
(2023, 5, 18), (2024, 5, 9)]
for province, (y, m, d) in product(holidays.DE.PROVINCES, known_good):
self.assertTrue(date(y, m, d) in self.prov_hols[province])
def test_reformationstag(self):
provinces_that_have = set(('BB', 'MV', 'SN', 'ST', 'TH'))
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have
for province, year in product(provinces_that_have, range(1991, 2050)):
self.assertTrue(date(year, 10, 31) in self.prov_hols[province])
for province, year in product(provinces_that_dont, range(1991, 2050)):
self.assertTrue(date(year, 10, 31) not in self.prov_hols[province])
def setUp(self):
self.holidays = holidays.DE()
self.prov_hols = dict((prov, holidays.DE(prov=prov))
for prov in holidays.DE.PROVINCES)