Skip to content

Commit

Permalink
Fixes for Australian public holidays (#182) - merge commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-prodigy committed Mar 12, 2019
2 parents 64d2366 + e053a86 commit 8c9dc62
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
8 changes: 6 additions & 2 deletions holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -2243,8 +2243,12 @@ def _populate(self, year):
weekday_delta = WE(-2) if base_data.weekday() == 2 else WE(-1)
self[base_data + rd(weekday=weekday_delta)] = 'Buß- und Bettag'

if year >= 2019 and self.prov == 'BE':
self[date(year, MAR, 8)] = 'Internationaler Frauentag'
if (year >= 2019):
if self.prov == 'TH':
self[date(year, SEP, 20)] = 'Weltkindertag'

if self.prov == 'BE':
self[date(year, MAR, 8)] = 'Internationaler Frauentag'

self[date(year, DEC, 25)] = 'Erster Weihnachtstag'
self[date(year, DEC, 26)] = 'Zweiter Weihnachtstag'
Expand Down
20 changes: 20 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2673,6 +2673,26 @@ def test_christi_himmelfahrt(self):
for province, (y, m, d) in product(holidays.DE.PROVINCES, known_good):
self.assertIn(date(y, m, d), self.prov_hols[province])

def test_weltkindertag(self):
known_good = [(2019, 9, 20), (2021, 9, 20)]

provinces_that_have = {"TH"}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have
for province, (y, m, d) in product(provinces_that_have, known_good):
self.assertIn(date(y, m, d), self.prov_hols[province])
for province, (y, m, d) in product(provinces_that_dont, known_good):
self.assertNotIn(date(y, m, d), self.prov_hols[province])

def test_frauentag(self):
known_good = [(2019, 3, 8), ]

provinces_that_have = {"BE"}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have
for province, (y, m, d) in product(provinces_that_have, known_good):
self.assertIn(date(y, m, d), self.prov_hols[province])
for province, (y, m, d) in product(provinces_that_dont, known_good):
self.assertNotIn(date(y, m, d), self.prov_hols[province])

def test_pfingstsonntag(self):
known_good = [(2014, 6, 8), (2015, 5, 24), (2016, 5, 15),
(2017, 6, 4), (2018, 5, 20), (2019, 6, 9),
Expand Down

0 comments on commit 8c9dc62

Please sign in to comment.