def testNorthIsland(self): hols = parseHolidays("NZ[NTL,AUK,HKB,TKI,WGN]") self.assertEqual(hols.get(dt.date(2020, 1, 20)), "Wellington Anniversary Day") self.assertEqual(hols.get(dt.date(2020, 1, 27)), "Auckland Anniversary Day") self.assertEqual(hols.get(dt.date(2020, 3, 9)), "Taranaki Anniversary Day") self.assertEqual(hols.get(dt.date(2020, 10, 23)), "Hawke's Bay Anniversary Day")
def testInvalidCountry(self): self.assertIsNone(parseHolidays("Ruritania"))
def testNelson(self): hols = parseHolidays("NZ[Nelson]") self.assertEqual(hols.get(dt.date(2020, 2, 3)), "Nelson Anniversary Day")
def testCountriesNE(self): hols = parseHolidays("*[NE]") self.assertEqual(hols.get(dt.date(2019, 3, 1)), "Jahrestag der Ausrufung der Republik") self.assertEqual(hols.get(dt.date(2019, 4, 26)), "Arbor Day")
def testAllCountries(self): from ls.joyous.holidays.parser import _PYTHON_HOLIDAYS_MAP hols = parseHolidays("*") classes = [hol.__class__ for hol in hols.holidays if hol.country] self.assertCountEqual(classes, _PYTHON_HOLIDAYS_MAP.values())
def testScotland(self): hols = parseHolidays("Scotland") self.assertEqual(hols.get(dt.date(2019, 11, 30)), "St. Andrew's Day")