From 6245265853b9f665c9f665044578411efe782203 Mon Sep 17 00:00:00 2001 From: ~Jhellico Date: Tue, 2 Apr 2024 22:10:54 +0300 Subject: [PATCH 1/2] Update Poland holidays: fix Ascension Day --- holidays/countries/poland.py | 3 +-- snapshots/countries/PL_COMMON.json | 2 +- tests/countries/test_poland.py | 12 ++++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/holidays/countries/poland.py b/holidays/countries/poland.py index d3e83d355..d97d02d5f 100644 --- a/holidays/countries/poland.py +++ b/holidays/countries/poland.py @@ -10,7 +10,6 @@ # Website: https://github.com/vacanza/python-holidays # License: MIT (see LICENSE file) -from datetime import timedelta as td from gettext import gettext as tr from holidays.calendars.gregorian import NOV @@ -68,7 +67,7 @@ def _populate_public_holidays(self): if self._year <= 1950: # Ascension Day. - self._add_holiday(tr("Wniebowstąpienie Pańskie"), self._easter_sunday + td(days=+40)) + self._add_ascension_thursday(tr("Wniebowstąpienie Pańskie")) # Pentecost. self._add_whit_sunday(tr("Zielone Świątki")) diff --git a/snapshots/countries/PL_COMMON.json b/snapshots/countries/PL_COMMON.json index 4fd800f6f..1aaf3d292 100644 --- a/snapshots/countries/PL_COMMON.json +++ b/snapshots/countries/PL_COMMON.json @@ -7,7 +7,7 @@ "1950-05-01": "National Day", "1950-05-03": "National Day of the Third of May", "1950-05-09": "National Victory and Freedom Day", - "1950-05-19": "Ascension Day", + "1950-05-18": "Ascension Day", "1950-05-28": "Pentecost", "1950-05-29": "Whit Monday", "1950-06-08": "Corpus Christi", diff --git a/tests/countries/test_poland.py b/tests/countries/test_poland.py index bd7c4f725..ca7e709d2 100644 --- a/tests/countries/test_poland.py +++ b/tests/countries/test_poland.py @@ -138,7 +138,7 @@ def test_swieto_narodowe_trzeciego_maja(self): def test_narodowe_swieto_zwyciestwa_i_wolnosci(self): self.assertHoliday(f"{year}-05-09" for year in range(1946, 1951)) - self.assertNoHoliday(f"{year}-05-09" for year in range(1925, 1946)) + self.assertNoHoliday(f"{year}-05-09" for year in set(range(1925, 1946)).difference({1929})) self.assertNoHoliday(f"{year}-05-09" for year in range(1951, 2050)) self.assertNoHolidayName( "Narodowe Święto Zwycięstwa i Wolności", range(1925, 1946), range(1951, 2050) @@ -146,11 +146,11 @@ def test_narodowe_swieto_zwyciestwa_i_wolnosci(self): def test_wniebowstapienie_panskie(self): self.assertHoliday( - "1930-05-30", - "1934-05-11", - "1939-05-19", - "1945-05-11", - "1950-05-19", + "1930-05-29", + "1934-05-10", + "1939-05-18", + "1945-05-10", + "1950-05-18", ) self.assertNoHolidayName("Wniebowstąpienie Pańskie", range(1951, 2050)) From 14dd7cf0a36751d2b8673fc4b544276d834df55f Mon Sep 17 00:00:00 2001 From: ~Jhellico Date: Wed, 3 Apr 2024 18:56:52 +0300 Subject: [PATCH 2/2] PR suggestion Co-authored-by: Arkadii Yakovets --- tests/countries/test_poland.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/countries/test_poland.py b/tests/countries/test_poland.py index ca7e709d2..e2bff3e07 100644 --- a/tests/countries/test_poland.py +++ b/tests/countries/test_poland.py @@ -138,7 +138,9 @@ def test_swieto_narodowe_trzeciego_maja(self): def test_narodowe_swieto_zwyciestwa_i_wolnosci(self): self.assertHoliday(f"{year}-05-09" for year in range(1946, 1951)) - self.assertNoHoliday(f"{year}-05-09" for year in set(range(1925, 1946)).difference({1929})) + self.assertNoHoliday( + f"{year}-05-09" for year in set(range(1925, 1946)).difference({1929}) + ) # Exclude Ascension day on 09/05/1929 self.assertNoHoliday(f"{year}-05-09" for year in range(1951, 2050)) self.assertNoHolidayName( "Narodowe Święto Zwycięstwa i Wolności", range(1925, 1946), range(1951, 2050)