Merge pull request #503 from peopledoc/brutasse-feature/all-ch-cantons
Switzerland calendars, including all Cantons
This commit is contained in:
commit
045d6dd262
|
@ -2,7 +2,7 @@
|
|||
|
||||
## master (unreleased)
|
||||
|
||||
Nothing here yet.
|
||||
- Added rules for all Switzerland Cantons, branching off the initial work by @brutasse (#497).
|
||||
|
||||
## v9.0.1 (2020-05-22)
|
||||
|
||||
|
|
|
@ -112,11 +112,7 @@ Europe
|
|||
* Slovenia
|
||||
* Spain (incl. Catalonia)
|
||||
* Sweden
|
||||
* Switzerland
|
||||
|
||||
* Vaud
|
||||
* Geneva
|
||||
|
||||
* Switzerland (Aargau, Appenzell Innerrhoden, Appenzell Ausserrhoden, Bern, Basel-Landschaft, Basel-Stadt, Fribourg, Geneva, Glarus, Graubünden, Jura, Luzern, Neuchâtel, Nidwalden, Obwalden, St. Gallen, Schaffhausen, Solothurn, Schwyz, Thurgau, Ticino, Uri, Vaud, Valais, Zug, Zurich)
|
||||
* Turkey
|
||||
* Ukraine
|
||||
* United Kingdom (incl. Northern Ireland, Scotland and all its territories)
|
||||
|
|
|
@ -55,24 +55,48 @@ Also, if you want those regions **and** their subregions, you can use the `inclu
|
|||
|
||||
```python
|
||||
>>> registry.get_calendars(['FR', 'CH', 'CA'], include_subregions=True)
|
||||
{'CA': <class 'workalendar.america.canada.Canada'>,
|
||||
'CA-AB': <class 'workalendar.america.canada.Alberta'>,
|
||||
'CA-BC': <class 'workalendar.america.canada.BritishColumbia'>,
|
||||
'CA-MB': <class 'workalendar.america.canada.Manitoba'>,
|
||||
'CA-NB': <class 'workalendar.america.canada.NewBrunswick'>,
|
||||
'CA-NL': <class 'workalendar.america.canada.Newfoundland'>,
|
||||
'CA-NS': <class 'workalendar.america.canada.NovaScotia'>,
|
||||
'CA-NT': <class 'workalendar.america.canada.NorthwestTerritories'>,
|
||||
'CA-NU': <class 'workalendar.america.canada.Nunavut'>,
|
||||
'CA-ON': <class 'workalendar.america.canada.Ontario'>,
|
||||
'CA-PE': <class 'workalendar.america.canada.PrinceEdwardIsland'>,
|
||||
'CA-QC': <class 'workalendar.america.canada.Quebec'>,
|
||||
'CA-SK': <class 'workalendar.america.canada.Saskatchewan'>,
|
||||
'CA-YT': <class 'workalendar.america.canada.Yukon'>,
|
||||
'CH': <class 'workalendar.europe.switzerland.Switzerland'>,
|
||||
'CH-VD': <class 'workalendar.europe.switzerland.Vaud'>,
|
||||
'CH-GE': <class 'workalendar.europe.switzerland.Geneva'>,
|
||||
'FR': <class 'workalendar.europe.france.France'>}
|
||||
{'FR': workalendar.europe.france.France,
|
||||
'CH': workalendar.europe.switzerland.Switzerland,
|
||||
'CH-AG': workalendar.europe.switzerland.Aargau,
|
||||
'CH-AI': workalendar.europe.switzerland.AppenzellInnerrhoden,
|
||||
'CH-AR': workalendar.europe.switzerland.AppenzellAusserrhoden,
|
||||
'CH-BE': workalendar.europe.switzerland.Bern,
|
||||
'CH-BL': workalendar.europe.switzerland.BaselLandschaft,
|
||||
'CH-BS': workalendar.europe.switzerland.BaselStadt,
|
||||
'CH-FR': workalendar.europe.switzerland.Fribourg,
|
||||
'CH-GE': workalendar.europe.switzerland.Geneva,
|
||||
'CH-GL': workalendar.europe.switzerland.Glarus,
|
||||
'CH-GR': workalendar.europe.switzerland.Graubunden,
|
||||
'CH-JU': workalendar.europe.switzerland.Jura,
|
||||
'CH-LU': workalendar.europe.switzerland.Luzern,
|
||||
'CH-NE': workalendar.europe.switzerland.Neuchatel,
|
||||
'CH-NW': workalendar.europe.switzerland.Nidwalden,
|
||||
'CH-OW': workalendar.europe.switzerland.Obwalden,
|
||||
'CH-SG': workalendar.europe.switzerland.StGallen,
|
||||
'CH-SH': workalendar.europe.switzerland.Schaffhausen,
|
||||
'CH-SO': workalendar.europe.switzerland.Solothurn,
|
||||
'CH-SZ': workalendar.europe.switzerland.Schwyz,
|
||||
'CH-TG': workalendar.europe.switzerland.Thurgau,
|
||||
'CH-TI': workalendar.europe.switzerland.Ticino,
|
||||
'CH-UR': workalendar.europe.switzerland.Uri,
|
||||
'CH-VD': workalendar.europe.switzerland.Vaud,
|
||||
'CH-VS': workalendar.europe.switzerland.Valais,
|
||||
'CH-ZG': workalendar.europe.switzerland.Zug,
|
||||
'CH-ZH': workalendar.europe.switzerland.Zurich,
|
||||
'CA': workalendar.america.canada.Canada,
|
||||
'CA-ON': workalendar.america.canada.Ontario,
|
||||
'CA-QC': workalendar.america.canada.Quebec,
|
||||
'CA-BC': workalendar.america.canada.BritishColumbia,
|
||||
'CA-AB': workalendar.america.canada.Alberta,
|
||||
'CA-SK': workalendar.america.canada.Saskatchewan,
|
||||
'CA-MB': workalendar.america.canada.Manitoba,
|
||||
'CA-NB': workalendar.america.canada.NewBrunswick,
|
||||
'CA-NS': workalendar.america.canada.NovaScotia,
|
||||
'CA-PE': workalendar.america.canada.PrinceEdwardIsland,
|
||||
'CA-NL': workalendar.america.canada.Newfoundland,
|
||||
'CA-YT': workalendar.america.canada.Yukon,
|
||||
'CA-NT': workalendar.america.canada.NorthwestTerritories,
|
||||
'CA-NU': workalendar.america.canada.Nunavut}
|
||||
```
|
||||
|
||||
*Note*: if any of the codes is unknown, this function won't raise an error.
|
||||
|
@ -92,11 +116,9 @@ Let's say that we only know the ISO code for Switzerland (`CH`). If we want to c
|
|||
>>> calendar = CalendarClass()
|
||||
>>> calendar.holidays(2018)
|
||||
[(datetime.date(2018, 1, 1), 'New year'),
|
||||
(datetime.date(2018, 1, 2), "Berchtold's Day"),
|
||||
(datetime.date(2018, 3, 30), 'Good Friday'),
|
||||
(datetime.date(2018, 4, 1), 'Easter Sunday'),
|
||||
(datetime.date(2018, 4, 2), 'Easter Monday'),
|
||||
(datetime.date(2018, 5, 1), 'Labour Day'),
|
||||
(datetime.date(2018, 5, 10), 'Ascension Thursday'),
|
||||
(datetime.date(2018, 5, 20), 'Whit Sunday'),
|
||||
(datetime.date(2018, 5, 21), 'Whit Monday'),
|
||||
|
|
|
@ -31,7 +31,6 @@ from .slovakia import Slovakia
|
|||
from .slovenia import Slovenia
|
||||
from .spain import Spain, Catalonia
|
||||
from .sweden import Sweden
|
||||
from .switzerland import Switzerland, Vaud, Geneva
|
||||
from .ukraine import Ukraine
|
||||
from .united_kingdom import UnitedKingdom, UnitedKingdomNorthernIreland
|
||||
from .turkey import Turkey
|
||||
|
@ -53,6 +52,14 @@ from .scotland import (
|
|||
ScottishBorders, SouthLanarkshire, Stirling, WestDunbartonshire
|
||||
)
|
||||
|
||||
# Switzerland
|
||||
from .switzerland import (
|
||||
Switzerland, Aargau, AppenzellInnerrhoden, AppenzellAusserrhoden, Bern,
|
||||
BaselLandschaft, BaselStadt, Fribourg, Geneva, Glarus, Graubunden, Jura,
|
||||
Luzern, Neuchatel, Nidwalden, Obwalden, StGallen, Schaffhausen, Solothurn,
|
||||
Schwyz, Thurgau, Ticino, Uri, Vaud, Valais, Zug, Zurich
|
||||
)
|
||||
|
||||
__all__ = (
|
||||
'Austria',
|
||||
'Belarus',
|
||||
|
@ -90,8 +97,6 @@ __all__ = (
|
|||
'Spain',
|
||||
'Sweden',
|
||||
'Switzerland',
|
||||
'Vaud',
|
||||
'Geneva',
|
||||
'Ukraine',
|
||||
'UnitedKingdom',
|
||||
'UnitedKingdomNorthernIreland',
|
||||
|
@ -109,5 +114,12 @@ __all__ = (
|
|||
'Edinburgh', 'Elgin', 'Falkirk', 'Fife', 'Galashiels', 'Glasgow',
|
||||
'Hawick', 'Inverclyde', 'Inverness', 'Kilmarnock', 'Lanark', 'Linlithgow',
|
||||
'Lochaber', 'NorthLanarkshire', 'Paisley', 'Perth', 'ScottishBorders',
|
||||
'SouthLanarkshire', 'Stirling', 'WestDunbartonshire'
|
||||
'SouthLanarkshire', 'Stirling', 'WestDunbartonshire',
|
||||
# Switzerland
|
||||
'Switzerland',
|
||||
'Aargau', 'AppenzellInnerrhoden', 'AppenzellAusserrhoden', 'Bern',
|
||||
'BaselLandschaft', 'BaselStadt', 'Fribourg', 'Geneva', 'Glarus',
|
||||
'Graubunden', 'Jura', 'Luzern', 'Neuchatel', 'Nidwalden', 'Obwalden',
|
||||
'StGallen', 'Schaffhausen', 'Solothurn', 'Schwyz', 'Thurgau', 'Ticino',
|
||||
'Uri', 'Vaud', 'Valais', 'Zug', 'Zurich',
|
||||
)
|
||||
|
|
|
@ -7,59 +7,110 @@ from ..registry_tools import iso_register
|
|||
class Switzerland(WesternCalendar, ChristianMixin):
|
||||
'Switzerland'
|
||||
|
||||
include_good_friday = True
|
||||
# ChristianMixin entries common to (most) cantons - opt out
|
||||
include_good_friday = True # not in TI, VS
|
||||
include_easter_sunday = True
|
||||
include_easter_monday = True
|
||||
include_easter_monday = True # not in VS
|
||||
include_ascension = True
|
||||
include_whit_sunday = True
|
||||
include_whit_monday = True
|
||||
include_whit_monday = True # not in VS
|
||||
include_christmas = True
|
||||
include_boxing_day = True
|
||||
include_boxing_day = True # not in GE, NE, VS, VD
|
||||
|
||||
# ChristianMixin entries with varying observance - opt in
|
||||
include_epiphany = False
|
||||
include_corpus_christi = False
|
||||
include_assumption = False
|
||||
include_all_saints = False
|
||||
include_immaculate_conception = False
|
||||
|
||||
# Swiss entries with varying observance - opt in
|
||||
include_berchtolds_day = False
|
||||
include_st_josephs_day = False
|
||||
include_labour_day = False
|
||||
|
||||
FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
|
||||
(1, 2, "Berchtold's Day"),
|
||||
(5, 1, "Labour Day"),
|
||||
(8, 1, "National Holiday"),
|
||||
)
|
||||
|
||||
|
||||
@iso_register('CH-VD')
|
||||
class Vaud(Switzerland):
|
||||
'Vaud'
|
||||
|
||||
include_boxing_day = False
|
||||
include_federal_thanksgiving_monday = True
|
||||
|
||||
FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
|
||||
(1, 2, "Berchtold's Day"),
|
||||
(8, 1, "National Holiday"),
|
||||
)
|
||||
|
||||
def get_federal_thanksgiving_monday(self, year):
|
||||
"Monday following the 3rd sunday of September"
|
||||
september_1st = date(year, 9, 1)
|
||||
return (
|
||||
september_1st +
|
||||
(6 - september_1st.weekday()) * timedelta(days=1) + # 1st sunday
|
||||
timedelta(days=15) # Monday following 3rd sunday
|
||||
)
|
||||
|
||||
def get_variable_days(self, year):
|
||||
days = super().get_variable_days(year)
|
||||
if self.include_federal_thanksgiving_monday:
|
||||
days.append((self.get_federal_thanksgiving_monday(year),
|
||||
"Federal Thanksgiving Monday"))
|
||||
if self.include_berchtolds_day:
|
||||
days.append((date(year, 1, 2), "Berchtold's Day"))
|
||||
if self.include_st_josephs_day:
|
||||
days.append((date(year, 3, 19), "St Joseph's Day"))
|
||||
if self.include_labour_day:
|
||||
days.append((date(year, 5, 1), "Labour Day"))
|
||||
return days
|
||||
|
||||
|
||||
@iso_register('CH-AG')
|
||||
class Aargau(Switzerland):
|
||||
'Aargau'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_corpus_christi = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-AI')
|
||||
class AppenzellInnerrhoden(Switzerland):
|
||||
'Appenzell Innerrhoden'
|
||||
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-AR')
|
||||
class AppenzellAusserrhoden(Switzerland):
|
||||
'Appenzell Ausserrhoden'
|
||||
|
||||
include_labour_day = True
|
||||
|
||||
|
||||
@iso_register('CH-BE')
|
||||
class Bern(Switzerland):
|
||||
'Bern'
|
||||
|
||||
include_berchtolds_day = True
|
||||
|
||||
|
||||
@iso_register('CH-BL')
|
||||
class BaselLandschaft(Switzerland):
|
||||
'Basel-Landschaft'
|
||||
|
||||
include_labour_day = True
|
||||
|
||||
|
||||
@iso_register('CH-BS')
|
||||
class BaselStadt(Switzerland):
|
||||
'Basel-Stadt'
|
||||
|
||||
include_labour_day = True
|
||||
|
||||
|
||||
@iso_register('CH-FR')
|
||||
class Fribourg(Switzerland):
|
||||
'Fribourg'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_labour_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-GE')
|
||||
class Geneva(Switzerland):
|
||||
'Geneva'
|
||||
|
||||
include_boxing_day = False
|
||||
|
||||
FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
|
||||
(8, 1, "National Holiday"),
|
||||
FIXED_HOLIDAYS = Switzerland.FIXED_HOLIDAYS + (
|
||||
(12, 31, "Creation of Geneva Republic"),
|
||||
)
|
||||
|
||||
|
@ -76,3 +127,226 @@ class Geneva(Switzerland):
|
|||
days = super().get_variable_days(year)
|
||||
days.append(self.get_genevan_fast(year))
|
||||
return days
|
||||
|
||||
|
||||
@iso_register('CH-GL')
|
||||
class Glarus(Switzerland):
|
||||
'Glarus (Glaris)'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_all_saints = True
|
||||
|
||||
FIXED_HOLIDAYS = Switzerland.FIXED_HOLIDAYS + (
|
||||
(4, 3, "Näfels Ride"),
|
||||
)
|
||||
|
||||
|
||||
@iso_register('CH-GR')
|
||||
class Graubunden(Switzerland):
|
||||
'Graubünden (Grisons)'
|
||||
|
||||
include_epiphany = True
|
||||
include_st_josephs_day = True
|
||||
include_corpus_christi = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-JU')
|
||||
class Jura(Switzerland):
|
||||
'Jura'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_labour_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_boxing_day = False
|
||||
|
||||
FIXED_HOLIDAYS = Switzerland.FIXED_HOLIDAYS + (
|
||||
(6, 23, "Independence Day"),
|
||||
)
|
||||
|
||||
|
||||
@iso_register('CH-LU')
|
||||
class Luzern(Switzerland):
|
||||
'Luzern'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_epiphany = True
|
||||
include_st_josephs_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-NE')
|
||||
class Neuchatel(Switzerland):
|
||||
'Neuchâtel'
|
||||
|
||||
include_boxing_day = False
|
||||
include_berchtolds_day = True
|
||||
include_labour_day = True
|
||||
|
||||
FIXED_HOLIDAYS = Switzerland.FIXED_HOLIDAYS + (
|
||||
(3, 1, "Republic Day"),
|
||||
)
|
||||
|
||||
|
||||
@iso_register('CH-NW')
|
||||
class Nidwalden(Switzerland):
|
||||
'Nidwalden'
|
||||
|
||||
include_st_josephs_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-OW')
|
||||
class Obwalden(Switzerland):
|
||||
'Obwalden'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
FIXED_HOLIDAYS = Switzerland.FIXED_HOLIDAYS + (
|
||||
(9, 25, "Saint Nicholas of Flüe Day"),
|
||||
)
|
||||
|
||||
|
||||
@iso_register('CH-SG')
|
||||
class StGallen(Switzerland):
|
||||
'St. Gallen'
|
||||
|
||||
include_all_saints = True
|
||||
|
||||
|
||||
@iso_register('CH-SH')
|
||||
class Schaffhausen(Switzerland):
|
||||
'Schaffhausen'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_labour_day = True
|
||||
|
||||
|
||||
@iso_register('CH-SO')
|
||||
class Solothurn(Switzerland):
|
||||
'Solothurn'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_st_josephs_day = True
|
||||
include_labour_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-SZ')
|
||||
class Schwyz(Switzerland):
|
||||
'Schwyz'
|
||||
|
||||
include_epiphany = True
|
||||
include_st_josephs_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-TG')
|
||||
class Thurgau(Switzerland):
|
||||
'Thurgau'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_labour_day = True
|
||||
|
||||
|
||||
@iso_register('CH-TI')
|
||||
class Ticino(Switzerland):
|
||||
'Ticino'
|
||||
|
||||
include_good_friday = False
|
||||
include_epiphany = True
|
||||
include_st_josephs_day = True
|
||||
include_labour_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
FIXED_HOLIDAYS = Switzerland.FIXED_HOLIDAYS + (
|
||||
(6, 29, "Saints Peter and Paul"),
|
||||
)
|
||||
|
||||
|
||||
@iso_register('CH-UR')
|
||||
class Uri(Switzerland):
|
||||
'Uri'
|
||||
|
||||
include_epiphany = True
|
||||
include_st_josephs_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-VD')
|
||||
class Vaud(Switzerland):
|
||||
'Vaud'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_boxing_day = False
|
||||
|
||||
def get_federal_thanksgiving_monday(self, year):
|
||||
"Monday following the 3rd sunday of September"
|
||||
third_sunday = self.get_nth_weekday_in_month(year, 9, SUN, 3)
|
||||
return (
|
||||
third_sunday + timedelta(days=1),
|
||||
"Federal Thanksgiving Monday"
|
||||
)
|
||||
|
||||
def get_variable_days(self, year):
|
||||
days = super().get_variable_days(year)
|
||||
days.append(self.get_federal_thanksgiving_monday(year))
|
||||
return days
|
||||
|
||||
|
||||
@iso_register('CH-VS')
|
||||
class Valais(Switzerland):
|
||||
'Valais'
|
||||
|
||||
include_good_friday = False
|
||||
include_easter_monday = False
|
||||
include_whit_monday = False
|
||||
include_st_josephs_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
include_boxing_day = False
|
||||
|
||||
|
||||
@iso_register('CH-ZG')
|
||||
class Zug(Switzerland):
|
||||
'Zug'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_corpus_christi = True
|
||||
include_assumption = True
|
||||
include_all_saints = True
|
||||
include_immaculate_conception = True
|
||||
|
||||
|
||||
@iso_register('CH-ZH')
|
||||
class Zurich(Switzerland):
|
||||
'Zürich'
|
||||
|
||||
include_berchtolds_day = True
|
||||
include_labour_day = True
|
||||
|
|
|
@ -35,7 +35,6 @@ from ..europe import (
|
|||
Serbia,
|
||||
Spain, Catalonia,
|
||||
Slovenia,
|
||||
Switzerland, Vaud, Geneva,
|
||||
Ukraine,
|
||||
UnitedKingdom,
|
||||
UnitedKingdomNorthernIreland,
|
||||
|
@ -1303,80 +1302,6 @@ class SloveniaTest(GenericCalendarTest):
|
|||
self.assertIn(date(2017, 1, 2), holidays)
|
||||
|
||||
|
||||
class SwitzerlandTest(GenericCalendarTest):
|
||||
cal_class = Switzerland
|
||||
|
||||
def test_year_2015(self):
|
||||
holidays = self.cal.holidays_set(2015)
|
||||
self.assertIn(date(2015, 1, 1), holidays)
|
||||
self.assertIn(date(2015, 1, 2), holidays)
|
||||
self.assertIn(date(2015, 4, 3), holidays)
|
||||
self.assertIn(date(2015, 4, 5), holidays)
|
||||
self.assertIn(date(2015, 4, 6), holidays)
|
||||
self.assertIn(date(2015, 5, 1), holidays)
|
||||
self.assertIn(date(2015, 5, 14), holidays)
|
||||
self.assertIn(date(2015, 5, 24), holidays)
|
||||
self.assertIn(date(2015, 5, 25), holidays)
|
||||
self.assertIn(date(2015, 8, 1), holidays)
|
||||
self.assertIn(date(2015, 12, 25), holidays)
|
||||
self.assertIn(date(2015, 12, 26), holidays)
|
||||
|
||||
def test_year_2016(self):
|
||||
holidays = self.cal.holidays_set(2016)
|
||||
self.assertIn(date(2016, 1, 1), holidays)
|
||||
self.assertIn(date(2016, 1, 2), holidays)
|
||||
self.assertIn(date(2016, 3, 25), holidays)
|
||||
self.assertIn(date(2016, 3, 28), holidays)
|
||||
self.assertIn(date(2016, 5, 1), holidays)
|
||||
self.assertIn(date(2016, 5, 5), holidays)
|
||||
self.assertIn(date(2016, 5, 15), holidays)
|
||||
self.assertIn(date(2016, 5, 16), holidays)
|
||||
self.assertIn(date(2016, 8, 1), holidays)
|
||||
self.assertIn(date(2016, 12, 25), holidays)
|
||||
self.assertIn(date(2016, 12, 26), holidays)
|
||||
|
||||
|
||||
class VaudTest(GenericCalendarTest):
|
||||
cal_class = Vaud
|
||||
|
||||
def test_year_2016(self):
|
||||
holidays = self.cal.holidays_set(2016)
|
||||
self.assertIn(date(2016, 9, 19), holidays)
|
||||
self.assertNotIn(date(2016, 5, 1), holidays)
|
||||
self.assertNotIn(date(2016, 12, 26), holidays)
|
||||
|
||||
def test_year_2017(self):
|
||||
holidays = self.cal.holidays_set(2017)
|
||||
self.assertIn(date(2017, 9, 18), holidays)
|
||||
self.assertNotIn(date(2017, 5, 1), holidays)
|
||||
self.assertNotIn(date(2017, 12, 26), holidays)
|
||||
|
||||
|
||||
class GenevaTest(GenericCalendarTest):
|
||||
cal_class = Geneva
|
||||
|
||||
def test_year_2018(self):
|
||||
holidays = self.cal.holidays_set(2018)
|
||||
self.assertIn(date(2018, 9, 6), holidays)
|
||||
self.assertIn(date(2018, 12, 31), holidays)
|
||||
self.assertNotIn(date(2018, 5, 1), holidays)
|
||||
self.assertNotIn(date(2018, 12, 26), holidays)
|
||||
|
||||
def test_year_2019(self):
|
||||
holidays = self.cal.holidays_set(2019)
|
||||
self.assertIn(date(2019, 9, 5), holidays)
|
||||
self.assertIn(date(2019, 12, 31), holidays)
|
||||
self.assertNotIn(date(2019, 5, 1), holidays)
|
||||
self.assertNotIn(date(2019, 12, 26), holidays)
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 9, 10), holidays)
|
||||
self.assertIn(date(2020, 12, 31), holidays)
|
||||
self.assertNotIn(date(2020, 5, 1), holidays)
|
||||
self.assertNotIn(date(2020, 12, 26), holidays)
|
||||
|
||||
|
||||
class EstoniaTest(GenericCalendarTest):
|
||||
cal_class = Estonia
|
||||
|
||||
|
|
|
@ -7,10 +7,19 @@ from ..europe import (
|
|||
Malta, Netherlands, Norway, Poland, Portugal, Romania, Russia, Slovakia,
|
||||
Slovenia, Spain,
|
||||
# Catalonia, # TODO: Add it to registry
|
||||
Sweden, Switzerland, Vaud, Geneva, UnitedKingdom,
|
||||
Sweden, UnitedKingdom,
|
||||
UnitedKingdomNorthernIreland,
|
||||
)
|
||||
|
||||
# Switzerland
|
||||
from ..europe import (
|
||||
Switzerland,
|
||||
Aargau, AppenzellInnerrhoden, AppenzellAusserrhoden, Bern, BaselLandschaft,
|
||||
BaselStadt, Fribourg, Geneva, Glarus, Graubunden, Jura, Luzern, Neuchatel,
|
||||
Nidwalden, Obwalden, StGallen, Schaffhausen, Solothurn, Schwyz, Thurgau,
|
||||
Ticino, Uri, Vaud, Valais, Zug, Zurich
|
||||
)
|
||||
|
||||
# Germany
|
||||
from ..europe import (
|
||||
Germany, BadenWurttemberg, Bavaria, Berlin, Brandenburg, Bremen,
|
||||
|
@ -31,6 +40,13 @@ GERMANY_REGION_CLASSES = (
|
|||
SaxonyAnhalt, SchleswigHolstein, Thuringia
|
||||
)
|
||||
|
||||
SWITZERLAND_REGION_CLASSES = (
|
||||
Aargau, AppenzellInnerrhoden, AppenzellAusserrhoden, Bern, BaselLandschaft,
|
||||
BaselStadt, Fribourg, Geneva, Glarus, Graubunden, Jura, Luzern, Neuchatel,
|
||||
Nidwalden, Obwalden, StGallen, Schaffhausen, Solothurn, Schwyz, Thurgau,
|
||||
Ticino, Uri, Vaud, Valais, Zug, Zurich
|
||||
)
|
||||
|
||||
|
||||
class RegistryEurope(TestCase):
|
||||
def test_europe(self):
|
||||
|
@ -72,6 +88,8 @@ class RegistryEurope(TestCase):
|
|||
self.assertIn(Germany, classes)
|
||||
for klass in GERMANY_REGION_CLASSES:
|
||||
self.assertIn(klass, classes)
|
||||
for klass in SWITZERLAND_REGION_CLASSES:
|
||||
self.assertIn(klass, classes)
|
||||
|
||||
def test_germany_subregion(self):
|
||||
# Get all the subregions
|
||||
|
@ -80,6 +98,13 @@ class RegistryEurope(TestCase):
|
|||
for klass in GERMANY_REGION_CLASSES:
|
||||
self.assertIn(klass, classes)
|
||||
|
||||
def test_switzerland_subregion(self):
|
||||
# Get all the subregions
|
||||
classes = (v for k, v in registry.get_subregions('CH').items())
|
||||
classes = list(classes)
|
||||
for klass in SWITZERLAND_REGION_CLASSES:
|
||||
self.assertIn(klass, classes)
|
||||
|
||||
def test_slovenia_code(self):
|
||||
# Source: https://github.com/peopledoc/workalendar/pull/291
|
||||
self.assertEqual(registry.region_registry['SI'], Slovenia)
|
||||
|
|
|
@ -0,0 +1,879 @@
|
|||
from datetime import date
|
||||
|
||||
from . import GenericCalendarTest
|
||||
from ..europe import (
|
||||
Aargau, AppenzellInnerrhoden, AppenzellAusserrhoden, Bern, BaselLandschaft,
|
||||
BaselStadt, Fribourg, Geneva, Glarus, Graubunden, Jura, Luzern, Neuchatel,
|
||||
Nidwalden, Obwalden, StGallen, Schaffhausen, Solothurn, Schwyz, Thurgau,
|
||||
Ticino, Uri, Vaud, Valais, Zug, Zurich
|
||||
)
|
||||
|
||||
|
||||
class AargauTest(GenericCalendarTest):
|
||||
cal_class = Aargau
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class AppenzellInnerrhodenTest(GenericCalendarTest):
|
||||
cal_class = AppenzellInnerrhoden
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class AppenzellAusserrhodenTest(GenericCalendarTest):
|
||||
cal_class = AppenzellAusserrhoden
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class BernTest(GenericCalendarTest):
|
||||
cal_class = Bern
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class BaselLandschaftTest(GenericCalendarTest):
|
||||
cal_class = BaselLandschaft
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class BaselStadtTest(GenericCalendarTest):
|
||||
cal_class = BaselStadt
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class FribourgTest(GenericCalendarTest):
|
||||
cal_class = Fribourg
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class GenevaTest(GenericCalendarTest):
|
||||
cal_class = Geneva
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
# Jeune Genevois, only in Geneva
|
||||
self.assertIn(date(2020, 9, 10), holidays)
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
# Restoration day - Geneva
|
||||
self.assertIn(date(2020, 12, 31), holidays)
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
# Jeune Genevois, only in Geneva
|
||||
self.assertIn(date(2021, 9, 9), holidays)
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
# Restoration day - Geneva
|
||||
self.assertIn(date(2021, 12, 31), holidays)
|
||||
|
||||
|
||||
class GlarusTest(GenericCalendarTest):
|
||||
cal_class = Glarus
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
# Only in Glarus/Glaris
|
||||
self.assertIn(date(2020, 4, 3), holidays) # Näfels Day
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
# Only in Glarus/Glaris
|
||||
self.assertIn(date(2021, 4, 3), holidays) # Näfels Day
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class GraubundenTest(GenericCalendarTest):
|
||||
cal_class = Graubunden
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2020, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2021, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class JuraTest(GenericCalendarTest):
|
||||
cal_class = Jura
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
# Independance day - Only in Jura
|
||||
self.assertIn(date(2020, 6, 23), holidays)
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
# Independance day - Only in Jura
|
||||
self.assertIn(date(2021, 6, 23), holidays)
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
|
||||
|
||||
class LuzernTest(GenericCalendarTest):
|
||||
cal_class = Luzern
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2020, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2021, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class NeuchatelTest(GenericCalendarTest):
|
||||
cal_class = Neuchatel
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 3, 1), holidays) # Republic Day
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 3, 1), holidays) # Republic Day
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
|
||||
|
||||
class NidwaldenTest(GenericCalendarTest):
|
||||
cal_class = Nidwalden
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class ObwaldenTest(GenericCalendarTest):
|
||||
cal_class = Obwalden
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 9, 25), holidays) # Saint Nicholas of Flüe
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 9, 25), holidays) # Saint Nicholas of Flüe
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class StGallenTest(GenericCalendarTest):
|
||||
cal_class = StGallen
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class SchaffhausenTest(GenericCalendarTest):
|
||||
cal_class = Schaffhausen
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class SolothurnTest(GenericCalendarTest):
|
||||
cal_class = Solothurn
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class SchwyzTest(GenericCalendarTest):
|
||||
cal_class = Schwyz
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2020, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2021, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class ThurgauTest(GenericCalendarTest):
|
||||
cal_class = Thurgau
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class TicinoTest(GenericCalendarTest):
|
||||
cal_class = Ticino
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2020, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
# St Peter & St Paul - Only in Ticino
|
||||
self.assertIn(date(2020, 6, 29), holidays)
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2021, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
# St Peter & St Paul - Only in Ticino
|
||||
self.assertIn(date(2021, 6, 29), holidays)
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class UriTest(GenericCalendarTest):
|
||||
cal_class = Uri
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2020, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 6), holidays) # Epiphany
|
||||
self.assertIn(date(2021, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class VaudTest(GenericCalendarTest):
|
||||
cal_class = Vaud
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
# Lundi du Jeûne - Only in Vaud
|
||||
self.assertIn(date(2020, 9, 21), holidays)
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
# Lundi du Jeûne - Only in Vaud
|
||||
self.assertIn(date(2021, 9, 20), holidays)
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
|
||||
|
||||
class ValaisTest(GenericCalendarTest):
|
||||
cal_class = Valais
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 3, 19), holidays) # St Joseph
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
|
||||
|
||||
class ZugTest(GenericCalendarTest):
|
||||
cal_class = Zug
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 6, 11), holidays) # Corpus Christi
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2020, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2020, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 6, 3), holidays) # Corpus Christi
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 8, 15), holidays) # Assumption
|
||||
self.assertIn(date(2021, 11, 1), holidays) # All Saints
|
||||
self.assertIn(date(2021, 12, 8), holidays) # Immaculate conception
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
|
||||
class ZurichTest(GenericCalendarTest):
|
||||
cal_class = Zurich
|
||||
|
||||
def test_year_2020(self):
|
||||
holidays = self.cal.holidays_set(2020)
|
||||
self.assertIn(date(2020, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2020, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2020, 4, 10), holidays) # Good Friday
|
||||
self.assertIn(date(2020, 4, 13), holidays) # Easter Monday
|
||||
self.assertIn(date(2020, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2020, 5, 21), holidays) # Ascension day
|
||||
self.assertIn(date(2020, 6, 1), holidays) # Whit Monday
|
||||
self.assertIn(date(2020, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2020, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2020, 12, 26), holidays) # St Stephen's day
|
||||
|
||||
def test_year_2021(self):
|
||||
holidays = self.cal.holidays_set(2021)
|
||||
self.assertIn(date(2021, 1, 1), holidays) # New years day
|
||||
self.assertIn(date(2021, 1, 2), holidays) # Berchtolds
|
||||
self.assertIn(date(2021, 4, 2), holidays) # Good Friday
|
||||
self.assertIn(date(2021, 4, 5), holidays) # Easter Monday
|
||||
self.assertIn(date(2021, 5, 1), holidays) # Labour Day
|
||||
self.assertIn(date(2021, 5, 13), holidays) # Ascension day
|
||||
self.assertIn(date(2021, 5, 24), holidays) # Whit Monday
|
||||
self.assertIn(date(2021, 8, 1), holidays) # Swiss National Day
|
||||
self.assertIn(date(2021, 12, 25), holidays) # XMas
|
||||
self.assertIn(date(2021, 12, 26), holidays) # St Stephen's day
|
Loading…
Reference in New Issue