Hello community,
here is the log from the commit of package python-holidays for openSUSE:Factory
checked in at 2019-09-13 15:00:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-holidays (Old)
and /work/SRC/openSUSE:Factory/.python-holidays.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-holidays"
Fri Sep 13 15:00:25 2019 rev:3 rq:730322 version:0.9.11
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-holidays/python-holidays.changes
2019-04-05 12:02:57.682576636 +0200
+++
/work/SRC/openSUSE:Factory/.python-holidays.new.7948/python-holidays.changes
2019-09-13 15:00:37.561283103 +0200
@@ -1,0 +2,17 @@
+Thu Sep 12 09:00:03 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.9.11:
+ - Added Japanese holidays for new Emperor (kokinamura)
+ - Fixed Australian Canberra day holiday (explodingdinosaurs, dr-p)
+ - Added support for Estonian holidays (RaulVS14)
+ - Added support for Iceland and Kenya (justinasfour04)
+ - Added support for Aruba (orson1282)
+ - Added support for Hong Kong (polifaces)
+ - Added support for Peru (manuelvalino)
+ - Switzerland fixes (spasche)
+ - Croatia fix (pave121, dr-p)
+ - Polish deprecation: replaced by Poland (dr-p)
+ - Czech(ia) - Slovak(ia) fixes (dr-p)
+ - Allow passing years to CountryHoliday (mr.shu)
+
+-------------------------------------------------------------------
Old:
----
holidays-0.9.10.tar.gz
New:
----
holidays-0.9.11.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-holidays.spec ++++++
--- /var/tmp/diff_new_pack.bN9zUO/_old 2019-09-13 15:00:38.445283140 +0200
+++ /var/tmp/diff_new_pack.bN9zUO/_new 2019-09-13 15:00:38.449283140 +0200
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-holidays
-Version: 0.9.10
+Version: 0.9.11
Release: 0
Summary: Python library for generating holidays on the fly
License: MIT
++++++ holidays-0.9.10.tar.gz -> holidays-0.9.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/holidays-0.9.10/CHANGES new/holidays-0.9.11/CHANGES
--- old/holidays-0.9.10/CHANGES 2019-03-12 22:36:43.000000000 +0100
+++ new/holidays-0.9.11/CHANGES 2019-07-28 19:01:11.000000000 +0200
@@ -1,3 +1,21 @@
+Version 0.9.11
+==============
+
+Released July 28, 2019
+
+- Added Japanese holidays for new Emperor (kokinamura)
+- Fixed Australian Canberra day holiday (explodingdinosaurs, dr-p)
+- Added support for Estonian holidays (RaulVS14)
+- Added support for Iceland and Kenya (justinasfour04)
+- Added support for Aruba (orson1282)
+- Added support for Hong Kong (polifaces)
+- Added support for Peru (manuelvalino)
+- Switzerland fixes (spasche)
+- Croatia fix (pave121, dr-p)
+- Polish deprecation: replaced by Poland (dr-p)
+- Czech(ia) - Slovak(ia) fixes (dr-p)
+- Allow passing years to CountryHoliday (mr.shu)
+
Version 0.9.10
==============
@@ -73,6 +91,7 @@
- Added Switzerland with all cantons (Phil)
- Canada holiday updates (goodfore)
- Various inspection fixes
+- Czech deprecation: replaced by Czechia (janpipek)
Version 0.9.2
=============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/holidays-0.9.10/PKG-INFO new/holidays-0.9.11/PKG-INFO
--- old/holidays-0.9.10/PKG-INFO 2019-03-12 22:39:18.000000000 +0100
+++ new/holidays-0.9.11/PKG-INFO 2019-07-28 19:04:08.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: holidays
-Version: 0.9.10
+Version: 0.9.11
Summary: Generate and work with holidays in Python
Home-page: https://github.com/dr-prodigy/python-holidays
Author: dr-prodigy
@@ -107,6 +107,7 @@
Country Abbr Provinces/States Available
=================== ========
=============================================================
Argentina AR None
+ Aruba AW None
Australia AU prov = **ACT** (default), NSW, NT, QLD,
SA, TAS, VIC, WA
Austria AT prov = B, K, N, O, S, ST, T, V, **W**
(default)
Belarus BY None
@@ -118,9 +119,10 @@
PE, QC, SK, YU
Colombia CO None
Croatia HR None
- Czech CZ None
+ Czechia CZ None
Denmark DK None
England None
+ Estonia EE None
EuropeanCentralBank ECB,TAR Trans-European Automated Real-time Gross
Settlement (TARGET2)
Finland FI None
France FRA **Métropole** (default), Alsace-Moselle,
Guadeloupe, Guyane,
@@ -130,6 +132,7 @@
Germany DE prov = BW, BY, BE, BB, HB, HH, HE, MV,
NI, NW, RP, SL, SN,
ST, SH, TH
Hungary HU None
+ Iceland IS None
India IND prov = AS, SK, CG, KA, GJ, BR, RJ, OD,
TN, AP, WB, KL, HR,
MH, MP, UP, UK, TN
Ireland IE None
@@ -138,6 +141,7 @@
EN, FC, FE, FI, Forlì, FR, GE, GO, IS,
KR, LT, MB, MI, MO,
MN, MS, NA, PA, PC, PD, PG, PR, RM, SP,
TS, VI
Japan JP None
+ Kenya KE None
Lithuania LT None
Luxembourg LU None
Mexico MX None
@@ -146,13 +150,14 @@
OTA, STL, CIT
Northern Ireland None
Norway NO None
- Polish PL None
+ Peru PE None
+ Poland PL None
Portugal PT None
PortugalExt PTE *Portugal plus extended days most people
have off*
Russia RU None
Scotland None
- Slovenia SI None
Slovakia SK None
+ Slovenia SI None
South Africa ZA None
Spain ES prov = AND, ARG, AST, CAN, CAM, CAL, CAT,
CVA, EXT, GAL,
IBA, ICA, MAD, MUR, NAV, PVA, RIO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/holidays-0.9.10/README.rst
new/holidays-0.9.11/README.rst
--- old/holidays-0.9.10/README.rst 2019-03-12 22:20:04.000000000 +0100
+++ new/holidays-0.9.11/README.rst 2019-07-28 10:44:45.000000000 +0200
@@ -98,6 +98,7 @@
Country Abbr Provinces/States Available
=================== ========
=============================================================
Argentina AR None
+Aruba AW None
Australia AU prov = **ACT** (default), NSW, NT, QLD, SA, TAS,
VIC, WA
Austria AT prov = B, K, N, O, S, ST, T, V, **W** (default)
Belarus BY None
@@ -109,9 +110,10 @@
PE, QC, SK, YU
Colombia CO None
Croatia HR None
-Czech CZ None
+Czechia CZ None
Denmark DK None
England None
+Estonia EE None
EuropeanCentralBank ECB,TAR Trans-European Automated Real-time Gross
Settlement (TARGET2)
Finland FI None
France FRA **Métropole** (default), Alsace-Moselle,
Guadeloupe, Guyane,
@@ -121,6 +123,7 @@
Germany DE prov = BW, BY, BE, BB, HB, HH, HE, MV, NI, NW,
RP, SL, SN,
ST, SH, TH
Hungary HU None
+Iceland IS None
India IND prov = AS, SK, CG, KA, GJ, BR, RJ, OD, TN, AP,
WB, KL, HR,
MH, MP, UP, UK, TN
Ireland IE None
@@ -129,6 +132,7 @@
EN, FC, FE, FI, Forlì, FR, GE, GO, IS, KR, LT,
MB, MI, MO,
MN, MS, NA, PA, PC, PD, PG, PR, RM, SP, TS, VI
Japan JP None
+Kenya KE None
Lithuania LT None
Luxembourg LU None
Mexico MX None
@@ -137,13 +141,14 @@
OTA, STL, CIT
Northern Ireland None
Norway NO None
-Polish PL None
+Peru PE None
+Poland PL None
Portugal PT None
PortugalExt PTE *Portugal plus extended days most people have off*
Russia RU None
Scotland None
-Slovenia SI None
Slovakia SK None
+Slovenia SI None
South Africa ZA None
Spain ES prov = AND, ARG, AST, CAN, CAM, CAL, CAT, CVA,
EXT, GAL,
IBA, ICA, MAD, MUR, NAV, PVA, RIO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/holidays-0.9.10/holidays.egg-info/PKG-INFO
new/holidays-0.9.11/holidays.egg-info/PKG-INFO
--- old/holidays-0.9.10/holidays.egg-info/PKG-INFO 2019-03-12
22:39:18.000000000 +0100
+++ new/holidays-0.9.11/holidays.egg-info/PKG-INFO 2019-07-28
19:04:08.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: holidays
-Version: 0.9.10
+Version: 0.9.11
Summary: Generate and work with holidays in Python
Home-page: https://github.com/dr-prodigy/python-holidays
Author: dr-prodigy
@@ -107,6 +107,7 @@
Country Abbr Provinces/States Available
=================== ========
=============================================================
Argentina AR None
+ Aruba AW None
Australia AU prov = **ACT** (default), NSW, NT, QLD,
SA, TAS, VIC, WA
Austria AT prov = B, K, N, O, S, ST, T, V, **W**
(default)
Belarus BY None
@@ -118,9 +119,10 @@
PE, QC, SK, YU
Colombia CO None
Croatia HR None
- Czech CZ None
+ Czechia CZ None
Denmark DK None
England None
+ Estonia EE None
EuropeanCentralBank ECB,TAR Trans-European Automated Real-time Gross
Settlement (TARGET2)
Finland FI None
France FRA **Métropole** (default), Alsace-Moselle,
Guadeloupe, Guyane,
@@ -130,6 +132,7 @@
Germany DE prov = BW, BY, BE, BB, HB, HH, HE, MV,
NI, NW, RP, SL, SN,
ST, SH, TH
Hungary HU None
+ Iceland IS None
India IND prov = AS, SK, CG, KA, GJ, BR, RJ, OD,
TN, AP, WB, KL, HR,
MH, MP, UP, UK, TN
Ireland IE None
@@ -138,6 +141,7 @@
EN, FC, FE, FI, Forlì, FR, GE, GO, IS,
KR, LT, MB, MI, MO,
MN, MS, NA, PA, PC, PD, PG, PR, RM, SP,
TS, VI
Japan JP None
+ Kenya KE None
Lithuania LT None
Luxembourg LU None
Mexico MX None
@@ -146,13 +150,14 @@
OTA, STL, CIT
Northern Ireland None
Norway NO None
- Polish PL None
+ Peru PE None
+ Poland PL None
Portugal PT None
PortugalExt PTE *Portugal plus extended days most people
have off*
Russia RU None
Scotland None
- Slovenia SI None
Slovakia SK None
+ Slovenia SI None
South Africa ZA None
Spain ES prov = AND, ARG, AST, CAN, CAM, CAL, CAT,
CVA, EXT, GAL,
IBA, ICA, MAD, MUR, NAV, PVA, RIO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/holidays-0.9.10/holidays.py
new/holidays-0.9.11/holidays.py
--- old/holidays-0.9.10/holidays.py 2019-03-12 22:26:14.000000000 +0100
+++ new/holidays-0.9.11/holidays.py 2019-07-28 19:03:14.000000000 +0200
@@ -20,7 +20,7 @@
import warnings
-__version__ = '0.9.10'
+__version__ = '0.9.11'
MON, TUE, WED, THU, FRI, SAT, SUN = range(7)
WEEKEND = (SAT, SUN)
@@ -228,14 +228,85 @@
return HolidaySum
-def CountryHoliday(country, prov=None, state=None):
+def CountryHoliday(country, years=[], prov=None, state=None):
try:
- country_holiday = globals()[country](prov=prov, state=state)
+ country_holiday = globals()[country](years=years,
+ prov=prov, state=state)
except (KeyError):
raise KeyError("Country %s not available" % country)
return country_holiday
+class Aruba(HolidayBase):
+ #
http://www.gobierno.aw/informacion-tocante-servicio/vakantie-y-dia-di-fiesta_43437/item/dia-di-fiesta_14809.html
+ #
https://www.visitaruba.com/about-aruba/national-holidays-and-celebrations/
+
+ def __init__(self, **kwargs):
+ self.country = 'AW'
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ # New Year's Day
+ self[date(year, JAN, 1)] = "Aña Nobo [New Year's Day]"
+
+ # Dia di Betico
+ self[date(year, JAN, 25)] = "Dia Di Betico [Betico Day]"
+
+ # Carnaval Monday
+ self[easter(year) + rd(days=-48)] = "Dialuna di Carnaval \
+ [Carnaval Monday]"
+
+ # Dia di Himno y Bandera
+ self[date(year, MAR, 18)] = "Dia di Himno y Bandera \
+ [National Anthem & Flag Day]"
+
+ # Good Friday
+ self[easter(year) + rd(weekday=FR(-1))] = "Bierna Santo [Good Friday]"
+
+ # Easter Monday
+ self[easter(year) + rd(days=1)] = "Di Dos Dia di Pasco di Resureccion \
+ [Easter Monday]"
+
+ # King's Day
+ if year >= 2014:
+ kings_day = date(year, APR, 27)
+ if kings_day.weekday() == 6:
+ kings_day = kings_day - rd(days=1)
+
+ self[kings_day] = "Aña di Rey [King's Day]"
+
+ # Queen's Day
+ if 1891 <= year <= 2013:
+ queens_day = date(year, APR, 30)
+ if year <= 1948:
+ queens_day = date(year, AUG, 31)
+
+ if queens_day.weekday() == 6:
+ if year < 1980:
+ queens_day = queens_day + rd(days=1)
+ else:
+ queens_day = queens_day - rd(days=1)
+
+ self[queens_day] = "Aña di La Reina [Queen's Day]"
+
+ # Labour Day
+ self[date(year, MAY, 1)] = "Dia di Obrero [Labour Day]"
+
+ # Ascension Day
+ self[easter(year) + rd(days=39)] = "Dia di Asuncion [Ascension Day]"
+
+ # Christmas Day
+ self[date(year, DEC, 25)] = "Pasco di Nacemento [Christmas]"
+
+ # Second Christmas
+ self[date(year, DEC, 26)] = "Di Dos Dia di Pasco di \
+ Nacemento [Second Christmas]"
+
+
+class AW(Aruba):
+ pass
+
+
class Argentina(HolidayBase):
# https://www.argentina.gob.ar/interior/feriados
# https://es.wikipedia.org/wiki/Anexo:D%C3%ADas_feriados_en_Argentina
@@ -682,6 +753,8 @@
self[date(year, FEB, 1) + rd(weekday=MO(+3))] = "Family Day"
elif self.prov == 'AB' and year >= 1990:
self[date(year, FEB, 1) + rd(weekday=MO(+3))] = "Family Day"
+ elif self.prov == 'NB' and year >= 2018:
+ self[date(year, FEB, 1) + rd(weekday=MO(+3))] = "Family Day"
elif self.prov == 'BC':
if year >= 2013 and year <= 2018:
self[date(year, FEB, 1) + rd(weekday=MO(+2))] = \
@@ -1970,9 +2043,18 @@
self[date(year, MAR, 1) + rd(weekday=MO(+3))] = name
# Canberra Day
- if self.prov == 'ACT':
+ # Info from https://www.timeanddate.com/holidays/australia/canberra-day
+ # and https://en.wikipedia.org/wiki/Canberra_Day
+ if self.prov == 'ACT' and year >= 1913:
name = "Canberra Day"
- self[date(year, MAR, 1) + rd(weekday=MO(+1))] = name
+ if year >= 1913 and year <= 1957:
+ self[date(year, MAR, 12)] = name
+ elif year >= 1958 and year <= 2007:
+ self[date(year, MAR, 1) + rd(weekday=MO(+3))] = name
+ elif year >= 2008 and year != 2012:
+ self[date(year, MAR, 1) + rd(weekday=MO(+2))] = name
+ elif year == 2012:
+ self[date(year, MAR, 12)] = name
# Easter
self[easter(year) + rd(weekday=FR(-1))] = "Good Friday"
@@ -2484,6 +2566,10 @@
pass
+class GB(UnitedKingdom):
+ pass
+
+
class England(UnitedKingdom):
def __init__(self, **kwargs):
@@ -2677,13 +2763,13 @@
class Czech(Czechia):
- def __init__(self):
+ def __init__(self, **kwargs):
warnings.warn("Czech is deprecated, use Czechia instead.",
DeprecationWarning)
super(Czech, self).__init__()
-class Slovak(HolidayBase):
+class Slovakia(HolidayBase):
# https://sk.wikipedia.org/wiki/Sviatok
# https://www.slov-lex.sk/pravne-predpisy/SK/ZZ/1993/241/20181011.html
@@ -2729,11 +2815,18 @@
self[date(year, DEC, 26)] = "Druhý sviatok vianočný"
-class SK(Slovak):
+class SK(Slovakia):
pass
-class Polish(HolidayBase):
+class Slovak(Slovakia):
+ def __init__(self, **kwargs):
+ warnings.warn("Slovak is deprecated, use Slovakia instead.",
+ DeprecationWarning)
+ super(Slovak, self).__init__()
+
+
+class Poland(HolidayBase):
# https://pl.wikipedia.org/wiki/Dni_wolne_od_pracy_w_Polsce
def __init__(self, **kwargs):
@@ -2767,7 +2860,14 @@
self[date(year, DEC, 26)] = 'Boże Narodzenie (drugi dzień)'
-class PL(Polish):
+class Polish(Poland):
+ def __init__(self, **kwargs):
+ warnings.warn("Polish is deprecated, use Poland instead.",
+ DeprecationWarning)
+ super(Polish, self).__init__()
+
+
+class PL(Poland):
pass
@@ -3244,10 +3344,14 @@
# Foundation Day
self[date(year, FEB, 11)] = "建国記念の日"
+ # Reiwa Emperor's Birthday
+ if year >= 2020:
+ self[date(year, FEB, 23)] = '天皇誕生日'
+
# Vernal Equinox Day
self[self._vernal_equinox_day(year)] = "春分の日"
- # The former Emperor's Birthday, Greenery Day or Showa Day
+ # Showa Emperor's Birthday, Greenery Day or Showa Day
if year <= 1988:
self[date(year, APR, 29)] = "天皇誕生日"
elif year <= 2006:
@@ -3296,10 +3400,17 @@
# Labour Thanksgiving Day
self[date(year, NOV, 23)] = "勤労感謝の日"
- # The Emperor's Birthday
- if year >= 1989:
+ # Heisei Emperor's Birthday
+ if 1989 <= year <= 2018:
self[date(year, DEC, 23)] = "天皇誕生日"
+ # Regarding the Emperor of Reiwa
+ if year == 2019:
+ # Enthronement Day
+ self[date(year, MAY, 1)] = '天皇の即位の日'
+ # Enthronement ceremony
+ self[date(year, OCT, 22)] = '即位礼正殿の儀が行われる日'
+
# A weekday between national holidays becomes a holiday too (国民の休日)
self._add_national_holidays(year)
@@ -3353,6 +3464,10 @@
if year in (2009, 2015, 2026, 2037, 2043, 2054, 2065, 2071, 2099):
self[date(year, SEP, 22)] = "国民の休日"
+ if year == 2019:
+ self[date(year, APR, 30)] = '国民の休日'
+ self[date(year, MAY, 2)] = '国民の休日'
+
def _add_substitute_holidays(self, year):
table = (
(1, 2, (1978, 1984, 1989, 1995, 2006, 2012, 2017, 2023, 2034, 2040,
@@ -3360,6 +3475,7 @@
(1, 16, (1978, 1984, 1989, 1995)),
(2, 12, (1979, 1990, 1996, 2001, 2007, 2018, 2024, 2029, 2035,
2046)),
+ (2, 24, (2020,)),
(3, 21, (1988, 2005, 2016, 2033, 2044, 2050)),
(3, 22, (1982, 1999, 2010, 2027)),
(4, 30, (1973, 1979, 1984, 1990, 2001, 2007, 2012, 2018, 2029,
@@ -3854,6 +3970,11 @@
'VS', 'ZG'):
self[date(year, AUG, 15)] = 'Maria Himmelfahrt'
+ if self.prov == 'VD':
+ # Monday after the third Sunday of September
+ dt = date(year, SEP, 1) + rd(weekday=SU(+3)) + rd(weekday=MO)
+ self[dt] = 'Lundi du Jeûne'
+
if self.prov == 'OW':
self[date(year, SEP, 25)] = 'Bruder Klaus'
@@ -4185,7 +4306,7 @@
self[date(year, JUN, 22)] = "Dan antifašističke borbe"
# Statehood day
- self[date(year, JUN, 22)] = "Dan državnosti"
+ self[date(year, JUN, 25)] = "Dan državnosti"
# Victory and Homeland Thanksgiving Day
self[date(year, AUG, 5)] = "Dan pobjede i domovinske zahvalnosti"
@@ -4353,3 +4474,483 @@
class LT(Lithuania):
pass
+
+
+class Estonia(HolidayBase):
+ def __init__(self, **kwargs):
+ self.country = "EE"
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ e = easter(year)
+
+ # New Year's Day
+ self[date(year, JAN, 1)] = "uusaasta"
+
+ # Independence Day, anniversary of the Republic of Estonia
+ self[date(year, FEB, 24)] = "iseseisvuspäev"
+
+ # Good Friday
+ self[e - rd(days=2)] = "suur reede"
+
+ # Easter Sunday
+ self[e] = "ülestõusmispühade 1. püha"
+
+ # Spring Day
+ self[date(year, MAY, 1)] = "kevadpüha"
+
+ # Pentecost
+ self[e + rd(days=49)] = "nelipühade 1. püha"
+
+ # Victory Day
+ self[date(year, JUN, 23)] = "võidupüha"
+
+ # Midsummer Day
+ self[date(year, JUN, 24)] = "jaanipäev"
+
+ # Day of Restoration of Independence
+ self[date(year, AUG, 20)] = "taasiseseisvumispäev"
+
+ # Christmas Eve
+ self[date(year, DEC, 24)] = "jõululaupäev"
+
+ # Christmas Day
+ self[date(year, DEC, 25)] = "esimene jõulupüha"
+
+ # Boxing Day
+ self[date(year, DEC, 26)] = "teine jõulupüha"
+
+
+class EE(Estonia):
+ pass
+
+
+class Iceland(HolidayBase):
+ # https://en.wikipedia.org/wiki/Public_holidays_in_Iceland
+ # https://www.officeholidays.com/countries/iceland/index.php
+ def __init__(self, **kwargs):
+ self.country = "IS"
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ # Public holidays
+ self[date(year, JAN, 1)] = "Nýársdagur"
+ self[easter(year) - rd(days=3)] = "Skírdagur"
+ self[easter(year)] = "Páskadagur"
+ self[easter(year) + rd(days=1)] = "Annar í páskum"
+ self[date(year, APR, 19) + rd(weekday=TH(+1))] = \
+ "Sumardagurinn fyrsti"
+ self[date(year, MAY, 1)] = "Verkalýðsdagurinn"
+ self[easter(year) + rd(days=39)] = "Uppstigningardagur"
+ self[easter(year) + rd(days=49)] = "Hvítasunnudagur"
+ self[easter(year) + rd(days=50)] = "Annar í hvítasunnu"
+ self[date(year, JUN, 17)] = "Þjóðhátíðardagurinn"
+ # First Monday of August
+ self[date(year, AUG, 1) + rd(weekday=MO(+1))] = \
+ "Frídagur verslunarmanna"
+ self[date(year, DEC, 24)] = "Aðfangadagur"
+ self[date(year, DEC, 25)] = "Jóladagur"
+ self[date(year, DEC, 26)] = "Annar í jólum"
+ self[date(year, DEC, 31)] = "Gamlársdagur"
+
+
+class IS(Iceland):
+ pass
+
+
+class Kenya(HolidayBase):
+ # https://en.wikipedia.org/wiki/Public_holidays_in_Kenya
+ # http://kenyaembassyberlin.de/Public-Holidays-in-Kenya.48.0.html
+ def __init__(self, **kwargs):
+ self.country = "KE"
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ # Public holidays
+ self[date(year, JAN, 1)] = "New Year's Day"
+ self[date(year, MAY, 1)] = "Labour Day"
+ self[date(year, JUN, 1)] = "Madaraka Day"
+ self[date(year, OCT, 20)] = "Mashujaa Day"
+ self[date(year, DEC, 12)] = "Jamhuri (Independence) Day"
+ self[date(year, DEC, 25)] = "Christmas Day"
+ self[date(year, DEC, 26)] = "Boxing Day"
+ for k, v in list(self.items()):
+ if self.observed and k.weekday() == SUN:
+ self[k + rd(days=1)] = v + " (Observed)"
+
+ self[easter(year) - rd(weekday=FR(-1))] = "Good Friday"
+ self[easter(year) + rd(weekday=MO(+1))] = "Easter Monday"
+
+
+class KE(Kenya):
+ pass
+
+
+class HongKong(HolidayBase):
+
+ # https://www.gov.hk/en/about/abouthk/holiday/2020.htm
+ # https://en.wikipedia.org/wiki/Public_holidays_in_Hong_Kong
+
+ def __init__(self, **kwargs):
+ self.country = "HK"
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+
+ day_following = "The day following "
+
+ # The first day of January
+ name = "The first day of January"
+ first_date = date(year, JAN, 1)
+ if self.observed:
+ if first_date.weekday() == SUN:
+ self[first_date + rd(days=+1)] = day_following + \
+ self.first_lower(name)
+ first_date = first_date + rd(days=+1)
+ else:
+ self[first_date] = name
+ else:
+ self[first_date] = name
+
+ # Lunar New Year
+ name = "Lunar New Year's Day"
+ preceding_day_lunar = "The day preceding Lunar New Year's Day"
+ second_day_lunar = "The second day of Lunar New Year"
+ third_day_lunar = "The third day of Lunar New Year"
+ fourth_day_lunar = "The fourth day of Lunar New Year"
+ dt = self.get_solar_date(year, 1, 1)
+ new_year_date = date(dt.year, dt.month, dt.day)
+ if self.observed:
+ self[new_year_date] = name
+ if new_year_date.weekday() in [MON, TUE, WED, THU]:
+ self[new_year_date] = name
+ self[new_year_date + rd(days=+1)] = second_day_lunar
+ self[new_year_date + rd(days=+2)] = third_day_lunar
+ elif new_year_date.weekday() == FRI:
+ self[new_year_date] = name
+ self[new_year_date + rd(days=+1)] = second_day_lunar
+ self[new_year_date + rd(days=+3)] = fourth_day_lunar
+ elif new_year_date.weekday() == SAT:
+ self[new_year_date] = name
+ self[new_year_date + rd(days=+2)] = third_day_lunar
+ self[new_year_date + rd(days=+3)] = fourth_day_lunar
+ elif new_year_date.weekday() == SUN:
+ if year in [2006, 2007, 2010]:
+ self[new_year_date + rd(days=-1)] = preceding_day_lunar
+ self[new_year_date + rd(days=+1)] = second_day_lunar
+ self[new_year_date + rd(days=+2)] = third_day_lunar
+ else:
+ self[new_year_date + rd(days=+1)] = second_day_lunar
+ self[new_year_date + rd(days=+2)] = third_day_lunar
+ self[new_year_date + rd(days=+3)] = fourth_day_lunar
+ else:
+ self[new_year_date] = name
+ self[new_year_date + rd(days=+1)] = second_day_lunar
+ self[new_year_date + rd(days=+2)] = third_day_lunar
+
+ # Ching Ming Festival
+ name = "Ching Ming Festival"
+ if self.isLeapYear(year) or (self.isLeapYear(year-1) and year > 2008):
+ ching_ming_date = date(year, APR, 4)
+ else:
+ ching_ming_date = date(year, APR, 5)
+ if self.observed:
+ if ching_ming_date.weekday() == SUN:
+ self[ching_ming_date + rd(days=+1)] = day_following + name
+ ching_ming_date = ching_ming_date + rd(days=+1)
+ else:
+ self[ching_ming_date] = name
+ else:
+ self[ching_ming_date] = name
+
+ # Easter Holiday
+ good_friday = "Good Friday"
+ easter_monday = "Easter Monday"
+ if self.observed:
+ self[easter(year) + rd(weekday=FR(-1))] = good_friday
+ self[easter(year) + rd(weekday=SA(-1))] = day_following + \
+ good_friday
+ if ching_ming_date == easter(year) + rd(weekday=MO):
+ self[easter(year) + rd(weekday=MO) + rd(days=+1)] = \
+ day_following + easter_monday
+ else:
+ self[easter(year) + rd(weekday=MO)] = easter_monday
+ else:
+ self[easter(year) + rd(weekday=FR(-1))] = good_friday
+ self[easter(year) + rd(weekday=SA(-1))] = day_following + \
+ good_friday
+ self[easter(year) + rd(weekday=MO)] = easter_monday
+
+ # Birthday of the Buddha
+ name = "Birthday of the Buddha"
+ dt = self.get_solar_date(year, 4, 8)
+ buddha_date = date(dt.year, dt.month, dt.day)
+ if self.observed:
+ if buddha_date.weekday() == SUN:
+ self[buddha_date + rd(days=+1)] = day_following + name
+ else:
+ self[buddha_date] = name
+ else:
+ self[buddha_date] = name
+
+ # Labour Day
+ name = "Labour Day"
+ labour_date = date(year, MAY, 1)
+ if self.observed:
+ if labour_date.weekday() == SUN:
+ self[labour_date + rd(days=+1)] = day_following + name
+ else:
+ self[labour_date] = name
+ else:
+ self[labour_date] = name
+
+ # Tuen Ng Festival
+ name = "Tuen Ng Festival"
+ dt = self.get_solar_date(year, 5, 5)
+ tuen_ng_date = date(dt.year, dt.month, dt.day)
+ if self.observed:
+ if tuen_ng_date.weekday() == SUN:
+ self[tuen_ng_date + rd(days=+1)] = day_following + name
+ else:
+ self[tuen_ng_date] = name
+ else:
+ self[tuen_ng_date] = name
+
+ # Hong Kong Special Administrative Region Establishment Day
+ name = "Hong Kong Special Administrative Region Establishment Day"
+ hksar_date = date(year, JUL, 1)
+ if self.observed:
+ if hksar_date.weekday() == SUN:
+ self[hksar_date + rd(days=+1)] = day_following + name
+ else:
+ self[hksar_date] = name
+ else:
+ self[hksar_date] = name
+
+ # Special holiday on 2015 - The 70th anniversary day of the victory
+ # of the Chinese people's war of resistance against Japanese aggression
+ name = "The 70th anniversary day of the victory of the Chinese " + \
+ "people's war of resistance against Japanese aggression"
+ if year == 2015:
+ self[date(year, SEP, 3)] = name
+
+ # Chinese Mid-Autumn Festival
+ name = "Chinese Mid-Autumn Festival"
+ dt = self.get_solar_date(year, 8, 15)
+ mid_autumn_date = date(dt.year, dt.month, dt.day)
+ if self.observed:
+ if mid_autumn_date.weekday() == SAT:
+ self[mid_autumn_date] = name
+ else:
+ self[mid_autumn_date + rd(days=+1)] = day_following + \
+ "the " + name
+ mid_autumn_date = mid_autumn_date + rd(days=+1)
+ else:
+ self[mid_autumn_date] = name
+
+ # National Day
+ name = "National Day"
+ national_date = date(year, OCT, 1)
+ if self.observed:
+ if (national_date.weekday() == SUN or
+ national_date == mid_autumn_date):
+ self[national_date + rd(days=+1)] = day_following + name
+ else:
+ self[national_date] = name
+ else:
+ self[national_date] = name
+
+ # Chung Yeung Festival
+ name = "Chung Yeung Festival"
+ dt = self.get_solar_date(year, 9, 9)
+ chung_yeung_date = date(dt.year, dt.month, dt.day)
+ if self.observed:
+ if chung_yeung_date.weekday() == SUN:
+ self[chung_yeung_date + rd(days=+1)] = day_following + name
+ else:
+ self[chung_yeung_date] = name
+ else:
+ self[chung_yeung_date] = name
+
+ # Christmas Day
+ name = "Christmas Day"
+ first_after_christmas = "The first weekday after " + name
+ second_after_christmas = "The second weekday after " + name
+ christmas_date = date(year, DEC, 25)
+ if self.observed:
+ if christmas_date.weekday() == SUN:
+ self[christmas_date] = name
+ self[christmas_date + rd(days=+1)] = first_after_christmas
+ self[christmas_date + rd(days=+2)] = second_after_christmas
+ elif christmas_date.weekday() == SAT:
+ self[christmas_date] = name
+ self[christmas_date + rd(days=+2)] = first_after_christmas
+ else:
+ self[christmas_date] = name
+ self[christmas_date + rd(days=+1)] = first_after_christmas
+ else:
+ self[christmas_date] = name
+ self[christmas_date + rd(days=+1)] = day_following + name
+
+ def isLeapYear(self, year):
+ if year % 4 != 0:
+ return False
+ elif year % 100 != 0:
+ return True
+ elif year % 400 != 0:
+ return False
+ else:
+ return True
+
+ def first_lower(self, s):
+ return s[0].lower() + s[1:]
+
+ # Store the number of days per year from 1901 to 2099, and the number of
+ # days from the 1st to the 13th to store the monthly (including the month
+ # of the month), 1 means that the month is 30 days. 0 means the month is
+ # 29 days. The 12th to 15th digits indicate the month of the next month.
+ # If it is 0x0F, it means that there is no leap month.
+ g_lunar_month_days = [
+ 0xF0EA4, 0xF1D4A, 0x52C94, 0xF0C96, 0xF1536,
+ 0x42AAC, 0xF0AD4, 0xF16B2, 0x22EA4, 0xF0EA4, # 1901-1910
+ 0x6364A, 0xF164A, 0xF1496, 0x52956, 0xF055A,
+ 0xF0AD6, 0x216D2, 0xF1B52, 0x73B24, 0xF1D24, # 1911-1920
+ 0xF1A4A, 0x5349A, 0xF14AC, 0xF056C, 0x42B6A,
+ 0xF0DA8, 0xF1D52, 0x23D24, 0xF1D24, 0x61A4C, # 1921-1930
+ 0xF0A56, 0xF14AE, 0x5256C, 0xF16B4, 0xF0DA8,
+ 0x31D92, 0xF0E92, 0x72D26, 0xF1526, 0xF0A56, # 1931-1940
+ 0x614B6, 0xF155A, 0xF0AD4, 0x436AA, 0xF1748,
+ 0xF1692, 0x23526, 0xF152A, 0x72A5A, 0xF0A6C, # 1941-1950
+ 0xF155A, 0x52B54, 0xF0B64, 0xF1B4A, 0x33A94,
+ 0xF1A94, 0x8152A, 0xF152E, 0xF0AAC, 0x6156A, # 1951-1960
+ 0xF15AA, 0xF0DA4, 0x41D4A, 0xF1D4A, 0xF0C94,
+ 0x3192E, 0xF1536, 0x72AB4, 0xF0AD4, 0xF16D2, # 1961-1970
+ 0x52EA4, 0xF16A4, 0xF164A, 0x42C96, 0xF1496,
+ 0x82956, 0xF055A, 0xF0ADA, 0x616D2, 0xF1B52, # 1971-1980
+ 0xF1B24, 0x43A4A, 0xF1A4A, 0xA349A, 0xF14AC,
+ 0xF056C, 0x60B6A, 0xF0DAA, 0xF1D92, 0x53D24, # 1981-1990
+ 0xF1D24, 0xF1A4C, 0x314AC, 0xF14AE, 0x829AC,
+ 0xF06B4, 0xF0DAA, 0x52D92, 0xF0E92, 0xF0D26, # 1991-2000
+ 0x42A56, 0xF0A56, 0xF14B6, 0x22AB4, 0xF0AD4,
+ 0x736AA, 0xF1748, 0xF1692, 0x53526, 0xF152A, # 2001-2010
+ 0xF0A5A, 0x4155A, 0xF156A, 0x92B54, 0xF0BA4,
+ 0xF1B4A, 0x63A94, 0xF1A94, 0xF192A, 0x42A5C, # 2011-2020
+ 0xF0AAC, 0xF156A, 0x22B64, 0xF0DA4, 0x61D52,
+ 0xF0E4A, 0xF0C96, 0x5192E, 0xF1956, 0xF0AB4, # 2021-2030
+ 0x315AC, 0xF16D2, 0xB2EA4, 0xF16A4, 0xF164A,
+ 0x63496, 0xF1496, 0xF0956, 0x50AB6, 0xF0B5A, # 2031-2040
+ 0xF16D4, 0x236A4, 0xF1B24, 0x73A4A, 0xF1A4A,
+ 0xF14AA, 0x5295A, 0xF096C, 0xF0B6A, 0x31B54, # 2041-2050
+ 0xF1D92, 0x83D24, 0xF1D24, 0xF1A4C, 0x614AC,
+ 0xF14AE, 0xF09AC, 0x40DAA, 0xF0EAA, 0xF0E92, # 2051-2060
+ 0x31D26, 0xF0D26, 0x72A56, 0xF0A56, 0xF14B6,
+ 0x52AB4, 0xF0AD4, 0xF16CA, 0x42E94, 0xF1694, # 2061-2070
+ 0x8352A, 0xF152A, 0xF0A5A, 0x6155A, 0xF156A,
+ 0xF0B54, 0x4174A, 0xF1B4A, 0xF1A94, 0x3392A, # 2071-2080
+ 0xF192C, 0x7329C, 0xF0AAC, 0xF156A, 0x52B64,
+ 0xF0DA4, 0xF1D4A, 0x41C94, 0xF0C96, 0x8192E, # 2081-2090
+ 0xF0956, 0xF0AB6, 0x615AC, 0xF16D4, 0xF0EA4,
+ 0x42E4A, 0xF164A, 0xF1516, 0x22936, # 2090-2099
+ ]
+ # Define range of years
+ START_YEAR, END_YEAR = 1901, 1900 + len(g_lunar_month_days)
+ # 1901 The 1st day of the 1st month of the Gregorian calendar is 1901/2/19
+ LUNAR_START_DATE, SOLAR_START_DATE = (1901, 1, 1), datetime(1901, 2, 19)
+ # The Gregorian date for December 30, 2099 is 2100/2/8
+ LUNAR_END_DATE, SOLAR_END_DATE = (2099, 12, 30), datetime(2100, 2, 18)
+
+ def get_leap_month(self, lunar_year):
+ return (self.g_lunar_month_days[lunar_year-self.START_YEAR] >> 16) \
+ & 0x0F
+
+ def lunar_month_days(self, lunar_year, lunar_month):
+ return 29 + ((self.g_lunar_month_days[lunar_year-self.START_YEAR] >>
+ lunar_month) & 0x01)
+
+ def lunar_year_days(self, year):
+ days = 0
+ months_day = self.g_lunar_month_days[year - self.START_YEAR]
+ for i in range(1, 13 if self.get_leap_month(year) == 0x0F else 14):
+ day = 29 + ((months_day >> i) & 0x01)
+ days += day
+ return days
+
+ # Calculate the Gregorian date according to the lunar calendar
+ def get_solar_date(self, year, month, day):
+ span_days = 0
+ for y in range(self.START_YEAR, year):
+ span_days += self.lunar_year_days(y)
+ leap_month = self.get_leap_month(year)
+ for m in range(1, month + (month > leap_month)):
+ span_days += self.lunar_month_days(year, m)
+ span_days += day - 1
+ return self.SOLAR_START_DATE + timedelta(span_days)
+
+
+class HK(HongKong):
+ pass
+
+
+class Peru(HolidayBase):
+ # https://www.gob.pe/feriados
+ # https://es.wikipedia.org/wiki/Anexo:Días_feriados_en_el_Perú
+ def __init__(self, **kwargs):
+ self.country = "PE"
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ # New Year's Day
+ self[date(year, JAN, 1)] = "Año Nuevo [New Year's Day]"
+
+ # Feast of Saints Peter and Paul
+ name = "San Pedro y San Pablo [Feast of Saints Peter and Paul]"
+ self[date(year, JUN, 29)] = name
+
+ # Independence Day
+ name = "Día de la Independencia [Independence Day]"
+ self[date(year, JUL, 28)] = name
+
+ name = "Día de las Fuerzas Armadas y la Policía del Perú"
+ self[date(year, JUL, 29)] = name
+
+ # Santa Rosa de Lima
+ name = "Día de Santa Rosa de Lima"
+ self[date(year, AUG, 30)] = name
+
+ # Battle of Angamos
+ name = "Combate Naval de Angamos [Battle of Angamos]"
+ self[date(year, OCT, 8)] = name
+
+ # Holy Thursday
+ self[easter(year) + rd(weekday=TH(-1))
+ ] = "Jueves Santo [Maundy Thursday]"
+
+ # Good Friday
+ self[easter(year) + rd(weekday=FR(-1))
+ ] = "Viernes Santo [Good Friday]"
+
+ # Holy Saturday
+ self[easter(year) + rd(weekday=SA(-1))
+ ] = "Sábado de Gloria [Holy Saturday]"
+
+ # Easter Sunday
+ self[easter(year) + rd(weekday=SU(-1))
+ ] = "Domingo de Resurrección [Easter Sunday]"
+
+ # Labor Day
+ self[date(year, MAY, 1)] = "Día del Trabajo [Labour Day]"
+
+ # All Saints Day
+ name = "Día de Todos Los Santos [All Saints Day]"
+ self[date(year, NOV, 1)] = name
+
+ # Inmaculada Concepción
+ name = "Inmaculada Concepción [Immaculate Conception]"
+ self[date(year, DEC, 8)] = name
+
+ # Christmas
+ self[date(year, DEC, 25)] = "Navidad [Christmas]"
+
+
+class PE(Peru):
+ pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/holidays-0.9.10/tests.py new/holidays-0.9.11/tests.py
--- old/holidays-0.9.10/tests.py 2019-03-12 22:26:14.000000000 +0100
+++ new/holidays-0.9.11/tests.py 2019-07-28 10:54:35.000000000 +0200
@@ -472,6 +472,10 @@
def test_country(self):
self.assertEqual(self.holidays.country, 'US')
+ def test_country_years(self):
+ h = holidays.CountryHoliday('US', years=[2015, 2016])
+ self.assertEqual(h.years, {2015, 2016})
+
def test_country_state(self):
h = holidays.CountryHoliday('US', state='NY')
self.assertEqual(h.state, 'NY')
@@ -484,6 +488,92 @@
self.assertRaises((KeyError), lambda: holidays.CountryHoliday('XXXX'))
+class TestAruba(unittest.TestCase):
+
+ def setUp(self):
+ self.holidays = holidays.AW()
+
+ def test_2017(self):
+ self.assertIn(date(2017, 1, 1), self.holidays)
+ self.assertIn(date(2017, 1, 25), self.holidays)
+ self.assertIn(date(2017, 3, 18), self.holidays)
+ self.assertIn(date(2017, 2, 27), self.holidays)
+ self.assertIn(date(2017, 4, 14), self.holidays)
+ self.assertIn(date(2017, 4, 17), self.holidays)
+ self.assertIn(date(2017, 4, 27), self.holidays)
+ self.assertIn(date(2017, 5, 1), self.holidays)
+ self.assertIn(date(2017, 5, 25), self.holidays)
+ self.assertIn(date(2017, 12, 25), self.holidays)
+ self.assertIn(date(2017, 12, 26), self.holidays)
+
+ def test_new_years(self):
+ self.assertIn(date(2017, 1, 1), self.holidays)
+
+ def test_betico_day(self):
+ self.assertIn(date(2017, 1, 25), self.holidays)
+
+ def test_carnaval_monday(self):
+ self.assertIn(date(2017, 2, 27), self.holidays)
+
+ def test_anthem_and_flag_day(self):
+ self.assertIn(date(2017, 3, 18), self.holidays)
+
+ def test_good_friday(self):
+ self.assertIn(date(2017, 4, 14), self.holidays)
+
+ def test_easter_monday(self):
+ self.assertIn(date(2017, 4, 17), self.holidays)
+
+ def test_labour_day(self):
+ self.assertIn(date(2017, 5, 1), self.holidays)
+
+ def test_queens_day_between_1891_and_1948(self):
+ # Between 1891 and 1948 Queens Day was celebrated on 8-31
+ self.holidays = holidays.AW(years=[1901])
+ self.assertIn(date(1901, 8, 31), self.holidays)
+
+ def test_queens_day_between_1891_and_1948_substituted_later(self):
+ # Between 1891 and 1948 Queens Day was celebrated on 9-1
+ # (one day later) when Queens Day falls on a Sunday
+ self.holidays = holidays.AW(years=[1947])
+ self.assertIn(date(1947, 9, 1), self.holidays)
+
+ def test_queens_day_between_1949_and_2013(self):
+ self.holidays = holidays.AW(years=[1965])
+ self.assertIn(date(1965, 4, 30), self.holidays)
+
+ def test_queens_day_between_1949_and_1980_substituted_later(self):
+ self.holidays = holidays.AW(years=[1967])
+ self.assertIn(date(1967, 5, 1), self.holidays)
+
+ def test_queens_day_between_1980_and_2013_substituted_earlier(self):
+ self.holidays = holidays.AW(years=[2006])
+ self.assertIn(date(2006, 4, 29), self.holidays)
+
+ def test_kings_day_after_2014(self):
+ self.holidays = holidays.AW(years=[2013])
+ self.assertNotIn(date(2013, 4, 27), self.holidays)
+
+ self.holidays = holidays.AW(years=[2017])
+ self.assertIn(date(2017, 4, 27), self.holidays)
+
+ def test_kings_day_after_2014_substituted_earlier(self):
+ self.holidays = holidays.AW(years=[2188])
+ self.assertIn(date(2188, 4, 26), self.holidays)
+
+ def test_ascension_day(self):
+ self.holidays = holidays.AW(years=2017)
+ self.assertIn(date(2017, 5, 25), self.holidays)
+
+ def test_christmas(self):
+ self.holidays = holidays.AW(years=2017)
+ self.assertIn(date(2017, 12, 25), self.holidays)
+
+ def test_second_christmas(self):
+ self.holidays = holidays.AW(years=2017)
+ self.assertIn(date(2017, 12, 26), self.holidays)
+
+
class TestBulgaria(unittest.TestCase):
def setUp(self):
@@ -581,6 +671,7 @@
bc_holidays = holidays.CA(prov="BC")
mb_holidays = holidays.CA(prov="MB")
sk_holidays = holidays.CA(prov="SK")
+ nb_holidays = holidays.CA(prov="NB")
for dt in [date(1990, 2, 19), date(1999, 2, 15), date(2000, 2, 21),
date(2006, 2, 20)]:
self.assertNotIn(dt, self.holidays)
@@ -601,6 +692,8 @@
self.assertNotIn(dt, bc_holidays)
self.assertIn(dt, mb_holidays)
self.assertIn(dt, sk_holidays)
+ for dt in [date(2018, 2, 19)]:
+ self.assertIn(dt, nb_holidays)
for dt in [date(2019, 2, 18), date(2020, 2, 17)]:
self.assertIn(dt, self.holidays)
self.assertIn(dt, ab_holidays)
@@ -2535,10 +2628,10 @@
self.assertIn(dt, self.holidays, dt)
self.assertEqual(self.holidays[dt][:6], "Boxing")
- def test_all_holidays_present(self):
- au_2015 = sum(holidays.AU(years=[2015], prov=p)
- for p in holidays.AU.PROVINCES)
- holidays_in_2015 = sum((au_2015.get_list(key) for key in au_2015), [])
+ def test_all_holidays(self):
+ au = sum(holidays.AU(years=[1957, 2012, 2015], prov=p)
+ for p in holidays.AU.PROVINCES)
+ holidays_found = sum((au.get_list(key) for key in au), [])
all_holidays = ["New Year's Day",
"Australia Day",
"Adelaide Cup",
@@ -2560,7 +2653,7 @@
"Proclamation Day",
"Boxing Day"]
for holiday in all_holidays:
- self.assertIn(holiday, holidays_in_2015, holiday)
+ self.assertIn(holiday, holidays_found, holiday)
class TestDE(unittest.TestCase):
@@ -3208,6 +3301,14 @@
self.assertIn(date(2018, 12, 25), self.holidays)
self.assertIn(date(2018, 12, 26), self.holidays)
+ def test_slovak_deprecated(self):
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
+ slovakia = holidays.Slovak()
+ self.assertIsInstance(slovakia, holidays.Slovakia)
+ self.assertEqual(1, len(w))
+ self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
+
class TestPL(unittest.TestCase):
@@ -3230,6 +3331,14 @@
self.assertIn(date(2017, 12, 25), self.holidays)
self.assertIn(date(2017, 12, 26), self.holidays)
+ def test_polish_deprecated(self):
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
+ poland = holidays.Polish()
+ self.assertIsInstance(poland, holidays.Poland)
+ self.assertEqual(1, len(w))
+ self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
+
class TestPT(unittest.TestCase):
@@ -3729,7 +3838,14 @@
def test_emperors_birthday(self):
self.assertIn(date(1989, 12, 23), self.holidays)
self.assertIn(date(2017, 12, 23), self.holidays)
- self.assertIn(date(2050, 12, 23), self.holidays)
+ self.assertNotIn(date(2019, 12, 23), self.holidays)
+ self.assertIn(date(2020, 2, 23), self.holidays)
+
+ def test_reiwa_emperor_holidays(self):
+ self.assertIn(date(2019, 4, 30), self.holidays)
+ self.assertIn(date(2019, 5, 1), self.holidays)
+ self.assertIn(date(2019, 5, 2), self.holidays)
+ self.assertIn(date(2019, 10, 22), self.holidays)
def test_invalid_years(self):
self.assertRaises(NotImplementedError,
@@ -4077,6 +4193,7 @@
'Peter und Paul',
'Nationalfeiertag',
'Maria Himmelfahrt',
+ 'Lundi du Jeûne',
'Bruder Klaus',
'Allerheiligen',
'Maria Empfängnis',
@@ -4268,6 +4385,19 @@
for province, year in product(provinces_that_dont, range(1970, 2050)):
self.assertTrue(date(year, 8, 15) not in self.prov_hols[province])
+ def test_lundi_du_jeune(self):
+ known_good = [(2014, 9, 22), (2015, 9, 21), (2016, 9, 19),
+ (2017, 9, 18), (2018, 9, 17), (2019, 9, 16),
+ (2020, 9, 21), (2021, 9, 20), (2022, 9, 19),
+ (2023, 9, 18), (2024, 9, 16)]
+ provinces_that_have = {'VD'}
+ provinces_that_dont = set(holidays.CH.PROVINCES) - provinces_that_have
+
+ for province, (y, m, d) in product(provinces_that_have, known_good):
+ self.assertTrue(date(y, m, d) in self.prov_hols[province])
+ for province, (y, m, d) in product(provinces_that_dont, known_good):
+ self.assertTrue(date(y, m, d) not in self.prov_hols[province])
+
def test_bruder_chlaus(self):
provinces_that_have = {'OW'}
provinces_that_dont = set(holidays.CH.PROVINCES) - provinces_that_have
@@ -4601,6 +4731,7 @@
self.assertIn(date(2018, 4, 1), self.holidays)
self.assertIn(date(2018, 4, 2), self.holidays)
self.assertIn(date(2018, 5, 1), self.holidays)
+ self.assertIn(date(2018, 6, 25), self.holidays)
self.assertIn(date(2018, 8, 15), self.holidays)
self.assertIn(date(2018, 10, 8), self.holidays)
self.assertIn(date(2018, 11, 1), self.holidays)
@@ -4981,5 +5112,333 @@
self.assertIn(date(2020, 6, 24), self.holidays)
+class TestEstonia(unittest.TestCase):
+ def setUp(self):
+ self.holidays = holidays.EE()
+ self.cur_date = datetime.now()
+
+ def test_new_years(self):
+ test_date = date(self.cur_date.year, 1, 1)
+ self.assertEqual(self.holidays.get(test_date), "uusaasta")
+ self.assertIn(test_date, self.holidays)
+
+ def test_independence_day(self):
+ test_date = date(self.cur_date.year, 2, 24)
+ self.assertEqual(self.holidays.get(test_date), "iseseisvuspäev")
+ self.assertIn(test_date, self.holidays)
+
+ def test_good_friday(self):
+ test_date = date(2019, 4, 19)
+ self.assertEqual(self.holidays.get(test_date), "suur reede")
+ self.assertIn(test_date, self.holidays)
+
+ def test_easter_sunday(self):
+ test_date = date(2019, 4, 21)
+ self.assertEqual(self.holidays.get(test_date),
+ "ülestõusmispühade 1. püha")
+ self.assertIn(test_date, self.holidays)
+
+ def test_spring_day(self):
+ test_date = date(self.cur_date.year, 5, 1)
+ self.assertEqual(self.holidays.get(test_date), "kevadpüha")
+ self.assertIn(test_date, self.holidays)
+
+ def test_pentecost(self):
+ test_date = date(2019, 6, 9)
+ self.assertEqual(self.holidays.get(test_date), "nelipühade 1. püha")
+ self.assertIn(test_date, self.holidays)
+
+ def test_victory_day(self):
+ test_date = date(self.cur_date.year, 6, 23)
+ self.assertEqual(self.holidays.get(test_date), "võidupüha")
+ self.assertIn(test_date, self.holidays)
+
+ def test_midsummers_day(self):
+ test_date = date(self.cur_date.year, 6, 24)
+ self.assertEqual(self.holidays.get(test_date), "jaanipäev")
+ self.assertIn(test_date, self.holidays)
+
+ def test_restoration_of_independence_day(self):
+ test_date = date(self.cur_date.year, 8, 20)
+ self.assertEqual(self.holidays.get(test_date), "taasiseseisvumispäev")
+ self.assertIn(test_date, self.holidays)
+
+ def test_christmas_eve(self):
+ test_date = date(self.cur_date.year, 12, 24)
+ self.assertEqual(self.holidays.get(test_date), "jõululaupäev")
+ self.assertIn(test_date, self.holidays)
+
+ def test_christmas_day(self):
+ test_date = date(self.cur_date.year, 12, 25)
+ self.assertEqual(self.holidays.get(test_date), "esimene jõulupüha")
+ self.assertIn(test_date, self.holidays)
+
+ def test_boxing_day(self):
+ test_date = date(self.cur_date.year, 12, 26)
+ self.assertEqual(self.holidays.get(test_date), "teine jõulupüha")
+ self.assertIn(test_date, self.holidays)
+
+
+class TestIceland(unittest.TestCase):
+ def setUp(self):
+ self.holidays = holidays.Iceland()
+ self.cur_date = datetime.now()
+
+ def test_new_year(self):
+ test_date = date(self.cur_date.year, 1, 1)
+ self.assertEqual(self.holidays.get(test_date), "Nýársdagur")
+ self.assertIn(test_date, self.holidays)
+
+ def test_maundy_thursday(self):
+ test_date = date(self.cur_date.year, 4, 18)
+ self.assertEqual(self.holidays.get(test_date), "Skírdagur")
+ self.assertIn(test_date, self.holidays)
+
+ def test_first_day_of_summer(self):
+ test_date = date(self.cur_date.year, 4, 25)
+ self.assertEqual(self.holidays.get(test_date), "Sumardagurinn fyrsti")
+ self.assertIn(test_date, self.holidays)
+
+ def test_commerce_day(self):
+ test_date = date(self.cur_date.year, 8, 5)
+ self.assertEqual(self.holidays.get(test_date),
+ "Frídagur verslunarmanna")
+ self.assertIn(test_date, self.holidays)
+
+
+class TestKenya(unittest.TestCase):
+ def setUp(self):
+ self.holidays = holidays.Kenya()
+
+ def test_2019(self):
+ # New Year's Day
+ self.assertIn(date(2019, 1, 1), self.holidays)
+ # Good Friday
+ self.assertIn(date(2019, 4, 19), self.holidays)
+ # Easter Monday
+ self.assertIn(date(2019, 4, 22), self.holidays)
+ # Labour Day
+ self.assertIn(date(2019, 5, 1), self.holidays)
+ # Madaraka Day
+ self.assertIn(date(2019, 6, 1), self.holidays)
+ # Mashujaa Day
+ self.assertIn(date(2019, 10, 20), self.holidays)
+ # Jamhuri (Independence) Day
+ self.assertIn(date(2019, 12, 12), self.holidays)
+ # Christmas Day
+ self.assertIn(date(2019, 12, 25), self.holidays)
+ # Boxing Day
+ self.assertIn(date(2018, 12, 26), self.holidays)
+
+
+class TestHongKong(unittest.TestCase):
+
+ def setUp(self):
+ self.holidays = holidays.HK()
+
+ def test_common(self):
+ self.assertTrue(self.holidays.isLeapYear(2000))
+ self.assertFalse(self.holidays.isLeapYear(2100))
+ holidaysNoObserved = holidays.HK(observed=False)
+ self.assertEqual(holidaysNoObserved[date(2019, 1, 1)],
+ "The first day of January")
+ self.assertEqual(self.holidays[date(2015, 9, 3)], "The 70th " +
+ "anniversary day of the victory of the Chinese " +
+ "people's war of resistance against Japanese " +
+ "aggression")
+
+ def test_first_day_of_january(self):
+ exception_years = [2006, 2012, 2017]
+ for year in range(2006, 2021):
+ if year in exception_years:
+ self.assertEqual(self.holidays[date(year, 1, 2)],
+ "The day following the first day of January")
+ else:
+ self.assertEqual(self.holidays[date(year, 1, 1)],
+ "The first day of January")
+
+ def test_lunar_new_year(self):
+ for year, month, day in [
+ (2006, 1, 28), (2007, 2, 17), (2010, 2, 13)]:
+ self.assertEqual(self.holidays[date(year, month, day)],
+ "The day preceding Lunar New Year's Day")
+
+ for year, month, day in [
+ (2008, 2, 7), (2009, 1, 26), (2011, 2, 3), (2012, 1, 23),
+ (2014, 1, 31), (2015, 2, 19), (2016, 2, 8), (2017, 1, 28),
+ (2018, 2, 16), (2019, 2, 5), (2020, 1, 25)]:
+ self.assertEqual(self.holidays[date(year, month, day)],
+ "Lunar New Year's Day")
+
+ for year, month, day in [
+ (2006, 1, 30), (2007, 2, 19), (2008, 2, 8), (2009, 1, 27),
+ (2010, 2, 15), (2011, 2, 4), (2012, 1, 24), (2013, 2, 11),
+ (2014, 2, 1), (2015, 2, 20), (2016, 2, 9), (2018, 2, 17),
+ (2019, 2, 6)]:
+ self.assertEqual(self.holidays[date(year, month, day)],
+ "The second day of Lunar New Year")
+
+ for year, month, day in [
+ (2006, 1, 31), (2007, 2, 20), (2008, 2, 9), (2009, 1, 28),
+ (2010, 2, 16), (2011, 2, 5), (2012, 1, 25), (2013, 2, 12),
+ (2015, 2, 21), (2016, 2, 10), (2017, 1, 30), (2019, 2, 7),
+ (2020, 1, 27)]:
+ self.assertEqual(self.holidays[date(year, month, day)],
+ "The third day of Lunar New Year")
+
+ for year, month, day in [
+ (2013, 2, 13), (2014, 2, 3), (2017, 1, 31), (2020, 1, 28),
+ (2018, 2, 19)]:
+ self.assertEqual(self.holidays[date(year, month, day)],
+ "The fourth day of Lunar New Year")
+
+ def test_ching_ming_festival(self):
+ for year, month, day in [
+ (2006, 4, 5), (2007, 4, 5), (2008, 4, 4), (2009, 4, 4),
+ (2010, 4, 5), (2011, 4, 5), (2012, 4, 4), (2013, 4, 4),
+ (2014, 4, 5), (2016, 4, 4), (2017, 4, 4), (2018, 4, 5),
+ (2019, 4, 5), (2020, 4, 4)]:
+ self.assertEqual(self.holidays[date(year, month, day)],
+ "Ching Ming Festival")
+
+ self.assertEqual(self.holidays[date(2015, 4, 6)], "The day " +
+ "following Ching Ming Festival")
+
+ def test_easter(self):
+ for year, month, day in [
+ (2006, 4, 14), (2007, 4, 6), (2008, 3, 21), (2009, 4, 10),
+ (2010, 4, 2), (2011, 4, 22), (2012, 4, 6), (2013, 3, 29),
+ (2014, 4, 18), (2015, 4, 3), (2016, 3, 25), (2017, 4, 14),
+ (2018, 3, 30), (2019, 4, 19), (2020, 4, 10)]:
+ self.assertEqual(self.holidays[date(year, month, day)],
+ "Good Friday")
+
+ for year, month, day in [
+ (2019, 4, 20), (2013, 3, 30), (2020, 4, 11), (2009, 4, 11),
+ (2018, 3, 31), (2008, 3, 22), (2011, 4, 23), (2010, 4, 3),
+ (2015, 4, 4), (2006, 4, 15), (2017, 4, 15), (2016, 3, 26),
+ (2012, 4, 7), (2007, 4, 7), (2014, 4, 19)]:
+ self.assertEqual(self.holidays[date(year, month, day)],
+ "The day following Good Friday")
+
+ for year, month, day in [
+ (2006, 4, 17), (2007, 4, 9), (2009, 4, 13), (2008, 3, 24),
+ (2011, 4, 25), (2012, 4, 9), (2013, 4, 1), (2014, 4, 21),
+ (2016, 3, 28), (2017, 4, 17), (2018, 4, 2), (2019, 4, 22),
+ (2020, 4, 13)]:
+ self.assertEqual(self.holidays[date(year, month, day)],
+ "Easter Monday")
+
+ name = "The day following Easter Monday"
+ self.assertEqual(self.holidays[date(2010, 4, 6)], name)
+ self.assertEqual(self.holidays[date(2015, 4, 7)], name)
+
+ def test_labour_day(self):
+ for year in [2006, 2007, 2008, 2009, 2010, 2012, 2013, 2014, 2015,
+ 2017, 2018, 2019, 2020]:
+ self.assertEqual(self.holidays[date(year, 5, 1)],
+ "Labour Day")
+
+ name = "The day following Labour Day"
+ self.assertEqual(self.holidays[date(2011, 5, 2)], name)
+ self.assertEqual(self.holidays[date(2016, 5, 2)], name)
+
+ def test_tuen_ng_festival(self):
+ for year, month, day in [
+ (2006, 5, 31), (2007, 6, 19), (2009, 5, 28), (2010, 6, 16),
+ (2011, 6, 6), (2012, 6, 23), (2013, 6, 12), (2014, 6, 2),
+ (2015, 6, 20), (2016, 6, 9), (2017, 5, 30), (2018, 6, 18),
+ (2019, 6, 7), (2020, 6, 25)]:
+ self.assertEqual(self.holidays[date(year, month, day)], "Tuen " +
+ "Ng Festival")
+
+ self.assertEqual(self.holidays[date(2008, 6, 9)], "The day " +
+ "following Tuen Ng Festival")
+
+ def test_hksar_day(self):
+ for year in [2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016,
+ 2017, 2019, 2020]:
+ self.assertEqual(self.holidays[date(year, 7, 1)], "Hong Kong " +
+ "Special Administrative Region Establishment " +
+ "Day")
+
+ name = "The day following Hong Kong Special Administrative Region " + \
+ "Establishment Day"
+ self.assertEqual(self.holidays[date(2007, 7, 2)], name)
+ self.assertEqual(self.holidays[date(2012, 7, 2)], name)
+ self.assertEqual(self.holidays[date(2018, 7, 2)], name)
+
+ def test_mid_autumn_festival(self):
+ for year, month, day in [
+ (2006, 10, 7), (2007, 9, 26), (2008, 9, 15), (2010, 9, 23),
+ (2011, 9, 13), (2012, 10, 1), (2013, 9, 20), (2014, 9, 9),
+ (2015, 9, 28), (2016, 9, 16), (2017, 10, 5), (2018, 9, 25),
+ (2019, 9, 14), (2020, 10, 2)]:
+ self.assertEqual(self.holidays[date(year, month, day)], "The " +
+ "day following the Chinese Mid-Autumn Festival")
+
+ self.assertEqual(self.holidays[date(2009, 10, 3)], "Chinese " +
+ "Mid-Autumn Festival")
+
+ def test_national_day(self):
+ for year in [2007, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016,
+ 2018, 2019, 2020]:
+ self.assertEqual(self.holidays[date(year, 10, 1)], "National Day")
+
+ name = "The day following National Day"
+ self.assertEqual(self.holidays[date(2006, 10, 2)], name)
+ self.assertEqual(self.holidays[date(2012, 10, 2)], name)
+ self.assertEqual(self.holidays[date(2017, 10, 2)], name)
+
+ def test_chung_yeung_festival(self):
+ for year, month, day in [
+ (2006, 10, 30), (2007, 10, 19), (2008, 10, 7), (2009, 10, 26),
+ (2010, 10, 16), (2011, 10, 5), (2012, 10, 23), (2014, 10, 2),
+ (2015, 10, 21), (2017, 10, 28), (2018, 10, 17), (2019, 10, 7)]:
+ self.assertEqual(self.holidays[date(year, month, day)], "Chung " +
+ "Yeung Festival")
+
+ name = "The day following Chung Yeung Festival"
+ self.assertEqual(self.holidays[date(2013, 10, 14)], name)
+ self.assertEqual(self.holidays[date(2016, 10, 10)], name)
+ self.assertEqual(self.holidays[date(2020, 10, 26)], name)
+
+ def test_christmas_day(self):
+ for year in [2006, 2007, 2008, 2009, 2010, 2012, 2013, 2014, 2015,
+ 2017, 2018, 2019, 2020]:
+ self.assertEqual(self.holidays[date(year, 12, 25)], "Christmas " +
+ "Day")
+
+ name = "The first weekday after Christmas Day"
+ for year in range(2006, 2010):
+ self.assertEqual(self.holidays[date(year, 12, 26)], name)
+ self.assertEqual(self.holidays[date(2010, 12, 27)], name)
+ for year in range(2011, 2021):
+ self.assertEqual(self.holidays[date(year, 12, 26)], name)
+
+ name = "The second weekday after Christmas Day"
+ self.assertEqual(self.holidays[date(2011, 12, 27)], name)
+ self.assertEqual(self.holidays[date(2016, 12, 27)], name)
+
+
+class TestPeru(unittest.TestCase):
+ def setUp(self):
+ self.holidays = holidays.Peru()
+
+ def test_2019(self):
+ # No laborables (sector público) not included
+ self.assertIn(date(2019, 1, 1), self.holidays)
+ self.assertIn(date(2019, 4, 18), self.holidays)
+ self.assertIn(date(2019, 4, 19), self.holidays)
+ self.assertIn(date(2019, 5, 1), self.holidays)
+ self.assertIn(date(2019, 6, 29), self.holidays)
+ self.assertIn(date(2019, 7, 29), self.holidays)
+ self.assertIn(date(2019, 8, 30), self.holidays)
+ self.assertIn(date(2019, 10, 8), self.holidays)
+ self.assertIn(date(2019, 11, 1), self.holidays)
+ self.assertIn(date(2019, 12, 8), self.holidays)
+ self.assertIn(date(2019, 12, 25), self.holidays)
+
+
if __name__ == "__main__":
unittest.main()