From f0cfe9c6b23a457bc6539c59389c2fbbe6f04e8a Mon Sep 17 00:00:00 2001 From: Bruno Bord Date: Fri, 22 May 2020 14:53:28 +0200 Subject: [PATCH] Implementing tests for all Switzerland Cantons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Moving Switzerland tests to their own module * All Cantons have associated tests: 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 * Tests added for Switzerland ISO registry entries (+ subregions) --- README.rst | 6 +- docs/iso-registry.md | 62 +- workalendar/europe/__init__.py | 10 +- workalendar/europe/switzerland.py | 10 +- workalendar/tests/test_europe.py | 75 -- workalendar/tests/test_registry_europe.py | 27 +- workalendar/tests/test_switzerland.py | 879 ++++++++++++++++++++++ 7 files changed, 957 insertions(+), 112 deletions(-) create mode 100644 workalendar/tests/test_switzerland.py diff --git a/README.rst b/README.rst index b79c6c9..7d432d4 100644 --- a/README.rst +++ b/README.rst @@ -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) diff --git a/docs/iso-registry.md b/docs/iso-registry.md index 158a4da..f756302 100644 --- a/docs/iso-registry.md +++ b/docs/iso-registry.md @@ -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': , - 'CA-AB': , - 'CA-BC': , - 'CA-MB': , - 'CA-NB': , - 'CA-NL': , - 'CA-NS': , - 'CA-NT': , - 'CA-NU': , - 'CA-ON': , - 'CA-PE': , - 'CA-QC': , - 'CA-SK': , - 'CA-YT': , - 'CH': , - 'CH-VD': , - 'CH-GE': , - 'FR': } +{'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'), diff --git a/workalendar/europe/__init__.py b/workalendar/europe/__init__.py index 8d1ba19..dec04b7 100644 --- a/workalendar/europe/__init__.py +++ b/workalendar/europe/__init__.py @@ -56,8 +56,8 @@ from .scotland import ( from .switzerland import ( Switzerland, Aargau, AppenzellInnerrhoden, AppenzellAusserrhoden, Bern, BaselLandschaft, BaselStadt, Fribourg, Geneva, Glarus, Graubunden, Jura, - Luzern, Neuchatel, Nidwalden, StGallen, Schaffhausen, Solothurn, Schwyz, - Thurgau, Ticino, Uri, Vaud, Valais, Zug, Zurich + Luzern, Neuchatel, Nidwalden, Obwalden, StGallen, Schaffhausen, Solothurn, + Schwyz, Thurgau, Ticino, Uri, Vaud, Valais, Zug, Zurich ) __all__ = ( @@ -119,7 +119,7 @@ __all__ = ( 'Switzerland', 'Aargau', 'AppenzellInnerrhoden', 'AppenzellAusserrhoden', 'Bern', 'BaselLandschaft', 'BaselStadt', 'Fribourg', 'Geneva', 'Glarus', - 'Graubunden', 'Jura', 'Luzern', 'Neuchatel', 'Nidwalden', 'StGallen', - 'Schaffhausen', 'Solothurn', 'Schwyz', 'Thurgau', 'Ticino', 'Uri', 'Vaud', - 'Valais', 'Zug', 'Zurich', + 'Graubunden', 'Jura', 'Luzern', 'Neuchatel', 'Nidwalden', 'Obwalden', + 'StGallen', 'Schaffhausen', 'Solothurn', 'Schwyz', 'Thurgau', 'Ticino', + 'Uri', 'Vaud', 'Valais', 'Zug', 'Zurich', ) diff --git a/workalendar/europe/switzerland.py b/workalendar/europe/switzerland.py index eeb4acf..cbbdaf2 100644 --- a/workalendar/europe/switzerland.py +++ b/workalendar/europe/switzerland.py @@ -306,17 +306,15 @@ class Vaud(Switzerland): def get_federal_thanksgiving_monday(self, year): "Monday following the 3rd sunday of September" - september_1st = date(year, 9, 1) + third_sunday = self.get_nth_weekday_in_month(year, 9, SUN, 3) return ( - september_1st + - (6 - september_1st.weekday()) * timedelta(days=1) + # 1st sunday - timedelta(days=15) # Monday following 3rd sunday + 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), - "Federal Thanksgiving Monday")) + days.append(self.get_federal_thanksgiving_monday(year)) return days diff --git a/workalendar/tests/test_europe.py b/workalendar/tests/test_europe.py index 73b23c3..1be690d 100644 --- a/workalendar/tests/test_europe.py +++ b/workalendar/tests/test_europe.py @@ -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 diff --git a/workalendar/tests/test_registry_europe.py b/workalendar/tests/test_registry_europe.py index d1fd9b2..c7cd008 100644 --- a/workalendar/tests/test_registry_europe.py +++ b/workalendar/tests/test_registry_europe.py @@ -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) diff --git a/workalendar/tests/test_switzerland.py b/workalendar/tests/test_switzerland.py new file mode 100644 index 0000000..29d16c4 --- /dev/null +++ b/workalendar/tests/test_switzerland.py @@ -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