From db423956cf36de6f6962b6afd7bca327534cdba8 Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Mon, 29 Jan 2024 11:35:07 -0800 Subject: [PATCH] Use ruff instead of black+flake8 (#1671) --- .pre-commit-config.yaml | 36 +++++------- holidays/countries/albania.py | 6 +- holidays/countries/angola.py | 6 +- holidays/countries/aruba.py | 6 +- holidays/countries/belize.py | 3 +- holidays/countries/bulgaria.py | 3 +- holidays/countries/cambodia.py | 8 +-- holidays/countries/cameroon.py | 6 +- holidays/countries/chad.py | 6 +- holidays/countries/china.py | 12 +++- holidays/countries/hongkong.py | 3 +- holidays/countries/hungary.py | 3 +- holidays/countries/ireland.py | 3 +- holidays/countries/malaysia.py | 13 ++++- holidays/countries/marshall_islands.py | 3 +- holidays/countries/new_zealand.py | 3 +- holidays/countries/nigeria.py | 6 +- holidays/countries/philippines.py | 6 +- holidays/countries/south_korea.py | 3 +- holidays/countries/spain.py | 6 +- holidays/countries/tanzania.py | 6 +- holidays/countries/thailand.py | 21 ++----- holidays/countries/timor_leste.py | 6 +- holidays/countries/united_states.py | 14 ++++- holidays/countries/vanuatu.py | 3 +- holidays/countries/zambia.py | 6 +- holidays/groups/christian.py | 6 +- holidays/holiday_base.py | 7 ++- holidays/observed_holiday_base.py | 5 +- holidays/registry.py | 7 ++- holidays/utils.py | 3 +- pyproject.toml | 21 +++++-- requirements/dev.txt | 1 + scripts/generate_release_notes.py | 4 +- scripts/generate_snapshots.py | 6 +- tests/countries/test_argentina.py | 36 +++++++++--- tests/countries/test_australia.py | 28 ++++++--- tests/countries/test_azerbaijan.py | 13 ++++- tests/countries/test_belize.py | 21 ++++--- tests/countries/test_bolivia.py | 10 +++- .../countries/test_bosnia_and_herzegovina.py | 5 +- tests/countries/test_bulgaria.py | 20 +++++-- tests/countries/test_burundi.py | 3 +- tests/countries/test_cambodia.py | 39 +++---------- tests/countries/test_canada.py | 8 ++- tests/countries/test_chile.py | 3 +- tests/countries/test_costa_rica.py | 25 ++++++-- tests/countries/test_croatia.py | 23 ++++++-- tests/countries/test_cuba.py | 3 +- tests/countries/test_ecuador.py | 26 +++++++-- tests/countries/test_germany.py | 36 ++++++++---- tests/countries/test_hongkong.py | 15 +++-- tests/countries/test_hungary.py | 6 +- tests/countries/test_italy.py | 3 +- tests/countries/test_laos.py | 15 ++--- tests/countries/test_lithuania.py | 5 +- tests/countries/test_malaysia.py | 5 +- tests/countries/test_namibia.py | 6 +- tests/countries/test_papua_new_guinea.py | 4 +- tests/countries/test_paraguay.py | 15 +++-- tests/countries/test_poland.py | 4 +- tests/countries/test_russia.py | 3 +- tests/countries/test_slovakia.py | 11 +++- tests/countries/test_slovenia.py | 6 +- tests/countries/test_spain.py | 57 +++++++++++++++++-- tests/countries/test_switzerland.py | 14 ++++- tests/countries/test_thailand.py | 29 ++++------ tests/countries/test_timor_leste.py | 5 +- tests/countries/test_tonga.py | 50 ++++++++++++---- tests/countries/test_ukraine.py | 20 +++++-- tests/countries/test_united_kingdom.py | 32 ++++++++--- tests/countries/test_united_states.py | 50 ++++++++++++---- tests/countries/test_uruguay.py | 10 +++- tests/countries/test_vatican_city.py | 3 +- tests/countries/test_vietnam.py | 6 +- tests/test_holiday_base.py | 33 ++++++++--- tox.ini | 3 - 77 files changed, 666 insertions(+), 300 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cba06a00e..db8681b20 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,27 +18,19 @@ repos: exclude_types: - rst - - repo: https://github.com/python/black - rev: 23.12.1 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.14 hooks: - - id: black - exclude: ^(docs) - language_version: python3 + - id: ruff + - id: ruff-format - - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + - repo: https://github.com/myint/rstcheck + rev: v6.2.0 hooks: - - id: flake8 + - id: rstcheck additional_dependencies: - - flake8-print - args: [--max-line-length=99] - exclude: ^(docs) - - - repo: https://github.com/pycqa/isort - rev: 5.13.2 - hooks: - - id: isort - exclude: ^(docs) + - rstcheck + - sphinx - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.8.0 @@ -55,13 +47,11 @@ repos: hooks: - id: rst-backticks - - repo: https://github.com/myint/rstcheck - rev: v6.2.0 + - repo: https://github.com/pycqa/isort + rev: 5.13.2 hooks: - - id: rstcheck - additional_dependencies: - - rstcheck - - sphinx + - id: isort + exclude: ^(docs) - repo: https://github.com/tox-dev/tox-ini-fmt rev: '1.3.1' diff --git a/holidays/countries/albania.py b/holidays/countries/albania.py index a5b81dac2..431591cb6 100644 --- a/holidays/countries/albania.py +++ b/holidays/countries/albania.py @@ -21,7 +21,11 @@ class Albania( - ObservedHolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays, StaticHolidays + ObservedHolidayBase, + ChristianHolidays, + InternationalHolidays, + IslamicHolidays, + StaticHolidays, ): """ References: diff --git a/holidays/countries/angola.py b/holidays/countries/angola.py index 950355619..40f88fab1 100644 --- a/holidays/countries/angola.py +++ b/holidays/countries/angola.py @@ -165,11 +165,9 @@ def _populate_public_holidays(self): tr("Dia de Natal e da Família") if self._year >= 2011 else ( - # Christmas Day. - tr("Dia do Natal") + tr("Dia do Natal") # Christmas Day. if self._year >= 1996 - # Family Day. - else tr("Dia da Família") + else tr("Dia da Família") # Family Day. ) ) dt = self._add_christmas_day(name) diff --git a/holidays/countries/aruba.py b/holidays/countries/aruba.py index 4efc33f11..ebfbb54f7 100644 --- a/holidays/countries/aruba.py +++ b/holidays/countries/aruba.py @@ -105,11 +105,9 @@ def _populate_public_holidays(self): tr("Dia di Rey") if self._year >= 2021 else ( - # King's Day. - tr("Aña di Rey") + tr("Aña di Rey") # King's Day. if self._year >= 2014 - # Queen's Day. - else tr("Aña di La Reina") + else tr("Aña di La Reina") # Queen's Day. ) ) if self._year >= 2014: diff --git a/holidays/countries/belize.py b/holidays/countries/belize.py index 7d8b2d1a1..62ce2c3f1 100644 --- a/holidays/countries/belize.py +++ b/holidays/countries/belize.py @@ -93,7 +93,8 @@ def _populate_public_holidays(self): # Indigenous Peoples' Resistance Day / Pan American Day. name = "Indigenous Peoples' Resistance Day" if self._year >= 2021 else "Pan American Day" self._move_holiday( - self._add_columbus_day(name), rule=TUE_WED_THU_TO_PREV_MON + FRI_SUN_TO_NEXT_MON + self._add_columbus_day(name), + rule=TUE_WED_THU_TO_PREV_MON + FRI_SUN_TO_NEXT_MON, ) # Garifuna Settlement Day. diff --git a/holidays/countries/bulgaria.py b/holidays/countries/bulgaria.py index c3f0a32eb..194e91a9d 100644 --- a/holidays/countries/bulgaria.py +++ b/holidays/countries/bulgaria.py @@ -125,7 +125,8 @@ def _populate_public_holidays(self): if self.observed: self._populate_observed( - dts_observed, excluded_names={self.tr("Велика събота"), self.tr("Великден")} + dts_observed, + excluded_names={self.tr("Велика събота"), self.tr("Великден")}, ) def _populate_school_holidays(self): diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index 400bc3c6d..aa5df5e2f 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -146,11 +146,9 @@ def _populate_public_holidays(self): if self._year >= 1994: self._add_holiday_jun_18( - # Birthday of Her Majesty the Queen-Mother NORODOM MONINEATH SIHANOUK of Cambodia - tr( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម " - "មុនិនាថ សីហនុ" - ), + # Birthday of Her Majesty the Queen-Mother + # NORODOM MONINEATH SIHANOUK of Cambodia + tr("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ"), ) # ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ diff --git a/holidays/countries/cameroon.py b/holidays/countries/cameroon.py index 0870f5ee0..ab2dc014a 100644 --- a/holidays/countries/cameroon.py +++ b/holidays/countries/cameroon.py @@ -21,7 +21,11 @@ class Cameroon( - ObservedHolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays, StaticHolidays + ObservedHolidayBase, + ChristianHolidays, + InternationalHolidays, + IslamicHolidays, + StaticHolidays, ): """ References: diff --git a/holidays/countries/chad.py b/holidays/countries/chad.py index eeeb1e910..28e351b50 100644 --- a/holidays/countries/chad.py +++ b/holidays/countries/chad.py @@ -21,7 +21,11 @@ class Chad( - ObservedHolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays, StaticHolidays + ObservedHolidayBase, + ChristianHolidays, + InternationalHolidays, + IslamicHolidays, + StaticHolidays, ): """ References: diff --git a/holidays/countries/china.py b/holidays/countries/china.py index 51588eb75..b221751ea 100644 --- a/holidays/countries/china.py +++ b/holidays/countries/china.py @@ -441,7 +441,15 @@ class ChinaStaticHolidays: 2012: (JUN, 22, dragon_boat_festival), # observed from Jun 23 2015: (OCT, 6, mid_autumn_festival), # observed from Sep 27 2020: ( - (JAN, 30, chinese_new_year), # Spring Festival (extended due to Covid-19 decree) - (OCT, 6, mid_autumn_festival), # observed from Oct 1, overlap with National Day + ( + JAN, + 30, + chinese_new_year, + ), # Spring Festival (extended due to Covid-19 decree) + ( + OCT, + 6, + mid_autumn_festival, + ), # observed from Oct 1, overlap with National Day ), } diff --git a/holidays/countries/hongkong.py b/holidays/countries/hongkong.py index e2e9d0fbc..85bb84cbc 100644 --- a/holidays/countries/hongkong.py +++ b/holidays/countries/hongkong.py @@ -153,7 +153,8 @@ def _populate_public_holidays(self): self._add_mid_autumn_festival(name) else: self._add_holiday( - f"The second day of the {name} (Monday)", mid_autumn_date + td(days=+2) + f"The second day of the {name} (Monday)", + mid_autumn_date + td(days=+2), ) else: self._add_mid_autumn_festival_day_two(f"The day following the {name}") diff --git a/holidays/countries/hungary.py b/holidays/countries/hungary.py index be7db6cb3..e852c14df 100644 --- a/holidays/countries/hungary.py +++ b/holidays/countries/hungary.py @@ -87,9 +87,8 @@ def _populate_public_holidays(self): # Bread Day. tr("A kenyér ünnepe") if 1950 <= self._year <= 1989 - else # State Foundation Day. - tr("Az államalapítás ünnepe"), + else tr("Az államalapítás ünnepe"), ) if self._year >= 1991: diff --git a/holidays/countries/ireland.py b/holidays/countries/ireland.py index 9ef6cf781..534b26cc0 100644 --- a/holidays/countries/ireland.py +++ b/holidays/countries/ireland.py @@ -75,7 +75,8 @@ def _populate_public_holidays(self): # St. Stephen's Day. self._add_observed( - self._add_christmas_day_two("St. Stephen's Day"), rule=SAT_SUN_TO_NEXT_MON_TUE + self._add_christmas_day_two("St. Stephen's Day"), + rule=SAT_SUN_TO_NEXT_MON_TUE, ) diff --git a/holidays/countries/malaysia.py b/holidays/countries/malaysia.py index 1edb325e3..07bdf6923 100644 --- a/holidays/countries/malaysia.py +++ b/holidays/countries/malaysia.py @@ -227,7 +227,18 @@ def _populate_public_holidays(self): dts_observed.update(self._add_ramadan_beginning_day("Beginning of Ramadan")) # Nuzul Al-Quran Day. - if self.subdiv in {"KTN", "KUL", "LBN", "PHG", "PJY", "PLS", "PNG", "PRK", "SGR", "TRG"}: + if self.subdiv in { + "KTN", + "KUL", + "LBN", + "PHG", + "PJY", + "PLS", + "PNG", + "PRK", + "SGR", + "TRG", + }: dts_observed.update(self._add_nuzul_al_quran_day("Nuzul Al-Quran Day")) # Thaipusam. diff --git a/holidays/countries/marshall_islands.py b/holidays/countries/marshall_islands.py index 5e6ec5995..68d670034 100644 --- a/holidays/countries/marshall_islands.py +++ b/holidays/countries/marshall_islands.py @@ -35,7 +35,8 @@ def __init__(self, *args, **kwargs): def _populate_public_holidays(self): if self._year <= 2019: warnings.warn( - "Years before 2020 are not available for the Marshall Islands (MH).", Warning + "Years before 2020 are not available for the Marshall Islands (MH).", + Warning, ) # New Year's Day diff --git a/holidays/countries/new_zealand.py b/holidays/countries/new_zealand.py index 1b126bd23..211c21f6a 100644 --- a/holidays/countries/new_zealand.py +++ b/holidays/countries/new_zealand.py @@ -97,7 +97,8 @@ def _populate_public_holidays(self): # New Year's Day self._add_observed(self._add_new_years_day("New Year's Day"), rule=SAT_SUN_TO_NEXT_MON_TUE) self._add_observed( - self._add_new_years_day_two("Day after New Year's Day"), rule=SAT_SUN_TO_NEXT_MON_TUE + self._add_new_years_day_two("Day after New Year's Day"), + rule=SAT_SUN_TO_NEXT_MON_TUE, ) # Waitangi Day diff --git a/holidays/countries/nigeria.py b/holidays/countries/nigeria.py index e719d353e..7e228ff76 100644 --- a/holidays/countries/nigeria.py +++ b/holidays/countries/nigeria.py @@ -20,7 +20,11 @@ class Nigeria( - ObservedHolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays, StaticHolidays + ObservedHolidayBase, + ChristianHolidays, + InternationalHolidays, + IslamicHolidays, + StaticHolidays, ): """ https://en.wikipedia.org/wiki/Public_holidays_in_Nigeria diff --git a/holidays/countries/philippines.py b/holidays/countries/philippines.py index 4a9152e1c..e783a6bc5 100644 --- a/holidays/countries/philippines.py +++ b/holidays/countries/philippines.py @@ -20,7 +20,11 @@ class Philippines( - HolidayBase, ChineseCalendarHolidays, ChristianHolidays, InternationalHolidays, IslamicHolidays + HolidayBase, + ChineseCalendarHolidays, + ChristianHolidays, + InternationalHolidays, + IslamicHolidays, ): """ Philippines holidays. diff --git a/holidays/countries/south_korea.py b/holidays/countries/south_korea.py index e4fe15d48..63898d5c6 100644 --- a/holidays/countries/south_korea.py +++ b/holidays/countries/south_korea.py @@ -94,7 +94,8 @@ def _populate_observed(self, dts: Set[date], three_day_holidays: Dict[date, str] if not self._is_observed(dt): continue dt_observed = self._get_observed_date( - dt, SUN_TO_NEXT_WORKDAY if dt in three_day_holidays else SAT_SUN_TO_NEXT_WORKDAY + dt, + SUN_TO_NEXT_WORKDAY if dt in three_day_holidays else SAT_SUN_TO_NEXT_WORKDAY, ) if dt_observed != dt or len(self.get_list(dt)) > 1: if dt_observed == dt: diff --git a/holidays/countries/spain.py b/holidays/countries/spain.py index d1ad8d8e8..7432a5ca1 100644 --- a/holidays/countries/spain.py +++ b/holidays/countries/spain.py @@ -23,7 +23,11 @@ class Spain( - ObservedHolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays, StaticHolidays + ObservedHolidayBase, + ChristianHolidays, + InternationalHolidays, + IslamicHolidays, + StaticHolidays, ): """ Holidays checked with official sources for 2010-2023 only. diff --git a/holidays/countries/tanzania.py b/holidays/countries/tanzania.py index 01d422214..1c6f92296 100644 --- a/holidays/countries/tanzania.py +++ b/holidays/countries/tanzania.py @@ -24,7 +24,11 @@ class Tanzania( - HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays, StaticHolidays + HolidayBase, + ChristianHolidays, + InternationalHolidays, + IslamicHolidays, + StaticHolidays, ): """ References: diff --git a/holidays/countries/thailand.py b/holidays/countries/thailand.py index 4aa6cda94..fdcb62a7b 100644 --- a/holidays/countries/thailand.py +++ b/holidays/countries/thailand.py @@ -338,8 +338,7 @@ def _populate_public_holidays(self): elif self._year >= 2019: # Anniversary for the Death of King Bhumibol Adulyadej the Great. k_bhumibol_memorial = tr( - "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร " - "มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" + "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" ) else: # Anniversary for the Death of King Bhumibol Adulyadej. @@ -375,10 +374,7 @@ def _populate_public_holidays(self): elif self._year >= 2016: k_bhumibol_bday = ( # HM King Bhumibol Adulyadej Birthday Anniversary. - tr( - "วันคล้ายวันเฉลิมพระชนมพรรษา" - "พระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" - ) + tr("วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร") ) else: k_bhumibol_bday = ( @@ -504,10 +500,7 @@ def _populate_bank_holidays(self): if self._year <= 2021: self._add_holiday_apr_1( # Additional Closing Day for Bank for Agriculture and Agricultural Cooperatives - tr( - "วันหยุดเพิ่มเติมสำหรับการปิดบัญชีประจำปีของ" - "ธนาคารเพื่อการเกษตรและสหกรณ์การเกษตร" - ), + tr("วันหยุดเพิ่มเติมสำหรับการปิดบัญชีประจำปีของธนาคารเพื่อการเกษตรและสหกรณ์การเกษตร"), ) # วันหยุดภาคครึ่งปีของสถาบันการเงินและสถาบันการเงินเฉพาะกิจ @@ -728,13 +721,9 @@ class ThailandStaticHolidays: # Day of Mourning for HM King Bhumibol Adulyadej. rama_ix_mourning = tr("วันหยุดพิเศษ (ร่วมถวายอาลัย ส่งดวงพระวิญญาณพระบรมศพ)") # HM King Bhumibol Adulyadej's Royal Cremation Ceremony. - rama_ix_cremation = tr( - "วันพระราชพิธีถวายพระเพลิงพระบรมศพพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช" - ) + rama_ix_cremation = tr("วันพระราชพิธีถวายพระเพลิงพระบรมศพพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช") # HM King Maha Vajiralongkorn's Coronation Celebrations. - rama_x_coronation_celebrations = tr( - "พระราชพิธีบรมราชาภิเษก พระบาทสมเด็จพระวชิรเกล้าเจ้าอยู่หัว" - ) + rama_x_coronation_celebrations = tr("พระราชพิธีบรมราชาภิเษก พระบาทสมเด็จพระวชิรเกล้าเจ้าอยู่หัว") # Songkran Festival. songkran_festival = tr("วันสงกรานต์") diff --git a/holidays/countries/timor_leste.py b/holidays/countries/timor_leste.py index 744de2715..8519a5631 100644 --- a/holidays/countries/timor_leste.py +++ b/holidays/countries/timor_leste.py @@ -24,7 +24,11 @@ class TimorLeste( - HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays, StaticHolidays + HolidayBase, + ChristianHolidays, + InternationalHolidays, + IslamicHolidays, + StaticHolidays, ): """ References: diff --git a/holidays/countries/united_states.py b/holidays/countries/united_states.py index 0a7b3e114..21d9922c2 100644 --- a/holidays/countries/united_states.py +++ b/holidays/countries/united_states.py @@ -164,12 +164,22 @@ def _add_christmas_eve_holiday(self): # If on Saturday or Sunday, observed on Friday name = "Christmas Eve" self._add_observed( - self._add_christmas_eve(name), name=name, rule=FRI_TO_PREV_THU + SAT_SUN_TO_PREV_FRI + self._add_christmas_eve(name), + name=name, + rule=FRI_TO_PREV_THU + SAT_SUN_TO_PREV_FRI, ) def _populate_subdiv_holidays(self): # Martin Luther King Jr. Day - if self._year >= 1986 and self.subdiv not in {"AL", "AR", "AZ", "GA", "ID", "MS", "NH"}: + if self._year >= 1986 and self.subdiv not in { + "AL", + "AR", + "AZ", + "GA", + "ID", + "MS", + "NH", + }: self._add_holiday_3rd_mon_of_jan("Martin Luther King Jr. Day") # Washington's Birthday diff --git a/holidays/countries/vanuatu.py b/holidays/countries/vanuatu.py index 4bace4115..9d4a06fe3 100644 --- a/holidays/countries/vanuatu.py +++ b/holidays/countries/vanuatu.py @@ -78,7 +78,8 @@ def _populate_public_holidays(self): # Family Day. self._add_observed( - self._add_christmas_day_two("Family Day"), rule=SUN_TO_NEXT_MON + MON_TO_NEXT_TUE + self._add_christmas_day_two("Family Day"), + rule=SUN_TO_NEXT_MON + MON_TO_NEXT_TUE, ) diff --git a/holidays/countries/zambia.py b/holidays/countries/zambia.py index 8c96c3a82..300de69b9 100644 --- a/holidays/countries/zambia.py +++ b/holidays/countries/zambia.py @@ -100,7 +100,11 @@ class ZambiaStaticHolidays: special_public_holidays = { 2016: ( (AUG, 11, "General elections and referendum"), - (SEP, 13, "Inauguration ceremony of President-elect and Vice President-elect"), + ( + SEP, + 13, + "Inauguration ceremony of President-elect and Vice President-elect", + ), ), 2018: ( (MAR, 9, "Public holiday"), diff --git a/holidays/groups/christian.py b/holidays/groups/christian.py index de44351ad..f4c8c2c54 100644 --- a/holidays/groups/christian.py +++ b/holidays/groups/christian.py @@ -74,7 +74,11 @@ def __verify_calendar(calendar): """ Verify calendar type. """ - if calendar not in {GREGORIAN_CALENDAR, JULIAN_CALENDAR, JULIAN_REVISED_CALENDAR}: + if calendar not in { + GREGORIAN_CALENDAR, + JULIAN_CALENDAR, + JULIAN_REVISED_CALENDAR, + }: raise ValueError( f"Unknown calendar name: {calendar}. " f"Use `{GREGORIAN_CALENDAR}`, `{JULIAN_CALENDAR}` or `{JULIAN_REVISED_CALENDAR}`." diff --git a/holidays/holiday_base.py b/holidays/holiday_base.py index 8ff17af65..457565e18 100644 --- a/holidays/holiday_base.py +++ b/holidays/holiday_base.py @@ -480,7 +480,8 @@ def __getattr__(self, name): # Handle patterns (e.g., # _add_holiday_1st_mon_before_jun_15() or _add_holiday_1st_mon_from_jun_15()). nth_weekday_from = re.match( - r"_add_holiday_(\d{1,2})\w{2}_(\w+)_(before|from)_(\w{3})_(\d{1,2})", name + r"_add_holiday_(\d{1,2})\w{2}_(\w+)_(before|from)_(\w{3})_(\d{1,2})", + name, ) if nth_weekday_from: number, weekday, date_direction, month, day = nth_weekday_from.groups() @@ -708,7 +709,9 @@ def _add_special_holidays(self, mapping_names, observed=False): self._add_holiday( self.tr(self.substituted_label) % date( - optional[0] if optional else self._year, from_month, from_day + optional[0] if optional else self._year, + from_month, + from_day, ).strftime(self.tr(self.substituted_date_format)), to_month, to_day, diff --git a/holidays/observed_holiday_base.py b/holidays/observed_holiday_base.py index 3ca02d79c..0f0372572 100644 --- a/holidays/observed_holiday_base.py +++ b/holidays/observed_holiday_base.py @@ -123,7 +123,10 @@ def _get_observed_date(self, dt: date, rule: ObservedRule) -> date: return dt def _add_observed( - self, dt: DateArg, name: Optional[str] = None, rule: Optional[ObservedRule] = None + self, + dt: DateArg, + name: Optional[str] = None, + rule: Optional[ObservedRule] = None, ) -> Tuple[bool, date]: dt = dt if isinstance(dt, date) else date(self._year, *dt) diff --git a/holidays/registry.py b/holidays/registry.py index 1cb877edb..314d78565 100644 --- a/holidays/registry.py +++ b/holidays/registry.py @@ -154,7 +154,12 @@ "UMI", "HolidaysUM", ), - "united_states_virgin_islands": ("UnitedStatesVirginIslands", "VI", "VIR", "HolidaysVI"), + "united_states_virgin_islands": ( + "UnitedStatesVirginIslands", + "VI", + "VIR", + "HolidaysVI", + ), "united_states": ("UnitedStates", "US", "USA"), "uruguay": ("Uruguay", "UY", "URY"), "uzbekistan": ("Uzbekistan", "UZ", "UZB"), diff --git a/holidays/utils.py b/holidays/utils.py index 4970d3dc8..8c2f67d66 100755 --- a/holidays/utils.py +++ b/holidays/utils.py @@ -276,7 +276,8 @@ def CountryHoliday( """ warnings.warn( - "CountryHoliday is deprecated, use country_holidays instead.", DeprecationWarning + "CountryHoliday is deprecated, use country_holidays instead.", + DeprecationWarning, ) return country_holidays(country, subdiv, years, expand, observed, prov, state) diff --git a/pyproject.toml b/pyproject.toml index 769fdbb78..207958ff7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,10 +34,6 @@ Documentation = "https://python-holidays.readthedocs.io/en/latest/" Changelog = "https://github.com/vacanza/python-holidays/releases" Downloads = "https://pypi.org/project/holidays/" -[tool.black] -line-length = 99 -target-version = ["py38", "py39", "py310", "py311"] - [tool.coverage.run] branch = true omit = ["scripts/*", "setup.py", "tests/*"] @@ -50,10 +46,23 @@ no_inline_sort = true profile = "black" skip = ["docs"] - [tool.mypy] strict = false +[tool.ruff] +extend-exclude = ["docs"] +line-length = 99 +target-version = "py311" + +[tool.ruff.extend-per-file-ignores] +"scripts/generate_release_notes.py" = ["T201"] + +[tool.ruff.lint] +select = ["E4", "E7", "E9", "F", "T"] + +[tool.ruff.lint.flake8-errmsg] +max-string-length = 99 + [[tool.mypy.overrides]] module = "holidays.countries.*" disable_error_code = ["override"] @@ -67,7 +76,7 @@ ignore_directives = ["automodule", "autosummary"] ignore_languages = ["python"] [tool.setuptools.dynamic] -version = {attr = "holidays.__version__"} +version = { attr = "holidays.__version__" } [tool.setuptools.packages.find] include = ["holidays*"] diff --git a/requirements/dev.txt b/requirements/dev.txt index a00b820bb..7af095b2f 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,5 +1,6 @@ # Test environments. pre-commit +ruff tox # Localization. diff --git a/scripts/generate_release_notes.py b/scripts/generate_release_notes.py index d163be59e..8e21b6e1c 100755 --- a/scripts/generate_release_notes.py +++ b/scripts/generate_release_notes.py @@ -11,8 +11,6 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) -# flake8: noqa: T201 - import argparse import re import sys @@ -25,7 +23,7 @@ from github.GithubException import UnknownObjectException sys.path.append(f"{Path.cwd()}") -import holidays +import holidays # noqa: E402 BRANCH_NAME = "beta" HEADER_TEMPLATE = """ diff --git a/scripts/generate_snapshots.py b/scripts/generate_snapshots.py index 23c950d37..841b7f8ad 100755 --- a/scripts/generate_snapshots.py +++ b/scripts/generate_snapshots.py @@ -11,8 +11,6 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) -# flake8: noqa: F402 - import argparse import json import sys @@ -21,8 +19,8 @@ sys.path.append(f"{Path.cwd()}") # Make holidays visible. -import holidays -from holidays import list_supported_countries, list_supported_financial +import holidays # noqa: E402 +from holidays import list_supported_countries, list_supported_financial # noqa: E402 class SnapshotGenerator: diff --git a/tests/countries/test_argentina.py b/tests/countries/test_argentina.py index c304abb9f..54b016a8c 100644 --- a/tests/countries/test_argentina.py +++ b/tests/countries/test_argentina.py @@ -104,7 +104,8 @@ def test_sovereignty_over_malvinas_day(self): def test_guemes_day(self): self.assertNonObservedHoliday(f"{year}-06-17" for year in range(2016, 2050)) self.assertNoHolidayName( - "Paso a la Inmortalidad del General Don Martín Miguel de Güemes", range(1950, 2016) + "Paso a la Inmortalidad del General Don Martín Miguel de Güemes", + range(1950, 2016), ) self.assertHoliday( "2016-06-17", @@ -140,7 +141,8 @@ def test_independence_day(self): def test_san_martin_day(self): self.assertNoHolidayName( - "Paso a la Inmortalidad del General Don José de San Martin", Argentina(years=1937) + "Paso a la Inmortalidad del General Don José de San Martin", + Argentina(years=1937), ) self.assertNonObservedHoliday(f"{year}-08-17" for year in range(1938, 1995)) self.assertHoliday( @@ -211,7 +213,10 @@ def test_2022(self): ("2022-05-01", "Día del Trabajo"), ("2022-05-18", "Censo nacional 2022"), ("2022-05-25", "Día de la Revolución de Mayo"), - ("2022-06-17", "Paso a la Inmortalidad del General Don Martín Miguel de Güemes"), + ( + "2022-06-17", + "Paso a la Inmortalidad del General Don Martín Miguel de Güemes", + ), ("2022-06-20", "Paso a la Inmortalidad del General Don Manuel Belgrano"), ("2022-07-09", "Día de la Independencia"), ( @@ -239,7 +244,10 @@ def test_2023(self): ("2023-05-01", "Día del Trabajo"), ("2023-05-25", "Día de la Revolución de Mayo"), ("2023-05-26", "Feriado con fines turísticos"), - ("2023-06-17", "Paso a la Inmortalidad del General Don Martín Miguel de Güemes"), + ( + "2023-06-17", + "Paso a la Inmortalidad del General Don Martín Miguel de Güemes", + ), ("2023-06-19", "Feriado con fines turísticos"), ("2023-06-20", "Paso a la Inmortalidad del General Don Manuel Belgrano"), ("2023-07-09", "Día de la Independencia"), @@ -266,7 +274,10 @@ def test_2024(self): ("2024-04-02", "Día del Veterano y de los Caidos en la Guerra de Malvinas"), ("2024-05-01", "Día del Trabajo"), ("2024-05-25", "Día de la Revolución de Mayo"), - ("2024-06-17", "Paso a la Inmortalidad del General Don Martín Miguel de Güemes"), + ( + "2024-06-17", + "Paso a la Inmortalidad del General Don Martín Miguel de Güemes", + ), ("2024-06-20", "Paso a la Inmortalidad del General Don Manuel Belgrano"), ("2024-06-21", "Feriado con fines turísticos"), ("2024-07-09", "Día de la Independencia"), @@ -289,7 +300,10 @@ def test_l10n_default(self): ("2022-05-01", "Día del Trabajo"), ("2022-05-18", "Censo nacional 2022"), ("2022-05-25", "Día de la Revolución de Mayo"), - ("2022-06-17", "Paso a la Inmortalidad del General Don Martín Miguel de Güemes"), + ( + "2022-06-17", + "Paso a la Inmortalidad del General Don Martín Miguel de Güemes", + ), ("2022-06-20", "Paso a la Inmortalidad del General Don Manuel Belgrano"), ("2022-07-09", "Día de la Independencia"), ( @@ -317,10 +331,16 @@ def test_l10n_en_us(self): ("2022-05-01", "Labor Day"), ("2022-05-18", "National Census Day 2022"), ("2022-05-25", "May Revolution Day"), - ("2022-06-17", "Pass to the Immortality of General Don Martín Miguel de Güemes"), + ( + "2022-06-17", + "Pass to the Immortality of General Don Martín Miguel de Güemes", + ), ("2022-06-20", "Pass to the Immortality of General Don Manuel Belgrano"), ("2022-07-09", "Independence Day"), - ("2022-08-15", "Pass to the Immortality of General Don José de San Martin (observed)"), + ( + "2022-08-15", + "Pass to the Immortality of General Don José de San Martin (observed)", + ), ("2022-10-07", "Bridge Public Holiday"), ("2022-10-10", "Respect for Cultural Diversity Day (observed)"), ("2022-11-20", "National Sovereignty Day"), diff --git a/tests/countries/test_australia.py b/tests/countries/test_australia.py index 845cfc62a..f131aab48 100644 --- a/tests/countries/test_australia.py +++ b/tests/countries/test_australia.py @@ -45,7 +45,9 @@ def test_new_years(self): for subdiv in Australia.subdivisions: self.assertHolidayName( - name, self.subdiv_holidays[subdiv], (f"{year}-01-01" for year in range(1900, 2050)) + name, + self.subdiv_holidays[subdiv], + (f"{year}-01-01" for year in range(1900, 2050)), ) self.assertHolidayName(f"{name} (observed)", self.subdiv_holidays[subdiv], obs_dt) self.assertNoNonObservedHoliday(Australia(subdiv=subdiv, observed=False), obs_dt) @@ -133,10 +135,14 @@ def test_australia_day(self): ) self.assertNoHolidayName(name_2, self.subdiv_holidays[subdiv], range(1900, 1935)) self.assertHolidayName( - name_1, self.subdiv_holidays["NSW"], (f"{year}-01-26" for year in range(1935, 1946)) + name_1, + self.subdiv_holidays["NSW"], + (f"{year}-01-26" for year in range(1935, 1946)), ) self.assertHolidayName( - name_2, self.subdiv_holidays["NSW"], (f"{year}-01-26" for year in range(1946, 2050)) + name_2, + self.subdiv_holidays["NSW"], + (f"{year}-01-26" for year in range(1946, 2050)), ) self.assertHolidayName(name_1, (f"{year}-01-26" for year in range(1900, 1935))) @@ -168,7 +174,9 @@ def test_anzac_day(self): self.assertNoHolidayName(name, range(1900, 1921)) for subdiv in Australia.subdivisions: self.assertHolidayName( - name, self.subdiv_holidays[subdiv], (f"{year}-04-25" for year in range(1921, 2050)) + name, + self.subdiv_holidays[subdiv], + (f"{year}-04-25" for year in range(1921, 2050)), ) self.assertNoHolidayName(name, self.subdiv_holidays[subdiv], range(1900, 1921)) @@ -200,7 +208,9 @@ def test_christmas_day(self): for subdiv in Australia.subdivisions: self.assertHolidayName( - name, self.subdiv_holidays[subdiv], (f"{year}-12-25" for year in range(1900, 2050)) + name, + self.subdiv_holidays[subdiv], + (f"{year}-12-25" for year in range(1900, 2050)), ) self.assertHolidayName(f"{name} (observed)", self.subdiv_holidays[subdiv], obs_dt) self.assertNoNonObservedHoliday(Australia(subdiv=subdiv, observed=False), obs_dt) @@ -223,7 +233,9 @@ def test_boxing_day(self): for subdiv in Australia.subdivisions: name = name_sa if subdiv == "SA" else name_common self.assertHolidayName( - name, self.subdiv_holidays[subdiv], (f"{year}-12-26" for year in range(1900, 2050)) + name, + self.subdiv_holidays[subdiv], + (f"{year}-12-26" for year in range(1900, 2050)), ) self.assertHolidayName(f"{name} (observed)", self.subdiv_holidays[subdiv], obs_dt) self.assertNoNonObservedHoliday(Australia(subdiv=subdiv, observed=False), obs_dt) @@ -347,7 +359,9 @@ def test_sovereigns_birthday(self): def test_canberra_day(self): name = "Canberra Day" self.assertHolidayName( - name, self.subdiv_holidays["ACT"], (f"{year}-03-12" for year in range(1913, 1958)) + name, + self.subdiv_holidays["ACT"], + (f"{year}-03-12" for year in range(1913, 1958)), ) dt = ( "1958-03-17", diff --git a/tests/countries/test_azerbaijan.py b/tests/countries/test_azerbaijan.py index 297d2fdd6..2510fafd4 100644 --- a/tests/countries/test_azerbaijan.py +++ b/tests/countries/test_azerbaijan.py @@ -81,7 +81,8 @@ def test_spring_festival(self): def test_victory_over_fascism_day(self): self.assertHolidayName( - "Faşizm üzərində qələbə günü", (f"{year}-05-09" for year in range(1990, 2050)) + "Faşizm üzərində qələbə günü", + (f"{year}-05-09" for year in range(1990, 2050)), ) def test_republic_day(self): @@ -295,7 +296,10 @@ def test_2022(self): ("2022-05-30", "Müstəqillik Günü (müşahidə olunur)"), ("2022-06-15", "Azərbaycan xalqının milli qurtuluş günü"), ("2022-06-26", "Azərbaycan Respublikasının Silahlı Qüvvələri günü"), - ("2022-06-27", "Azərbaycan Respublikasının Silahlı Qüvvələri günü (müşahidə olunur)"), + ( + "2022-06-27", + "Azərbaycan Respublikasının Silahlı Qüvvələri günü (müşahidə olunur)", + ), ("2022-07-09", "Qurban bayrami"), ("2022-07-10", "Qurban bayrami"), ("2022-07-11", "Qurban bayrami (müşahidə olunur)"), @@ -319,7 +323,10 @@ def test_l10n_default(self): self.assertLocalizedHolidays( ("2023-01-01", "Yeni il bayramı"), ("2023-01-02", "Yeni il bayramı"), - ("2023-01-03", "Dünya azərbaycanlılarının həmrəyliyi günü (müşahidə olunur)"), + ( + "2023-01-03", + "Dünya azərbaycanlılarının həmrəyliyi günü (müşahidə olunur)", + ), ("2023-01-04", "Yeni il bayramı (müşahidə olunur)"), ("2023-01-20", "Ümumxalq hüzn günü"), ("2023-03-08", "Qadınlar günü"), diff --git a/tests/countries/test_belize.py b/tests/countries/test_belize.py index 74796cf23..6abffa680 100644 --- a/tests/countries/test_belize.py +++ b/tests/countries/test_belize.py @@ -30,7 +30,8 @@ def test_new_years_day(self): name = "New Year's Day" years_observed = {1984, 1989, 1995, 2006, 2012, 2017, 2023, 2034, 2040, 2045} self.assertHolidayName( - name, (f"{year}-01-01" for year in set(range(1982, 2050)).difference(years_observed)) + name, + (f"{year}-01-01" for year in set(range(1982, 2050)).difference(years_observed)), ) self.assertHolidayName(f"{name} (observed)", (f"{year}-01-02" for year in years_observed)) @@ -38,7 +39,8 @@ def test_george_price_day(self): name = "George Price Day" years_observed = {2023, 2034, 2040, 2045} self.assertHolidayName( - name, (f"{year}-01-15" for year in set(range(2021, 2050)).difference(years_observed)) + name, + (f"{year}-01-15" for year in set(range(2021, 2050)).difference(years_observed)), ) self.assertHolidayName(f"{name} (observed)", (f"{year}-01-16" for year in years_observed)) self.assertNoHoliday(f"{year}-01-15" for year in range(1982, 2021)) @@ -93,7 +95,8 @@ def test_labour_day(self): name = "Labour Day" years_observed = {1983, 1988, 1994, 2005, 2011, 2016, 2022, 2033, 2039, 2044} self.assertHolidayName( - name, (f"{year}-05-01" for year in set(range(1982, 2050)).difference(years_observed)) + name, + (f"{year}-05-01" for year in set(range(1982, 2050)).difference(years_observed)), ) self.assertHolidayName(f"{name} (observed)", (f"{year}-05-02" for year in years_observed)) @@ -129,7 +132,8 @@ def test_saint_georges_caye_day(self): name = "Saint George's Caye Day" years_observed = {1989, 1995, 2000, 2006, 2017, 2023, 2028, 2034, 2045} self.assertHolidayName( - name, (f"{year}-09-10" for year in set(range(1982, 2050)).difference(years_observed)) + name, + (f"{year}-09-10" for year in set(range(1982, 2050)).difference(years_observed)), ) self.assertHolidayName(f"{name} (observed)", (f"{year}-09-11" for year in years_observed)) @@ -137,7 +141,8 @@ def test_independence_day(self): name = "Independence Day" years_observed = {1986, 1997, 2003, 2008, 2014, 2025, 2031, 2036, 2042} self.assertHolidayName( - name, (f"{year}-09-21" for year in set(range(1982, 2050)).difference(years_observed)) + name, + (f"{year}-09-21" for year in set(range(1982, 2050)).difference(years_observed)), ) self.assertHolidayName(f"{name} (observed)", (f"{year}-09-22" for year in years_observed)) @@ -170,7 +175,8 @@ def test_garifuna_settlement_day(self): name = "Garifuna Settlement Day" years_observed = {1989, 1995, 2000, 2006, 2017, 2023, 2028, 2034, 2045} self.assertHolidayName( - name, (f"{year}-11-19" for year in set(range(1982, 2050)).difference(years_observed)) + name, + (f"{year}-11-19" for year in set(range(1982, 2050)).difference(years_observed)), ) self.assertHolidayName(f"{name} (observed)", (f"{year}-11-20" for year in years_observed)) @@ -181,7 +187,8 @@ def test_boxing_day(self): name = "Boxing Day" years_observed = {1982, 1993, 1999, 2004, 2010, 2021, 2027, 2032, 2038, 2049} self.assertHolidayName( - name, (f"{year}-12-26" for year in set(range(1982, 2050)).difference(years_observed)) + name, + (f"{year}-12-26" for year in set(range(1982, 2050)).difference(years_observed)), ) self.assertHolidayName(f"{name} (observed)", (f"{year}-12-27" for year in years_observed)) diff --git a/tests/countries/test_bolivia.py b/tests/countries/test_bolivia.py index 5e6c0fc7a..282c00c77 100644 --- a/tests/countries/test_bolivia.py +++ b/tests/countries/test_bolivia.py @@ -269,7 +269,10 @@ def test_l10n_default(self): ("2023-01-01", "Año Nuevo"), ("2023-01-02", "Año Nuevo (observado)"), ("2023-01-22", "Día de la Creación del Estado Plurinacional de Bolivia"), - ("2023-01-23", "Día de la Creación del Estado Plurinacional de Bolivia (observado)"), + ( + "2023-01-23", + "Día de la Creación del Estado Plurinacional de Bolivia (observado)", + ), ("2023-02-20", "Carnaval"), ("2023-02-21", "Carnaval"), ("2023-04-07", "Viernes Santo"), @@ -309,7 +312,10 @@ def test_l10n_uk(self): ("2023-01-01", "Новий рік"), ("2023-01-02", "Новий рік (вихідний)"), ("2023-01-22", "День створення Багатонаціональної Держави Болівія"), - ("2023-01-23", "День створення Багатонаціональної Держави Болівія (вихідний)"), + ( + "2023-01-23", + "День створення Багатонаціональної Держави Болівія (вихідний)", + ), ("2023-02-20", "Карнавал"), ("2023-02-21", "Карнавал"), ("2023-04-07", "Страсна пʼятниця"), diff --git a/tests/countries/test_bosnia_and_herzegovina.py b/tests/countries/test_bosnia_and_herzegovina.py index 4f778161b..9b40dc5ee 100644 --- a/tests/countries/test_bosnia_and_herzegovina.py +++ b/tests/countries/test_bosnia_and_herzegovina.py @@ -469,7 +469,10 @@ def test_2021(self): ("2021-05-14", "Ramazanski Bajram"), ("2021-07-20", "Kurban Bajram"), ("2021-07-21", "Kurban Bajram"), - ("2021-11-21", "Dan uspostave Opšteg okvirnog sporazuma za mir u Bosni i Hercegovini"), + ( + "2021-11-21", + "Dan uspostave Opšteg okvirnog sporazuma za mir u Bosni i Hercegovini", + ), ("2021-12-24", "Badnji dan (Katolički)"), ("2021-12-25", "Božić (Katolički)"), ) diff --git a/tests/countries/test_bulgaria.py b/tests/countries/test_bulgaria.py index 5ef3cd1ce..70fcb350a 100644 --- a/tests/countries/test_bulgaria.py +++ b/tests/countries/test_bulgaria.py @@ -226,9 +226,15 @@ def test_l10n_en_us(self): ("2022-04-24", "Easter"), ("2022-04-25", "Easter"), ("2022-05-01", "Labor Day and International Workers' Solidarity Day"), - ("2022-05-02", "Labor Day and International Workers' Solidarity Day (observed)"), + ( + "2022-05-02", + "Labor Day and International Workers' Solidarity Day (observed)", + ), ("2022-05-06", "St. George's Day (Day of the Bulgarian Army)"), - ("2022-05-24", "Day of Slavonic Alphabet, Bulgarian Enlightenment and Culture"), + ( + "2022-05-24", + "Day of Slavonic Alphabet, Bulgarian Enlightenment and Culture", + ), ("2022-09-06", "Unification Day"), ("2022-09-22", "Independence Day"), ("2022-11-01", "The Day of the People's Awakeners"), @@ -250,8 +256,14 @@ def test_l10n_uk(self): ("2022-04-24", "Великдень"), ("2022-04-25", "Великдень"), ("2022-05-01", "День праці та міжнародної солідарності трудящих"), - ("2022-05-02", "День праці та міжнародної солідарності трудящих (вихідний)"), - ("2022-05-06", "День Святого Георгія та День хоробрості і болгарської армії"), + ( + "2022-05-02", + "День праці та міжнародної солідарності трудящих (вихідний)", + ), + ( + "2022-05-06", + "День Святого Георгія та День хоробрості і болгарської армії", + ), ( "2022-05-24", "День святих братів Кирила і Мефодія, болгарської писемності, " diff --git a/tests/countries/test_burundi.py b/tests/countries/test_burundi.py index 9d03451aa..e3bde38a6 100644 --- a/tests/countries/test_burundi.py +++ b/tests/countries/test_burundi.py @@ -74,7 +74,8 @@ def test_assumption_Day(self): def test_rwagasore_day(self): self.assertHolidayName( - "Prince Louis Rwagasore Day", (f"{year}-10-13" for year in range(1962, 2050)) + "Prince Louis Rwagasore Day", + (f"{year}-10-13" for year in range(1962, 2050)), ) def test_ndadaye_day(self): diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py index 3d23030db..e7de52434 100644 --- a/tests/countries/test_cambodia.py +++ b/tests/countries/test_cambodia.py @@ -52,19 +52,13 @@ def test_2022(self): ("2022-05-01", "ទិវាពលកម្មអន្តរជាតិ"), ( "2022-05-14", - ( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " - "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" - ), + ("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី"), ), ("2022-05-15", "ពិធីបុណ្យវិសាខបូជា"), ("2022-05-19", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), ( "2022-06-18", - ( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " - "ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ" - ), + ("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ"), ), ("2022-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ; ពិធីបុណ្យភ្ផុំបិណ្ឌ"), ("2022-09-25", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), @@ -107,17 +101,11 @@ def test_2023(self): ("2023-05-08", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), ( "2023-05-14", - ( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " - "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" - ), + ("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី"), ), ( "2023-06-18", - ( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " - "ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ" - ), + ("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ"), ), ("2023-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ"), ("2023-10-13", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), @@ -176,10 +164,7 @@ def test_international_children_day(self): self.assertNoHolidayName(name, 2020) def test_queen_mother_monineath_birthday(self): - name = ( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " - "ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ" - ) + name = "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ" self.assertNoHolidayName(name, 1993) self.assertHolidayName(name, (f"{year}-06-18" for year in range(1994, 2058))) @@ -212,9 +197,7 @@ def test_king_sihamoni_coronation_day(self): self.assertHolidayName(name, (f"{year}-10-29" for year in range(2004, 2058))) def test_national_independence_day(self): - self.assertHolidayName( - "ពិធីបុណ្យឯករាជ្យជាតិ", (f"{year}-11-09" for year in range(1993, 2058)) - ) + self.assertHolidayName("ពិធីបុណ្យឯករាជ្យជាតិ", (f"{year}-11-09" for year in range(1993, 2058))) def test_international_human_rights_day(self): name = "ទិវាសិទ្ធិមនុស្សអន្តរជាតិ" @@ -347,17 +330,11 @@ def test_l10n_default(self): ("2023-05-08", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), ( "2023-05-14", - ( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា " - "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" - ), + ("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី"), ), ( "2023-06-18", - ( - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី " - "ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ" - ), + ("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ"), ), ("2023-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ"), ("2023-10-13", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), diff --git a/tests/countries/test_canada.py b/tests/countries/test_canada.py index 35c4897a3..d7c11360f 100644 --- a/tests/countries/test_canada.py +++ b/tests/countries/test_canada.py @@ -252,7 +252,9 @@ def test_national_day_for_truth_and_reconciliation(self): for prov, holidays in self.prov_hols.items(): if prov in {"BC", "NT", "NU", "PE", "YT"}: self.assertHolidayName( - name, holidays, (f"{year}-09-30" for year in range(start_years[prov], 2050)) + name, + holidays, + (f"{year}-09-30" for year in range(start_years[prov], 2050)), ) self.assertNoHolidayName(name, holidays, range(1867, start_years[prov])) else: @@ -322,7 +324,9 @@ def test_remembrance_day(self): if prov in {"AB", "BC", "NB", "NL", "NS", "NT", "NU", "PE", "SK", "YT"}: start_year = 1981 if prov == "NS" else 1931 self.assertHolidayName( - name, holidays, (f"{year}-11-11" for year in range(start_year, 2050)) + name, + holidays, + (f"{year}-11-11" for year in range(start_year, 2050)), ) self.assertNoHoliday( holidays, (f"{year}-11-11" for year in range(1900, start_year)) diff --git a/tests/countries/test_chile.py b/tests/countries/test_chile.py index 03612cc71..e913324f7 100644 --- a/tests/countries/test_chile.py +++ b/tests/countries/test_chile.py @@ -195,7 +195,8 @@ def test_national_unity(self): ) self.assertNoHolidayName( - "Día de la Unidad Nacional", set(range(1915, 2050)).difference({1999, 2000, 2001}) + "Día de la Unidad Nacional", + set(range(1915, 2050)).difference({1999, 2000, 2001}), ) def test_independence_holidays(self): diff --git a/tests/countries/test_costa_rica.py b/tests/countries/test_costa_rica.py index d27d1e481..340350a5a 100644 --- a/tests/countries/test_costa_rica.py +++ b/tests/countries/test_costa_rica.py @@ -257,7 +257,10 @@ def test_optional_2022(self): self.assertHolidays( CostaRica(categories=OPTIONAL, years=2022), ("2022-08-02", "Fiesta de Nuestra Señora de los Ángeles"), - ("2022-09-04", "Día de la Persona Negra y la Cultura Afrocostarricense (observado)"), + ( + "2022-09-04", + "Día de la Persona Negra y la Cultura Afrocostarricense (observado)", + ), ("2022-12-05", "Día de la Abolición del Ejército (observado)"), ) @@ -279,7 +282,10 @@ def test_optional_2023(self): self.assertHolidays( CostaRica(categories=OPTIONAL, years=2023), ("2023-08-02", "Fiesta de Nuestra Señora de los Ángeles"), - ("2023-09-03", "Día de la Persona Negra y la Cultura Afrocostarricense (observado)"), + ( + "2023-09-03", + "Día de la Persona Negra y la Cultura Afrocostarricense (observado)", + ), ("2023-12-01", "Día de la Abolición del Ejército"), ) @@ -293,7 +299,10 @@ def test_l10n_default(self): ("2022-07-25", "Anexión del Partido de Nicoya a Costa Rica"), ("2022-08-02", "Fiesta de Nuestra Señora de los Ángeles"), ("2022-08-15", "Día de la Madre"), - ("2022-09-04", "Día de la Persona Negra y la Cultura Afrocostarricense (observado)"), + ( + "2022-09-04", + "Día de la Persona Negra y la Cultura Afrocostarricense (observado)", + ), ("2022-09-19", "Día de la Independencia (observado)"), ("2022-12-05", "Día de la Abolición del Ejército (observado)"), ("2022-12-25", "Navidad"), @@ -310,7 +319,10 @@ def test_l10n_en_us(self): ("2022-07-25", "Annexation of the Party of Nicoya to Costa Rica"), ("2022-08-02", "Feast of Our Lady of the Angels"), ("2022-08-15", "Mother's Day"), - ("2022-09-04", "Day of the Black Person and Afro-Costa Rican Culture (observed)"), + ( + "2022-09-04", + "Day of the Black Person and Afro-Costa Rican Culture (observed)", + ), ("2022-09-19", "Independence Day (observed)"), ("2022-12-05", "Army Abolition Day (observed)"), ("2022-12-25", "Christmas Day"), @@ -327,7 +339,10 @@ def test_l10n_uk(self): ("2022-07-25", "День приєднання Нікої"), ("2022-08-02", "Свято Богоматері Ангелів"), ("2022-08-15", "День матері"), - ("2022-09-04", "День чорношкірої людини та афро-костариканської культури (вихідний)"), + ( + "2022-09-04", + "День чорношкірої людини та афро-костариканської культури (вихідний)", + ), ("2022-09-19", "День незалежності (вихідний)"), ("2022-12-05", "День ліквідації армії (вихідний)"), ("2022-12-25", "Різдво Христове"), diff --git a/tests/countries/test_croatia.py b/tests/countries/test_croatia.py index bb9345c09..28f90a636 100644 --- a/tests/countries/test_croatia.py +++ b/tests/countries/test_croatia.py @@ -32,7 +32,8 @@ def test_new_years_day(self): def test_epiphany(self): name = "Bogojavljenje ili Sveta tri kralja" self.assertHolidayName( - name, (f"{year}-01-06" for year in set(range(1992, 2050)).difference({2002})) + name, + (f"{year}-01-06" for year in set(range(1992, 2050)).difference({2002})), ) self.assertNoHoliday("2002-01-06") self.assertNoHolidayName(name, 2002) @@ -131,7 +132,10 @@ def test_l10n_default(self): ("2022-05-30", "Dan državnosti"), ("2022-06-16", "Tijelovo"), ("2022-06-22", "Dan antifašističke borbe"), - ("2022-08-05", "Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja"), + ( + "2022-08-05", + "Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja", + ), ("2022-08-15", "Velika Gospa"), ("2022-11-01", "Svi sveti"), ( @@ -154,7 +158,10 @@ def test_l10n_en_us(self): ("2022-05-30", "Statehood Day"), ("2022-06-16", "Corpus Christi"), ("2022-06-22", "Anti-Fascist Struggle Day"), - ("2022-08-05", "Victory and Homeland Thanksgiving Day and Croatian Veterans Day"), + ( + "2022-08-05", + "Victory and Homeland Thanksgiving Day and Croatian Veterans Day", + ), ("2022-08-15", "Assumption Day"), ("2022-11-01", "All Saints' Day"), ("2022-11-18", "Remembrance Day"), @@ -173,10 +180,16 @@ def test_l10n_uk(self): ("2022-05-30", "День державності"), ("2022-06-16", "Свято Тіла і Крові Христових"), ("2022-06-22", "День антифашистської боротьби"), - ("2022-08-05", "День перемоги і подяки вітчизні та День хорватських захисників"), + ( + "2022-08-05", + "День перемоги і подяки вітчизні та День хорватських захисників", + ), ("2022-08-15", "Внебовзяття Пресвятої Діви Марії"), ("2022-11-01", "День усіх святих"), - ("2022-11-18", "День памʼяті жертв Вітчизняної війни та жертв Вуковара і Шкабрні"), + ( + "2022-11-18", + "День памʼяті жертв Вітчизняної війни та жертв Вуковара і Шкабрні", + ), ("2022-12-25", "Різдво Христове"), ("2022-12-26", "День Святого Стефана"), ) diff --git a/tests/countries/test_cuba.py b/tests/countries/test_cuba.py index 0b9d6e33c..ce34d32f8 100644 --- a/tests/countries/test_cuba.py +++ b/tests/countries/test_cuba.py @@ -33,7 +33,8 @@ def test_assault_moncada_day(self): def test_national_rebellion_day(self): self.assertHolidayName( - "Día de la Rebeldía Nacional", (f"{year}-07-26" for year in range(1959, 2050)) + "Día de la Rebeldía Nacional", + (f"{year}-07-26" for year in range(1959, 2050)), ) def test_independence_day(self): diff --git a/tests/countries/test_ecuador.py b/tests/countries/test_ecuador.py index 8937e15e6..092636903 100644 --- a/tests/countries/test_ecuador.py +++ b/tests/countries/test_ecuador.py @@ -70,12 +70,14 @@ def test_battle_of_pichincha(self): def test_independence_of_quito(self): self.assertHolidayName( - "Primer Grito de Independencia", (f"{year}-08-10" for year in range(2000, 2050)) + "Primer Grito de Independencia", + (f"{year}-08-10" for year in range(2000, 2050)), ) def test_independence_of_guayaquil(self): self.assertHolidayName( - "Independencia de Guayaquil", (f"{year}-10-09" for year in range(2000, 2050)) + "Independencia de Guayaquil", + (f"{year}-10-09" for year in range(2000, 2050)), ) def test_all_souls_day(self): @@ -154,7 +156,10 @@ def test_2022(self): ("2022-10-10", "Independencia de Guayaquil (observado)"), ("2022-11-02", "Día de los Difuntos"), ("2022-11-03", "Independencia de Cuenca"), - ("2022-11-04", "Día de los Difuntos (observado); Independencia de Cuenca (observado)"), + ( + "2022-11-04", + "Día de los Difuntos (observado); Independencia de Cuenca (observado)", + ), ("2022-12-25", "Día de Navidad"), ("2022-12-26", "Día de Navidad (observado)"), ) @@ -189,7 +194,10 @@ def test_l10n_default(self): ("2022-10-10", "Independencia de Guayaquil (observado)"), ("2022-11-02", "Día de los Difuntos"), ("2022-11-03", "Independencia de Cuenca"), - ("2022-11-04", "Día de los Difuntos (observado); Independencia de Cuenca (observado)"), + ( + "2022-11-04", + "Día de los Difuntos (observado); Independencia de Cuenca (observado)", + ), ("2022-12-25", "Día de Navidad"), ("2022-12-26", "Día de Navidad (observado)"), ) @@ -211,7 +219,10 @@ def test_l10n_en_us(self): ("2022-10-10", "Independence of Guayaquil (observed)"), ("2022-11-02", "All Souls' Day"), ("2022-11-03", "Independence of Cuenca"), - ("2022-11-04", "All Souls' Day (observed); Independence of Cuenca (observed)"), + ( + "2022-11-04", + "All Souls' Day (observed); Independence of Cuenca (observed)", + ), ("2022-12-25", "Christmas Day"), ("2022-12-26", "Christmas Day (observed)"), ) @@ -233,7 +244,10 @@ def test_l10n_uk(self): ("2022-10-10", "День незалежності Гуаякіля (вихідний)"), ("2022-11-02", "День усіх померлих"), ("2022-11-03", "День незалежності Куенки"), - ("2022-11-04", "День незалежності Куенки (вихідний); День усіх померлих (вихідний)"), + ( + "2022-11-04", + "День незалежності Куенки (вихідний); День усіх померлих (вихідний)", + ), ("2022-12-25", "Різдво Христове"), ("2022-12-26", "Різдво Христове (вихідний)"), ) diff --git a/tests/countries/test_germany.py b/tests/countries/test_germany.py index 2e9d61007..d78037420 100644 --- a/tests/countries/test_germany.py +++ b/tests/countries/test_germany.py @@ -102,11 +102,13 @@ def test_heilige_drei_koenige(self): for province in provinces_that_have: self.assertHoliday( - self.prov_hols[province], (f"{year}-01-06" for year in range(1991, 2050)) + self.prov_hols[province], + (f"{year}-01-06" for year in range(1991, 2050)), ) for province in provinces_that_dont: self.assertNoHoliday( - self.prov_hols[province], (f"{year}-01-06" for year in range(1991, 2050)) + self.prov_hols[province], + (f"{year}-01-06" for year in range(1991, 2050)), ) def test_karfreitag(self): @@ -210,12 +212,14 @@ def test_frauentag(self): for province in set(DE.subdivisions): self.assertNoHoliday( - self.prov_hols[province], (f"{year}-03-08" for year in range(1991, 2019)) + self.prov_hols[province], + (f"{year}-03-08" for year in range(1991, 2019)), ) self.assertNoHoliday(self.prov_hols["MV"], (f"{year}-03-08" for year in range(2019, 2023))) for province in set(DE.subdivisions) - {"BE", "MV"}: self.assertNoHoliday( - self.prov_hols[province], (f"{year}-03-08" for year in range(2023, 2050)) + self.prov_hols[province], + (f"{year}-03-08" for year in range(2023, 2050)), ) def test_pfingstsonntag(self): @@ -286,11 +290,13 @@ def test_mariae_himmelfahrt(self): for province in provinces_that_have: self.assertHoliday( - self.prov_hols[province], (f"{year}-08-15" for year in range(1991, 2050)) + self.prov_hols[province], + (f"{year}-08-15" for year in range(1991, 2050)), ) for province in provinces_that_dont: self.assertNoHoliday( - self.prov_hols[province], (f"{year}-08-15" for year in range(1991, 2050)) + self.prov_hols[province], + (f"{year}-08-15" for year in range(1991, 2050)), ) def test_reformationstag(self): @@ -301,22 +307,26 @@ def test_reformationstag(self): for province in prov_yes: self.assertHoliday( - self.prov_hols[province], (f"{year}-10-31" for year in range(1991, 2050)) + self.prov_hols[province], + (f"{year}-10-31" for year in range(1991, 2050)), ) for province in prov_yes_since_2018: self.assertHoliday( - self.prov_hols[province], (f"{year}-10-31" for year in range(2018, 2050)) + self.prov_hols[province], + (f"{year}-10-31" for year in range(2018, 2050)), ) for province in DE.subdivisions: self.assertHoliday(self.prov_hols[province], "2017-10-31") for province in prov_not: self.assertNoHoliday( - self.prov_hols[province], (f"{year}-10-31" for year in range(1991, 2017)) + self.prov_hols[province], + (f"{year}-10-31" for year in range(1991, 2017)), ) for province in prov_not_since_2018: self.assertNoHoliday( - self.prov_hols[province], (f"{year}-10-31" for year in range(2018, 2050)) + self.prov_hols[province], + (f"{year}-10-31" for year in range(2018, 2050)), ) def test_allerheiligen(self): @@ -325,11 +335,13 @@ def test_allerheiligen(self): for province in provinces_that_have: self.assertHoliday( - self.prov_hols[province], (f"{year}-11-01" for year in range(1991, 2050)) + self.prov_hols[province], + (f"{year}-11-01" for year in range(1991, 2050)), ) for province in provinces_that_dont: self.assertNoHoliday( - self.prov_hols[province], (f"{year}-11-01" for year in range(1991, 2050)) + self.prov_hols[province], + (f"{year}-11-01" for year in range(1991, 2050)), ) def test_buss_und_bettag(self): diff --git a/tests/countries/test_hongkong.py b/tests/countries/test_hongkong.py index 425fa642f..32ba0da0e 100644 --- a/tests/countries/test_hongkong.py +++ b/tests/countries/test_hongkong.py @@ -251,7 +251,8 @@ def test_labour_day(self): name = "Labour Day" name_following = f"The day following {name}" self.assertHolidayName( - name, (f"{year}-05-01" for year in set(range(1999, 2024)).difference(exception_years)) + name, + (f"{year}-05-01" for year in set(range(1999, 2024)).difference(exception_years)), ) self.assertHolidayName(name_following, (f"{year}-05-02" for year in exception_years)) self.assertNoHolidayName(name, 1998) @@ -286,7 +287,8 @@ def test_hksar_day(self): name = "Hong Kong Special Administrative Region Establishment Day" name_following = f"The day following {name}" self.assertHolidayName( - name, (f"{year}-07-01" for year in set(range(1997, 2024)).difference(exception_years)) + name, + (f"{year}-07-01" for year in set(range(1997, 2024)).difference(exception_years)), ) self.assertHolidayName(name_following, (f"{year}-07-02" for year in exception_years)) self.assertNoHolidayName(name, 1996) @@ -331,7 +333,8 @@ def test_national_day(self): name = "National Day" name_following = f"The day following {name}" self.assertHolidayName( - name, (f"{year}-10-01" for year in set(range(1997, 2024)).difference(exception_years)) + name, + (f"{year}-10-01" for year in set(range(1997, 2024)).difference(exception_years)), ) self.assertHolidayName(name, "1997-10-02", "1998-10-02") self.assertHolidayName(name_following, (f"{year}-10-02" for year in exception_years)) @@ -369,14 +372,16 @@ def test_christmas_day(self): exception_years = {2011, 2016, 2022} name = "Christmas Day" self.assertHolidayName( - name, (f"{year}-12-25" for year in set(range(2006, 2024)).difference(exception_years)) + name, + (f"{year}-12-25" for year in set(range(2006, 2024)).difference(exception_years)), ) self.assertNoHolidayName(name, exception_years) exception_years = {2010, 2021} name = "The first weekday after Christmas Day" self.assertHolidayName( - name, (f"{year}-12-26" for year in set(range(2006, 2024)).difference(exception_years)) + name, + (f"{year}-12-26" for year in set(range(2006, 2024)).difference(exception_years)), ) self.assertHolidayName(name, (f"{year}-12-27" for year in exception_years)) diff --git a/tests/countries/test_hungary.py b/tests/countries/test_hungary.py index 4955b95b3..d99ad1225 100644 --- a/tests/countries/test_hungary.py +++ b/tests/countries/test_hungary.py @@ -30,7 +30,8 @@ def test_national_day_march(self): name = "Nemzeti ünnep" years_absent = set(range(1951, 1989)) self.assertHolidayName( - name, (f"{year}-03-15" for year in set(range(1945, 2050)).difference(years_absent)) + name, + (f"{year}-03-15" for year in set(range(1945, 2050)).difference(years_absent)), ) self.assertNoHoliday(f"{year}-03-15" for year in years_absent) self.assertNoHolidayName(name, years_absent) @@ -153,7 +154,8 @@ def test_christmas(self): name = "Karácsony másnapja" self.assertHolidayName( - name, (f"{year}-12-26" for year in set(range(1945, 2050)).difference({1955})) + name, + (f"{year}-12-26" for year in set(range(1945, 2050)).difference({1955})), ) self.assertNoHoliday("1955-12-26") self.assertNoHolidayName(name, 1955) diff --git a/tests/countries/test_italy.py b/tests/countries/test_italy.py index 5ba7ab262..9a115c461 100644 --- a/tests/countries/test_italy.py +++ b/tests/countries/test_italy.py @@ -185,7 +185,8 @@ def test_province_specific_days(self): def test_deprecated(self): self.assertEqual( - Italy(subdiv="Forlì", years=2022).keys(), Italy(subdiv="Forli", years=2022).keys() + Italy(subdiv="Forlì", years=2022).keys(), + Italy(subdiv="Forli", years=2022).keys(), ) def test_subdiv_deprecation(self): diff --git a/tests/countries/test_laos.py b/tests/countries/test_laos.py index 7cbcedf2f..f7716abb2 100644 --- a/tests/countries/test_laos.py +++ b/tests/countries/test_laos.py @@ -325,10 +325,7 @@ def test_2017_workday(self): ("2017-06-01", "ວັນປູກຕົ້ນໄມ້ແຫ່ງຊາດ"), ( "2017-07-13", - ( - "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ; " - "ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ" - ), + "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ; ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ", ), ("2017-07-20", "ວັນສ້າງຕັ້ງສະຫະພັນແມ່ຍິງລາວ"), ("2017-08-13", "ວັນສື່ມວນຊົນແຫ່ງຊາດ ແລະ ວັນພິມຈໍາໜ່າຍ"), @@ -348,10 +345,7 @@ def test_2022_workday(self): ("2022-06-01", "ວັນປູກຕົ້ນໄມ້ແຫ່ງຊາດ; ວັນເດັກສາກົນ"), ( "2022-07-13", - ( - "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ; " - "ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ" - ), + "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ; ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ", ), ("2022-07-20", "ວັນສ້າງຕັ້ງສະຫະພັນແມ່ຍິງລາວ"), ("2022-08-13", "ວັນສື່ມວນຊົນແຫ່ງຊາດ ແລະ ວັນພິມຈໍາໜ່າຍ"), @@ -413,7 +407,10 @@ def test_l10n_en_US(self): ("2022-02-16", "Makha Bousa Festival"), ("2022-03-08", "International Women's Rights Day"), ("2022-03-22", "Establishment Day of the Lao People's Revolutionary Party"), - ("2022-04-14", "Lao New Year's Day; Lao People's Revolutionary Youth Union Day"), + ( + "2022-04-14", + "Lao New Year's Day; Lao People's Revolutionary Youth Union Day", + ), ("2022-04-15", "Lao New Year's Day"), ("2022-04-16", "Lao New Year's Day"), ("2022-04-18", "Lao New Year's Day (in lieu)"), diff --git a/tests/countries/test_lithuania.py b/tests/countries/test_lithuania.py index 7eb51a8bc..6584b5ceb 100644 --- a/tests/countries/test_lithuania.py +++ b/tests/countries/test_lithuania.py @@ -33,7 +33,8 @@ def test_new_years(self): def test_restoration_of_state_day(self): self.assertHolidayName( - "Lietuvos valstybės atkūrimo diena", (f"{year}-02-16" for year in range(1990, 2050)) + "Lietuvos valstybės atkūrimo diena", + (f"{year}-02-16" for year in range(1990, 2050)), ) def test_restoration_of_independence_day(self): @@ -94,7 +95,7 @@ def test_dew_and_saint_john_day(self): self.assertNoHolidayName(name, range(1990, 2003)) def test_statehood_day(self): - name = "Valstybės (Lietuvos karaliaus Mindaugo karūnavimo) " "ir Tautiškos giesmės diena" + name = "Valstybės (Lietuvos karaliaus Mindaugo karūnavimo) ir Tautiškos giesmės diena" self.assertHolidayName(name, (f"{year}-07-06" for year in range(1991, 2050))) self.assertNoHoliday(f"{year}-07-06" for year in range(1990, 1991)) self.assertNoHolidayName(name, range(1990, 1991)) diff --git a/tests/countries/test_malaysia.py b/tests/countries/test_malaysia.py index cc9d16982..88c1234be 100644 --- a/tests/countries/test_malaysia.py +++ b/tests/countries/test_malaysia.py @@ -1324,6 +1324,9 @@ def test_2024(self): ("2024-08-31", "National Day"), ("2024-04-10", "Hari Raya Puasa"), ("2024-06-17", "Hari Raya Haji"), - ("2024-09-16", "Malaysia Day; Maulidur Rasul (Birthday of the Prophet Muhammad)"), + ( + "2024-09-16", + "Malaysia Day; Maulidur Rasul (Birthday of the Prophet Muhammad)", + ), ("2024-02-12", "Chinese New Year Holiday (in lieu)"), ) diff --git a/tests/countries/test_namibia.py b/tests/countries/test_namibia.py index 0a8d73dec..d60309a73 100644 --- a/tests/countries/test_namibia.py +++ b/tests/countries/test_namibia.py @@ -46,10 +46,12 @@ def test_holidays(self): f"{year}-12-26", ) self.assertNoHolidayName( - "Day of the Namibian Women and International Human Rights Day", range(1990, 2005) + "Day of the Namibian Women and International Human Rights Day", + range(1990, 2005), ) self.assertHolidayName( - "International Human Rights Day", (f"{year}-09-10" for year in range(1990, 2005)) + "International Human Rights Day", + (f"{year}-09-10" for year in range(1990, 2005)), ) def test_easter(self): diff --git a/tests/countries/test_papua_new_guinea.py b/tests/countries/test_papua_new_guinea.py index ec12db286..24502c0e9 100644 --- a/tests/countries/test_papua_new_guinea.py +++ b/tests/countries/test_papua_new_guinea.py @@ -19,7 +19,9 @@ class TestPapuaNewGuinea(CommonCountryTests, TestCase): @classmethod def setUpClass(cls): super().setUpClass( - PapuaNewGuinea, years=range(1953, 2050), years_non_observed=range(1953, 2050) + PapuaNewGuinea, + years=range(1953, 2050), + years_non_observed=range(1953, 2050), ) def test_country_aliases(self): diff --git a/tests/countries/test_paraguay.py b/tests/countries/test_paraguay.py index d9d352ffb..d7635993f 100644 --- a/tests/countries/test_paraguay.py +++ b/tests/countries/test_paraguay.py @@ -40,7 +40,8 @@ def test_patriots_day(self): name = "Día de los Héroes de la Patria" years_excluded = {2013, 2016, 2018, 2022} self.assertHolidayName( - name, (f"{year}-03-01" for year in set(range(1990, 2050)).difference(years_excluded)) + name, + (f"{year}-03-01" for year in set(range(1990, 2050)).difference(years_excluded)), ) self.assertNoHolidayName(name, (f"{year}-03-01" for year in years_excluded)) self.assertHolidayName( @@ -116,7 +117,8 @@ def test_chaco_armistice_day(self): name = "Día de la Paz del Chaco" years_excluded = {2014, 2018} self.assertHolidayName( - name, (f"{year}-06-12" for year in set(range(1990, 2050)).difference(years_excluded)) + name, + (f"{year}-06-12" for year in set(range(1990, 2050)).difference(years_excluded)), ) self.assertNoHolidayName(name, (f"{year}-06-12" for year in years_excluded)) self.assertHolidayName( @@ -136,7 +138,8 @@ def test_chaco_armistice_day(self): def test_asuncion_foundations_day(self): self.assertHolidayName( - "Día de la Fundación de Asunción", (f"{year}-08-15" for year in range(1990, 2050)) + "Día de la Fundación de Asunción", + (f"{year}-08-15" for year in range(1990, 2050)), ) self.assertNoNonObservedHoliday( "2004-08-15", @@ -151,7 +154,8 @@ def test_boqueron_battle_day(self): name = "Día de la Batalla de Boquerón" years_excluded = {2015, 2016, 2017, 2021, 2022} self.assertHolidayName( - name, (f"{year}-09-29" for year in set(range(2000, 2050)).difference(years_excluded)) + name, + (f"{year}-09-29" for year in set(range(2000, 2050)).difference(years_excluded)), ) self.assertNoHolidayName(name, (f"{year}-09-29" for year in years_excluded)) self.assertNoHolidayName(name, (f"{year}-09-29" for year in range(1990, 2000))) @@ -176,7 +180,8 @@ def test_boqueron_battle_day(self): def test_caacupe_virgin_day(self): self.assertHolidayName( - "Día de la Virgen de Caacupé", (f"{year}-12-08" for year in range(1990, 2050)) + "Día de la Virgen de Caacupé", + (f"{year}-12-08" for year in range(1990, 2050)), ) self.assertNoNonObservedHoliday( "2001-12-08", diff --git a/tests/countries/test_poland.py b/tests/countries/test_poland.py index db7d28b72..89fc2b21d 100644 --- a/tests/countries/test_poland.py +++ b/tests/countries/test_poland.py @@ -140,7 +140,9 @@ def test_narodowe_swieto_zwyciestwa_i_wolnosci(self): self.assertNoHoliday(f"{year}-05-09" for year in range(1925, 1946)) 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) + "Narodowe Święto Zwycięstwa i Wolności", + range(1925, 1946), + range(1951, 2050), ) def test_wniebowstapienie_panskie(self): diff --git a/tests/countries/test_russia.py b/tests/countries/test_russia.py index 27a10b566..39f79dcf3 100644 --- a/tests/countries/test_russia.py +++ b/tests/countries/test_russia.py @@ -69,7 +69,8 @@ def test_defender_of_fatherland_day(self): def test_international_womens_day(self): self.assertHolidayName( - "Международный женский день", (f"{year}-03-08" for year in range(1991, 2025)) + "Международный женский день", + (f"{year}-03-08" for year in range(1991, 2025)), ) def test_labor_day(self): diff --git a/tests/countries/test_slovakia.py b/tests/countries/test_slovakia.py index 5498bb96d..8d95e57e8 100644 --- a/tests/countries/test_slovakia.py +++ b/tests/countries/test_slovakia.py @@ -34,7 +34,8 @@ def test_special_holidays(self): def test_new_years_day(self): self.assertHolidayName( - "Deň vzniku Slovenskej republiky", (f"{year}-01-01" for year in range(1993, 2050)) + "Deň vzniku Slovenskej republiky", + (f"{year}-01-01" for year in range(1993, 2050)), ) def test_epiphany(self): @@ -86,7 +87,8 @@ def test_slovak_national_uprising(self): def test_constitution_day(self): self.assertHolidayName( - "Deň Ústavy Slovenskej republiky", (f"{year}-09-01" for year in range(1993, 2050)) + "Deň Ústavy Slovenskej republiky", + (f"{year}-09-01" for year in range(1993, 2050)), ) def test_day_of_our_lady_of_the_seven_sorrows(self): @@ -190,7 +192,10 @@ def test_l10n_en_us(self): ("2022-08-29", "Slovak National Uprising Anniversary"), ("2022-09-01", "Constitution Day"), ("2022-09-15", "Day of Our Lady of the Seven Sorrows"), - ("2022-10-28", "Day of the Establishment of the Independent Czech-Slovak State"), + ( + "2022-10-28", + "Day of the Establishment of the Independent Czech-Slovak State", + ), ("2022-11-01", "All Saints' Day"), ("2022-11-17", "Struggle for Freedom and Democracy Day"), ("2022-12-24", "Christmas Eve"), diff --git a/tests/countries/test_slovenia.py b/tests/countries/test_slovenia.py index e743364cc..03c4e13d9 100644 --- a/tests/countries/test_slovenia.py +++ b/tests/countries/test_slovenia.py @@ -54,7 +54,8 @@ def test_easter_monday(self): def test_uprising_against_occupation_day(self): self.assertHolidayName( - "dan upora proti okupatorju", (f"{year}-04-27" for year in range(1991, 2050)) + "dan upora proti okupatorju", + (f"{year}-04-27" for year in range(1991, 2050)), ) def test_labor_day(self): @@ -85,7 +86,8 @@ def test_christmas_day(self): def test_independence_and_unity_day(self): self.assertHolidayName( - "dan samostojnosti in enotnosti", (f"{year}-12-26" for year in range(1991, 2050)) + "dan samostojnosti in enotnosti", + (f"{year}-12-26" for year in range(1991, 2050)), ) def test_l10n_default(self): diff --git a/tests/countries/test_spain.py b/tests/countries/test_spain.py index 89d50a8ff..67541b125 100644 --- a/tests/countries/test_spain.py +++ b/tests/countries/test_spain.py @@ -239,7 +239,19 @@ def test_islamic(self): def test_variable_holidays_2010(self): province_days = { (MAR, 1): {"AN", "IB"}, - (MAR, 19): {"CL", "CM", "EX", "GA", "MC", "MD", "ML", "NC", "PV", "RI", "VC"}, + (MAR, 19): { + "CL", + "CM", + "EX", + "GA", + "MC", + "MD", + "ML", + "NC", + "PV", + "RI", + "VC", + }, (APR, 1): { "AN", "AR", @@ -318,7 +330,19 @@ def test_variable_holidays_2011(self): (SEP, 15): {"CB"}, (OCT, 25): {"PV"}, (NOV, 7): {"CE", "ML"}, - (DEC, 26): {"AN", "AR", "AS", "CE", "CL", "CN", "CT", "EX", "IB", "ML", "NC"}, + (DEC, 26): { + "AN", + "AR", + "AS", + "CE", + "CL", + "CN", + "CT", + "EX", + "IB", + "ML", + "NC", + }, } self._assertVariableDays(2011, province_days) @@ -509,7 +533,20 @@ def test_variable_holidays_2015(self): (SEP, 25): {"CE", "ML"}, (OCT, 9): {"VC"}, (NOV, 2): {"AN", "AR", "AS", "CB", "CE", "CL", "CN", "EX", "GA", "IB"}, - (DEC, 7): {"AN", "AR", "AS", "CE", "CL", "CM", "EX", "IB", "MC", "ML", "RI", "VC"}, + (DEC, 7): { + "AN", + "AR", + "AS", + "CE", + "CL", + "CM", + "EX", + "IB", + "MC", + "ML", + "RI", + "VC", + }, (DEC, 26): {"CT"}, } self._assertVariableDays(2015, province_days) @@ -666,7 +703,19 @@ def test_variable_holidays_2018(self): def test_variable_holidays_2019(self): province_days = { - (JAN, 7): {"AN", "AR", "AS", "CE", "CL", "CN", "EX", "MC", "MD", "ML", "NC"}, + (JAN, 7): { + "AN", + "AR", + "AS", + "CE", + "CL", + "CN", + "EX", + "MC", + "MD", + "ML", + "NC", + }, (FEB, 28): {"AN"}, (MAR, 1): {"IB"}, (MAR, 19): {"GA", "MC", "NC", "PV", "VC"}, diff --git a/tests/countries/test_switzerland.py b/tests/countries/test_switzerland.py index d3c52e4a3..3edc0bf6a 100644 --- a/tests/countries/test_switzerland.py +++ b/tests/countries/test_switzerland.py @@ -628,7 +628,19 @@ def test_saint_stephens_day(self): self.assertNoHolidayName(name, holidays) # When holiday present in NE. - ne_years_have = {1977, 1983, 1988, 1994, 2005, 2011, 2016, 2022, 2033, 2039, 2044} + ne_years_have = { + 1977, + 1983, + 1988, + 1994, + 2005, + 2011, + 2016, + 2022, + 2033, + 2039, + 2044, + } self.assertHolidayName( name, self.prov_hols["NE"], (f"{year}-12-26" for year in ne_years_have) ) diff --git a/tests/countries/test_thailand.py b/tests/countries/test_thailand.py index b835c7f65..260da96f8 100644 --- a/tests/countries/test_thailand.py +++ b/tests/countries/test_thailand.py @@ -116,7 +116,10 @@ def test_special_holidays(self): def test_2022_all(self): self.assertHolidays( - Thailand(categories=(ARMED_FORCES, GOVERNMENT, PUBLIC, SCHOOL, WORKDAY), years=2022), + Thailand( + categories=(ARMED_FORCES, GOVERNMENT, PUBLIC, SCHOOL, WORKDAY), + years=2022, + ), ("2022-01-01", "วันขึ้นปีใหม่"), ("2022-01-03", "ชดเชยวันขึ้นปีใหม่"), ("2022-01-08", "วันเด็กแห่งชาติ"), @@ -159,10 +162,7 @@ def test_2022_all(self): ("2022-09-28", "วันพระราชทานธงชาติไทย"), ( "2022-10-13", - ( - "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร " - "มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" - ), + "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร", ), ("2022-10-14", "วันหยุดพิเศษ (เพิ่มเติม)"), ("2022-10-23", "วันปิยมหาราช"), @@ -363,9 +363,7 @@ def test_national_mothers_day(self): def test_rama_ix_memorial_day(self): name_ix = "วันคล้ายวันสวรรคตพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" - name_x = ( - "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" - ) + name_x = "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" name_x_memorial = "วันนวมินทรมหาราช" self.assertNoHoliday("2016-10-13") @@ -403,12 +401,9 @@ def test_rama_five_memorial_day(self): def test_rama_ix_birthday(self): name_reign = "วันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" - name_dead = ( - "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" - ) + name_dead = "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช บรมนาถบพิตร" name_great = ( - "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระบรม" - "ชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" + "วันคล้ายวันเฉลิมพระชนมพรรษาพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" ) self.assertNoHoliday("1959-12-05") @@ -685,7 +680,8 @@ def test_raeknakhwan(self): def test_armed_forces_holiday(self): name = "วันกองทัพไทย" self.assertHolidays( - Thailand(categories=ARMED_FORCES, years=range(1958, 1960)), ("1959-04-08", name) + Thailand(categories=ARMED_FORCES, years=range(1958, 1960)), + ("1959-04-08", name), ) self.assertHolidays( Thailand(categories=ARMED_FORCES, years=range(1979, 1981)), @@ -863,10 +859,7 @@ def test_l10n_default(self): ("2022-09-28", "วันพระราชทานธงชาติไทย"), ( "2022-10-13", - ( - "วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร " - "มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร" - ), + ("วันคล้ายวันสวรรคตพระบาทสมเด็จพระบรมชนกาธิเบศร มหาภูมิพลอดุลยเดชมหาราช บรมนาถบพิตร"), ), ("2022-10-14", "วันหยุดพิเศษ (เพิ่มเติม)"), ("2022-10-23", "วันปิยมหาราช"), diff --git a/tests/countries/test_timor_leste.py b/tests/countries/test_timor_leste.py index ad21196fb..8baa330bf 100644 --- a/tests/countries/test_timor_leste.py +++ b/tests/countries/test_timor_leste.py @@ -522,7 +522,10 @@ def test_l10n_tet(self): ("2023-04-07", "Sesta-Feira Santa"), ("2023-04-22", "Idul-Fitri"), ("2023-05-01", "Loron Mundiál Serbisu-na'in sira nian"), - ("2023-05-18", "Loron Ascensão do Senhor Jesus Cristo hi'it An ba Lalehan nian"), + ( + "2023-05-18", + "Loron Ascensão do Senhor Jesus Cristo hi'it An ba Lalehan nian", + ), ("2023-05-20", "Loron Restaurasaun Independénsia nian"), ("2023-06-01", "Loron Mundial ba Labarik"), ("2023-06-08", "Festa Korpu de Deus"), diff --git a/tests/countries/test_tonga.py b/tests/countries/test_tonga.py index e64a6d0c9..be9ba6a69 100644 --- a/tests/countries/test_tonga.py +++ b/tests/countries/test_tonga.py @@ -138,9 +138,15 @@ def test_2017(self): ("2017-04-17", "Monite 'o e Toetu'u"), ("2017-04-25", "'Aho Anzac"), ("2017-06-05", "'Aho Tau'ataina (fakatokanga'i)"), - ("2017-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"), + ( + "2017-07-04", + "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule", + ), ("2017-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"), - ("2017-09-18", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga (fakatokanga'i)"), + ( + "2017-09-18", + "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga (fakatokanga'i)", + ), ("2017-11-06", "'Aho Konisitutone (fakatokanga'i)"), ("2017-11-29", "'Aho malolo 'akapulu 'a Tonga"), ( @@ -160,7 +166,10 @@ def test_2018(self): ("2018-04-02", "Monite 'o e Toetu'u"), ("2018-04-25", "'Aho Anzac"), ("2018-06-04", "'Aho Tau'ataina"), - ("2018-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"), + ( + "2018-07-04", + "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule", + ), ("2018-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"), ("2018-11-05", "'Aho Konisitutone (fakatokanga'i)"), ( @@ -183,7 +192,10 @@ def test_2019(self): ("2019-04-22", "Monite 'o e Toetu'u"), ("2019-04-25", "'Aho Anzac"), ("2019-06-03", "'Aho Tau'ataina (fakatokanga'i)"), - ("2019-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"), + ( + "2019-07-04", + "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule", + ), ("2019-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"), ("2019-09-19", "Me'afaka'eiki 'o e Siteiti 'Akilisi Pohiva"), ("2019-11-04", "'Aho Konisitutone"), @@ -208,7 +220,10 @@ def test_2020(self): ("2020-04-13", "Monite 'o e Toetu'u"), ("2020-04-25", "'Aho Anzac"), ("2020-06-08", "'Aho Tau'ataina (fakatokanga'i)"), - ("2020-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"), + ( + "2020-07-04", + "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule", + ), ("2020-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"), ("2020-11-02", "'Aho Konisitutone (fakatokanga'i)"), ( @@ -231,7 +246,10 @@ def test_2021(self): ("2021-04-05", "Monite 'o e Toetu'u"), ("2021-04-25", "'Aho Anzac"), ("2021-06-07", "'Aho Tau'ataina (fakatokanga'i)"), - ("2021-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"), + ( + "2021-07-04", + "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule", + ), ( "2021-07-05", ( @@ -262,7 +280,10 @@ def test_2022(self): ("2022-04-18", "Monite 'o e Toetu'u"), ("2022-04-25", "'Aho Anzac"), ("2022-06-06", "'Aho Tau'ataina (fakatokanga'i)"), - ("2022-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"), + ( + "2022-07-04", + "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule", + ), ("2022-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"), ("2022-11-07", "'Aho Konisitutone (fakatokanga'i)"), ( @@ -285,7 +306,10 @@ def test_2024(self): ("2024-04-01", "Monite 'o e Toetu'u"), ("2024-04-25", "'Aho Anzac"), ("2024-06-03", "'Aho Tau'ataina (fakatokanga'i)"), - ("2024-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"), + ( + "2024-07-04", + "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule", + ), ("2024-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"), ("2024-11-04", "'Aho Konisitutone"), ( @@ -307,9 +331,15 @@ def test_l10n_default(self): ("2023-04-10", "Monite 'o e Toetu'u"), ("2023-04-25", "'Aho Anzac"), ("2023-06-05", "'Aho Tau'ataina (fakatokanga'i)"), - ("2023-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"), + ( + "2023-07-04", + "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule", + ), ("2023-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"), - ("2023-09-18", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga (fakatokanga'i)"), + ( + "2023-09-18", + "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga (fakatokanga'i)", + ), ("2023-11-06", "'Aho Konisitutone (fakatokanga'i)"), ( "2023-12-04", diff --git a/tests/countries/test_ukraine.py b/tests/countries/test_ukraine.py index 5888bddbd..822553e27 100644 --- a/tests/countries/test_ukraine.py +++ b/tests/countries/test_ukraine.py @@ -421,7 +421,10 @@ def test_2021(self): ("2021-05-02", "Великдень (Пасха)"), ("2021-05-03", "День праці (вихідний)"), ("2021-05-04", "Великдень (Пасха) (вихідний)"), - ("2021-05-09", "День перемоги над нацизмом у Другій світовій війні (День перемоги)"), + ( + "2021-05-09", + "День перемоги над нацизмом у Другій світовій війні (День перемоги)", + ), ( "2021-05-10", "День перемоги над нацизмом у Другій світовій війні (День перемоги) (вихідний)", @@ -458,7 +461,10 @@ def test_l10n_default(self): ("2021-05-02", "Великдень (Пасха)"), ("2021-05-03", "День праці (вихідний)"), ("2021-05-04", "Великдень (Пасха) (вихідний)"), - ("2021-05-09", "День перемоги над нацизмом у Другій світовій війні (День перемоги)"), + ( + "2021-05-09", + "День перемоги над нацизмом у Другій світовій війні (День перемоги)", + ), ( "2021-05-10", "День перемоги над нацизмом у Другій світовій війні (День перемоги) (вихідний)", @@ -486,7 +492,10 @@ def test_l10n_en_us(self): ("2021-05-03", "Labor Day (observed)"), ("2021-05-04", "Easter Sunday (Pascha) (observed)"), ("2021-05-09", "Day of Victory over Nazism in World War II (Victory Day)"), - ("2021-05-10", "Day of Victory over Nazism in World War II (Victory Day) (observed)"), + ( + "2021-05-10", + "Day of Victory over Nazism in World War II (Victory Day) (observed)", + ), ("2021-06-20", "Holy Trinity Day"), ("2021-06-21", "Holy Trinity Day (observed)"), ("2021-06-28", "Day of the Constitution of Ukraine"), @@ -509,7 +518,10 @@ def test_l10n_ar(self): ("2021-05-02", "عيد الفصح"), ("2021-05-03", "(يوم عطلة) عيد العمال"), ("2021-05-04", "(يوم عطلة) عيد الفصح"), - ("2021-05-09", "يوم النصر على النازية في الحرب العالمية الثانية (يوم النصر)"), + ( + "2021-05-09", + "يوم النصر على النازية في الحرب العالمية الثانية (يوم النصر)", + ), ( "2021-05-10", "(يوم عطلة) يوم النصر على النازية في الحرب العالمية الثانية (يوم النصر)", diff --git a/tests/countries/test_united_kingdom.py b/tests/countries/test_united_kingdom.py index 2543f0f23..690cb261c 100644 --- a/tests/countries/test_united_kingdom.py +++ b/tests/countries/test_united_kingdom.py @@ -103,7 +103,9 @@ def test_new_year_scotland(self): ) self.assertHolidayName(f"{name_new_year} (observed)", holidays, ny_obs_dt) self.assertHolidayName( - name_new_year_holiday, holidays, (f"{year}-01-02" for year in range(1950, 2050)) + name_new_year_holiday, + holidays, + (f"{year}-01-02" for year in range(1950, 2050)), ) self.assertHolidayName(f"{name_new_year_holiday} (observed)", holidays, nyh_obs_dt) self.assertNoNonObservedHoliday( @@ -135,7 +137,9 @@ def test_st_patricks_day(self): ) for subdiv in ("NIR", "Northern Ireland"): self.assertHolidayName( - name, self.subdiv_holidays[subdiv], (f"{year}-03-17" for year in range(1950, 2050)) + name, + self.subdiv_holidays[subdiv], + (f"{year}-03-17" for year in range(1950, 2050)), ) self.assertHolidayName(f"{name} (observed)", self.subdiv_holidays[subdiv], obs_dt) self.assertNoNonObservedHoliday(UnitedKingdom(subdiv=subdiv, observed=False), obs_dt) @@ -143,7 +147,8 @@ def test_st_patricks_day(self): for subdiv in ("ENG", "SCT", "WLS", "England", "Scotland", "Wales"): self.assertNoHoliday( - self.subdiv_holidays[subdiv], (f"{year}-03-17" for year in range(1950, 2050)) + self.subdiv_holidays[subdiv], + (f"{year}-03-17" for year in range(1950, 2050)), ) self.assertNoHolidayName(name, self.subdiv_holidays[subdiv], range(1950, 2050)) self.assertNoHoliday(f"{year}-03-17" for year in range(1950, 2050)) @@ -234,14 +239,17 @@ def test_battle_of_the_boyne_day(self): ) for subdiv in ("NIR", "Northern Ireland"): self.assertHolidayName( - name, self.subdiv_holidays[subdiv], (f"{year}-07-12" for year in range(1950, 2050)) + name, + self.subdiv_holidays[subdiv], + (f"{year}-07-12" for year in range(1950, 2050)), ) self.assertHolidayName(f"{name} (observed)", self.subdiv_holidays[subdiv], obs_dt) self.assertNoNonObservedHoliday(UnitedKingdom(subdiv=subdiv, observed=False), obs_dt) for subdiv in ("ENG", "SCT", "WLS", "England", "Scotland", "Wales"): self.assertNoHoliday( - self.subdiv_holidays[subdiv], (f"{year}-07-12" for year in range(1950, 2050)) + self.subdiv_holidays[subdiv], + (f"{year}-07-12" for year in range(1950, 2050)), ) self.assertNoHolidayName(name, self.subdiv_holidays[subdiv], range(1950, 2050)) self.assertNoHoliday(f"{year}-07-12" for year in range(1950, 2050)) @@ -326,10 +334,13 @@ def test_st_andrews_day(self): ) for subdiv in ("SCT", "Scotland"): self.assertHolidayName( - name, self.subdiv_holidays[subdiv], (f"{year}-11-30" for year in range(2006, 2050)) + name, + self.subdiv_holidays[subdiv], + (f"{year}-11-30" for year in range(2006, 2050)), ) self.assertNoHoliday( - self.subdiv_holidays[subdiv], (f"{year}-11-30" for year in range(1950, 2006)) + self.subdiv_holidays[subdiv], + (f"{year}-11-30" for year in range(1950, 2006)), ) self.assertNoHolidayName(name, self.subdiv_holidays[subdiv], range(1950, 2006)) self.assertHolidayName(f"{name} (observed)", self.subdiv_holidays[subdiv], obs_dt) @@ -344,7 +355,8 @@ def test_st_andrews_day(self): "Wales", ): self.assertNoHoliday( - self.subdiv_holidays[subdiv], (f"{year}-11-30" for year in range(1950, 2050)) + self.subdiv_holidays[subdiv], + (f"{year}-11-30" for year in range(1950, 2050)), ) self.assertNoHolidayName(name, self.subdiv_holidays[subdiv], range(1950, 2050)) self.assertNoHoliday(f"{year}-11-30" for year in range(1950, 2050)) @@ -392,7 +404,9 @@ def test_boxing_day(self): def test_boxing_day_scotland(self): name = "Boxing Day" self.assertHolidayName( - name, self.subdiv_holidays["SCT"], (f"{year}-12-26" for year in range(1974, 2050)) + name, + self.subdiv_holidays["SCT"], + (f"{year}-12-26" for year in range(1974, 2050)), ) self.assertNoHolidayName(name, self.subdiv_holidays["SCT"], range(1950, 1974)) diff --git a/tests/countries/test_united_states.py b/tests/countries/test_united_states.py index 6d2b637a1..949adf363 100644 --- a/tests/countries/test_united_states.py +++ b/tests/countries/test_united_states.py @@ -218,7 +218,15 @@ def test_martin_luther_king_day(self): ) self.assertHolidayName(name, dt) - for subdiv in set(UnitedStates.subdivisions) - {"AL", "AR", "AZ", "GA", "ID", "MS", "NH"}: + for subdiv in set(UnitedStates.subdivisions) - { + "AL", + "AR", + "AZ", + "GA", + "ID", + "MS", + "NH", + }: self.assertHolidayName(name, self.state_hols[subdiv], dt) self.assertNoHolidayName(name, self.state_hols[subdiv], range(1865, 1986)) @@ -242,7 +250,9 @@ def test_martin_luther_king_day_states(self): ) self.assertHolidayName( - "Martin Luther King, Jr & Robert E. Lee's Birthday", self.state_hols["AL"], dt + "Martin Luther King, Jr & Robert E. Lee's Birthday", + self.state_hols["AL"], + dt, ) self.assertHolidayName( @@ -326,7 +336,9 @@ def test_martin_luther_king_day_states(self): ) self.assertHolidayName( - "Dr. Martin Luther King Jr. and Robert E. Lee's Birthdays", self.state_hols["MS"], dt + "Dr. Martin Luther King Jr. and Robert E. Lee's Birthdays", + self.state_hols["MS"], + dt, ) self.assertHolidayName( @@ -383,7 +395,9 @@ def test_washingtons_birthday_states(self): ) self.assertHolidayName( - "George Washington's Birthday and Daisy Gatson Bates Day", self.state_hols["AR"], dt + "George Washington's Birthday and Daisy Gatson Bates Day", + self.state_hols["AR"], + dt, ) self.assertNoHoliday(self.state_hols["DE"], dt) @@ -690,7 +704,9 @@ def test_inauguration_day(self): self.assertNoHolidayName(name, self.state_hols[subdiv], years_no) self.assertHolidayName(f"{name} (observed)", self.state_hols[subdiv], obs_dt) self.assertNoNonObservedHolidayName( - f"{name} (observed)", UnitedStates(subdiv=subdiv, observed=False), obs_dt + f"{name} (observed)", + UnitedStates(subdiv=subdiv, observed=False), + obs_dt, ) def test_lincolns_birthday(self): @@ -705,11 +721,15 @@ def test_lincolns_birthday(self): ) for subdiv in ("CT", "IA", "IL", "NJ", "NY"): self.assertHolidayName( - name, self.state_hols[subdiv], (f"{year}-02-12" for year in range(1971, 2050)) + name, + self.state_hols[subdiv], + (f"{year}-02-12" for year in range(1971, 2050)), ) self.assertHolidayName(f"{name} (observed)", self.state_hols[subdiv], obs_dt) self.assertNoNonObservedHolidayName( - f"{name} (observed)", UnitedStates(subdiv=subdiv, observed=False), obs_dt + f"{name} (observed)", + UnitedStates(subdiv=subdiv, observed=False), + obs_dt, ) obs_dt = ( "1994-02-11", @@ -1012,7 +1032,9 @@ def test_patriots_day(self): ) for subdiv in ("MA", "ME"): self.assertHolidayName( - name, self.state_hols[subdiv], (f"{year}-04-19" for year in range(1894, 1969)) + name, + self.state_hols[subdiv], + (f"{year}-04-19" for year in range(1894, 1969)), ) self.assertNoHolidayName(name, self.state_hols[subdiv], range(1865, 1894)) self.assertHolidayName(name, self.state_hols[subdiv], dt) @@ -1624,7 +1646,9 @@ def test_after_thanksgiving_day(self): self.assertNoHolidayName(name) self.assertHolidayName(name, self.state_hols[subdiv], dt) self.assertHolidayName( - name, self.state_hols[subdiv], range(start_year if start_year > 0 else 1865, 2050) + name, + self.state_hols[subdiv], + range(start_year if start_year > 0 else 1865, 2050), ) if start_year > 0: self.assertNoHolidayName(name, self.state_hols[subdiv], range(1865, start_year)) @@ -1714,7 +1738,9 @@ def test_christmas_eve(self): self.assertNoHolidayName(name, self.state_hols[subdiv], range(1865, start_year)) self.assertHolidayName(f"{name} (observed)", self.state_hols[subdiv], obs_dt) self.assertNoNonObservedHolidayName( - f"{name} (observed)", UnitedStates(subdiv=subdiv, observed=False), obs_dt + f"{name} (observed)", + UnitedStates(subdiv=subdiv, observed=False), + obs_dt, ) def test_day_after_christmas(self): @@ -1765,5 +1791,7 @@ def test_new_years_eve(self): self.assertNoHolidayName(name, self.state_hols[subdiv], range(1865, start_year)) self.assertHolidayName(f"{name} (observed)", self.state_hols[subdiv], obs_dt) self.assertNoNonObservedHolidayName( - f"{name} (observed)", UnitedStates(subdiv=subdiv, observed=False), obs_dt + f"{name} (observed)", + UnitedStates(subdiv=subdiv, observed=False), + obs_dt, ) diff --git a/tests/countries/test_uruguay.py b/tests/countries/test_uruguay.py index 101ba44bb..a3c833732 100644 --- a/tests/countries/test_uruguay.py +++ b/tests/countries/test_uruguay.py @@ -52,7 +52,8 @@ def test_cry_of_asencio(self): def test_labor_day(self): name = "Día de los Trabajadores" self.assertHolidayName( - name, (f"{year}-05-01" for year in set(range(1920, 2050)).difference({1980, 1981})) + name, + (f"{year}-05-01" for year in set(range(1920, 2050)).difference({1980, 1981})), ) self.assertHolidayName( name, @@ -87,7 +88,8 @@ def test_constitution_day(self): def test_independence_day(self): self.assertHolidayName( - "Declaratoria de la Independencia", (f"{year}-08-25" for year in range(1920, 2050)) + "Declaratoria de la Independencia", + (f"{year}-08-25" for year in range(1920, 2050)), ) def test_italy_day(self): @@ -113,7 +115,9 @@ def test_christmas(self): def test_childrens_day(self): self.assertHolidayName( - "Día de los Niños", self.bank_holidays, (f"{year}-01-06" for year in range(1920, 2050)) + "Día de los Niños", + self.bank_holidays, + (f"{year}-01-06" for year in range(1920, 2050)), ) def test_carnival(self): diff --git a/tests/countries/test_vatican_city.py b/tests/countries/test_vatican_city.py index 16e483c24..87fe10d5a 100644 --- a/tests/countries/test_vatican_city.py +++ b/tests/countries/test_vatican_city.py @@ -117,7 +117,8 @@ def test_saint_joseph_workers_day(self): def test_saints_peter_and_paul_day(self): self.assertHolidayName( - "Saint Peter and Saint Paul's Day", (f"{year}-06-29" for year in range(1970, 2050)) + "Saint Peter and Saint Paul's Day", + (f"{year}-06-29" for year in range(1970, 2050)), ) def test_assumption_day(self): diff --git a/tests/countries/test_vietnam.py b/tests/countries/test_vietnam.py index 92fe03161..def510349 100644 --- a/tests/countries/test_vietnam.py +++ b/tests/countries/test_vietnam.py @@ -33,7 +33,8 @@ def test_common(self): def test_first_day_of_january(self): self.assertHolidayName( - "International New Year's Day", (f"{year}-01-01" for year in range(1979, 2050)) + "International New Year's Day", + (f"{year}-01-01" for year in range(1979, 2050)), ) def test_lunar_new_year(self): @@ -72,7 +73,8 @@ def test_king_hung_day(self): def test_liberation_day(self): self.assertHolidayName( - "Liberation Day/Reunification Day", (f"{year}-04-30" for year in range(1979, 2050)) + "Liberation Day/Reunification Day", + (f"{year}-04-30" for year in range(1979, 2050)), ) def test_international_labor_day(self): diff --git a/tests/test_holiday_base.py b/tests/test_holiday_base.py index 7e5df8def..2f0650fda 100644 --- a/tests/test_holiday_base.py +++ b/tests/test_holiday_base.py @@ -163,7 +163,8 @@ def test_years(self): self.assertSetEqual(hb.years, {2013, 2014, 2015}) self.assertSetEqual( - HolidayBase(years=range(2010, 2016)).years, {2010, 2011, 2012, 2013, 2014, 2015} + HolidayBase(years=range(2010, 2016)).years, + {2010, 2011, 2012, 2013, 2014, 2015}, ) self.assertSetEqual(HolidayBase(years=(2013, 2015, 2015)).years, {2013, 2015}) self.assertSetEqual(HolidayBase(years=2015).years, {2015}) @@ -199,7 +200,12 @@ def test_default_category(self): self.assertEqual(ccc.categories, {TestCategories.CustomCategoryClass.default_category}) for name in ("CC Holiday",): self.assertTrue(ccc.get_named(name, lookup="exact")) - for name in ("CC1 Holiday", "CC2 Holiday", "SD_1 CC_1 Holiday", "SD_2 CC Holiday"): + for name in ( + "CC1 Holiday", + "CC2 Holiday", + "SD_1 CC_1 Holiday", + "SD_2 CC Holiday", + ): self.assertFalse(ccc.get_named(name, lookup="exact")) # Default category with subdiv. @@ -214,7 +220,8 @@ def test_no_default_category(self): TestCategories.CustomCategoryClass.default_category = None self.assertRaises(ValueError, lambda: TestCategories.CustomCategoryClass(years=2024)) self.assertRaises( - ValueError, lambda: TestCategories.CustomCategoryClass(years=2024, subdiv="SD_1") + ValueError, + lambda: TestCategories.CustomCategoryClass(years=2024, subdiv="SD_1"), ) # Explicitly set category. @@ -348,7 +355,8 @@ def test_get_list_multiple_subdivisions(self): hb_combined = hb_subdiv_1 + hb_subdiv_2 self.assertEqual( - hb_combined["2021-08-10"], "Subdiv 1 Custom Holiday; Subdiv 2 Custom Holiday" + hb_combined["2021-08-10"], + "Subdiv 1 Custom Holiday; Subdiv 2 Custom Holiday", ) self.assertListEqual( hb_combined.get_list("2021-08-10"), @@ -434,7 +442,12 @@ def test_istartswith(self): hb = CountryStub1(years=2022) for name in ("new year's", "New Year's", "New Year's day"): self.assertListEqual(hb.get_named(name, lookup="istartswith"), [date(2022, 1, 1)]) - for name in ("New Year Day", "New Year holiday", "New Year's Day Holiday", "year"): + for name in ( + "New Year Day", + "New Year holiday", + "New Year's Day Holiday", + "year", + ): self.assertListEqual(hb.get_named(name, lookup="istartswith"), []) self.assertListEqual( hb.get_named("independence day", lookup="istartswith"), [date(2022, 7, 4)] @@ -451,7 +464,12 @@ def test_startswith(self): hb = CountryStub1(years=2022) for name in ("New Year's", "New Year"): self.assertListEqual(hb.get_named(name, lookup="startswith"), [date(2022, 1, 1)]) - for name in ("New Year Day", "New Year Holiday", "New Year's Day Holiday", "year"): + for name in ( + "New Year Day", + "New Year Holiday", + "New Year's Day Holiday", + "year", + ): self.assertListEqual(hb.get_named(name, lookup="startswith"), []) self.assertListEqual( hb.get_named("Independence Day", lookup="startswith"), [date(2022, 7, 4)] @@ -576,7 +594,8 @@ def test_add_country(self): self.hb_combined = CountryStub1(years=2014, subdiv="Subdiv 1") self.hb_combined += CountryStub1(years=2014, subdiv="Subdiv 2") self.assertEqual( - self.hb_combined["2014-08-10"], "Subdiv 1 Custom Holiday; Subdiv 2 Custom Holiday" + self.hb_combined["2014-08-10"], + "Subdiv 1 Custom Holiday; Subdiv 2 Custom Holiday", ) self.assertRaises(TypeError, lambda: self.hb_1 + {}) diff --git a/tox.ini b/tox.ini index 960f15599..c5364d4f5 100644 --- a/tox.ini +++ b/tox.ini @@ -34,9 +34,6 @@ commands = pre-commit autoupdate pre-commit run --all-files -[flake8] -extend-ignore = E203 - [pytest] filterwarnings = ignore:The --rsyncdir .* are deprecated:DeprecationWarning