From ced9ee71cf8d781e788e66ab407c924409b6d82b Mon Sep 17 00:00:00 2001 From: ~Jhellico Date: Tue, 10 Dec 2024 04:45:21 +0200 Subject: [PATCH] Inline single-use variables, update .py files formatting (#2161) --- holidays/countries/angola.py | 47 +++++++++---------- holidays/countries/argentina.py | 5 +- holidays/countries/bolivia.py | 2 +- holidays/countries/bosnia_and_herzegovina.py | 2 +- holidays/countries/cambodia.py | 13 +++-- holidays/countries/canada.py | 3 +- holidays/countries/chile.py | 21 ++++----- holidays/countries/costa_rica.py | 2 +- holidays/countries/croatia.py | 3 +- holidays/countries/czechia.py | 2 +- holidays/countries/dominica.py | 3 +- holidays/countries/hungary.py | 4 +- holidays/countries/israel.py | 5 +- holidays/countries/latvia.py | 6 +-- holidays/countries/lithuania.py | 2 +- holidays/countries/namibia.py | 2 +- holidays/countries/new_zealand.py | 11 ++--- holidays/countries/philippines.py | 4 +- holidays/countries/south_korea.py | 12 ++--- holidays/countries/thailand.py | 23 +++++---- holidays/countries/turkey.py | 6 +-- holidays/countries/united_states.py | 7 ++- holidays/countries/uruguay.py | 15 +++--- holidays/holiday_base.py | 13 +---- holidays/utils.py | 6 +-- tests/calendars/test_thai.py | 47 +++++-------------- tests/common.py | 13 ++--- tests/countries/test_cambodia.py | 45 ++++-------------- tests/countries/test_germany.py | 4 +- tests/countries/test_hongkong.py | 4 +- tests/countries/test_indonesia.py | 3 +- tests/countries/test_israel.py | 22 ++++----- tests/countries/test_kazakhstan.py | 4 +- tests/countries/test_laos.py | 10 +--- tests/countries/test_saint_kitts_and_nevis.py | 3 +- tests/countries/test_south_korea.py | 15 ++---- tests/test_docs.py | 7 +-- tests/test_holiday_base.py | 3 +- tests/test_holiday_groups.py | 8 +--- tests/test_utils.py | 16 ++----- 40 files changed, 146 insertions(+), 277 deletions(-) diff --git a/holidays/countries/angola.py b/holidays/countries/angola.py index 3254ef4d4..f525fe07f 100644 --- a/holidays/countries/angola.py +++ b/holidays/countries/angola.py @@ -71,7 +71,7 @@ def _add_observed(self, dt: date, **kwargs) -> tuple[bool, Optional[date]]: def _populate_public_holidays(self): # New Year's Day. - name = self.tr("Dia do Ano Novo") + name = tr("Dia do Ano Novo") dt = self._add_new_years_day(name) if self._year <= 2011 or self._year >= 2018: self._add_observed(dt) @@ -84,14 +84,15 @@ def _populate_public_holidays(self): self._add_holiday_jan_4(tr("Dia dos Mártires da Repressão Colonial")) ) - name = ( - # Beginning of the Armed Struggle for National Liberation Day. - tr("Dia do Início da Luta Armada de Libertação Nacional") - if self._year >= 2012 - # Beginning of the Armed Struggle Day. - else tr("Dia do Início da Luta Armada") + self._add_observed( + self._add_holiday_feb_4( + # Beginning of the Armed Struggle for National Liberation Day. + tr("Dia do Início da Luta Armada de Libertação Nacional") + if self._year >= 2012 + # Beginning of the Armed Struggle Day. + else tr("Dia do Início da Luta Armada") + ) ) - self._add_observed(self._add_holiday_feb_4(name)) # Law #16/96. if self._year >= 1997: @@ -103,17 +104,13 @@ def _populate_public_holidays(self): # Law #11/18. if self._year >= 2019: - self._add_observed( - # Southern Africa Liberation Day. - self._add_holiday_mar_23(tr("Dia da Libertação da África Austral")) - ) + # Southern Africa Liberation Day. + self._add_observed(self._add_holiday_mar_23(tr("Dia da Libertação da África Austral"))) # Law #7/03. if self._year >= 2003: - self._add_observed( - # Peace and National Reconciliation Day. - self._add_holiday_apr_4(tr("Dia da Paz e Reconciliação Nacional")) - ) + # Peace and National Reconciliation Day. + self._add_observed(self._add_holiday_apr_4(tr("Dia da Paz e Reconciliação Nacional"))) # Law #16/96. if self._year >= 1997: @@ -145,21 +142,22 @@ def _populate_public_holidays(self): if self._year <= 2010 or self._year >= 2018: self._add_observed(dt) - name = ( - # National Independence Day. - tr("Dia da Independência Nacional") - if self._year >= 1996 - # Independence Day. - else tr("Dia da Independência") + self._add_observed( + self._add_holiday_nov_11( + # National Independence Day. + tr("Dia da Independência Nacional") + if self._year >= 1996 + # Independence Day. + else tr("Dia da Independência") + ) ) - self._add_observed(self._add_holiday_nov_11(name)) # Decree # 7/92. if self._year <= 1991: # Date of Founding of MPLA - Labor Party. self._add_holiday_dec_10(tr("Data da Fundacao do MPLA - Partido do Trabalho")) - name = ( + dt = self._add_christmas_day( # Christmas and Family Day. tr("Dia de Natal e da Família") if self._year >= 2011 @@ -169,7 +167,6 @@ def _populate_public_holidays(self): else tr("Dia da Família") # Family Day. ) ) - dt = self._add_christmas_day(name) if self._year <= 2010 or self._year >= 2018: self._add_observed(dt) diff --git a/holidays/countries/argentina.py b/holidays/countries/argentina.py index bc5508bab..356ee1b0f 100644 --- a/holidays/countries/argentina.py +++ b/holidays/countries/argentina.py @@ -205,7 +205,7 @@ def _populate_public_holidays(self): if self._year >= 2016: jun_17 = self._add_holiday_jun_17( # Pass to the Immortality of General Don Martin Miguel de Guemes. - tr("Paso a la Inmortalidad del General Don Martín Miguel de Güemes"), + tr("Paso a la Inmortalidad del General Don Martín Miguel de Güemes") ) # If Jun 17 is Friday, then it should move to Mon, Jun 20 # but Jun 20 is Gen. Belgrano holiday @@ -232,14 +232,13 @@ def _populate_public_holidays(self): # In 2010 the holiday became movable and its name was changed. if self._year >= 1917: - name = ( + oct_12 = self._add_columbus_day( # Respect for Cultural Diversity Day. tr("Día del Respeto a la Diversidad Cultural") if self._year >= 2010 # Columbus Day. else tr("Día de la Raza") ) - oct_12 = self._add_columbus_day(name) if self._year >= 2010: self._move_holiday(oct_12) diff --git a/holidays/countries/bolivia.py b/holidays/countries/bolivia.py index 76afdc027..6e5b799b3 100644 --- a/holidays/countries/bolivia.py +++ b/holidays/countries/bolivia.py @@ -83,7 +83,7 @@ def _populate_public_holidays(self): self._add_good_friday(tr("Viernes Santo")) # Labor Day. - self._add_observed(may_1 := self._add_labor_day(self.tr("Día del Trabajo"))) + self._add_observed(may_1 := self._add_labor_day(tr("Día del Trabajo"))) # Supreme Decree #1210. if 2012 <= self._year <= 2015: self._add_observed(may_1, rule=TUE_TO_PREV_MON + THU_TO_NEXT_FRI) diff --git a/holidays/countries/bosnia_and_herzegovina.py b/holidays/countries/bosnia_and_herzegovina.py index 91cbf2e1a..aa719f1d5 100644 --- a/holidays/countries/bosnia_and_herzegovina.py +++ b/holidays/countries/bosnia_and_herzegovina.py @@ -224,7 +224,7 @@ def _populate_subdiv_srp_public_holidays(self): self._add_holiday_nov_21( # Dayton Agreement Day. - tr("Dan uspostave Opšteg okvirnog sporazuma za mir u Bosni i Hercegovini"), + tr("Dan uspostave Opšteg okvirnog sporazuma za mir u Bosni i Hercegovini") ) # Catholic Christmas Eve. diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index 88393cc4c..1edb93cd4 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -128,7 +128,7 @@ def _populate_public_holidays(self): # NORODOM SIHAMONI, King of Cambodia "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី" ) - dt = self._add_holiday_may_14(king_sihamoni_bday) + self._add_holiday_may_14(king_sihamoni_bday) if self._year <= 2019: self._add_holiday_may_13(king_sihamoni_bday) self._add_holiday_may_15(king_sihamoni_bday) @@ -159,7 +159,7 @@ 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("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ"), + tr("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ") ) # ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ @@ -176,13 +176,12 @@ def _populate_public_holidays(self): if self._year >= 2012: self._add_holiday_oct_15( - # Mourning Day of the Late King-Father - # NORODOM SIHANOUK of Cambodia + # Mourning Day of the Late King-Father NORODOM SIHANOUK of Cambodia tr( "ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ នរោត្តម " "សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ " "ព្រះបរមរតនកោដ្ឋ" - ), + ) ) # ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស @@ -207,7 +206,7 @@ def _populate_public_holidays(self): "ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា " "ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី " "ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា" - ), + ) ) # ពិធីបុណ្យឯករាជ្យជាតិ @@ -226,7 +225,7 @@ def _populate_public_holidays(self): self._add_holiday_dec_10(tr("ទិវាសិទ្ធិមនុស្សអន្តរជាតិ")) # Cambodian Lunar Calendar Holidays - # See `_ThaiLunisolar` in holidays/utils.py for more details. + # See `_ThaiLunisolar` in holidays/calendars/thai.py for more details. # Cambodian Lunar Calendar Holidays only work from 1941 to 2157. # ពិធីបុណ្យមាឃបូជា diff --git a/holidays/countries/canada.py b/holidays/countries/canada.py index 6247e0ccd..d1ff0c313 100644 --- a/holidays/countries/canada.py +++ b/holidays/countries/canada.py @@ -236,14 +236,13 @@ def _populate_subdiv_mb_public_holidays(self): def _populate_subdiv_mb_optional_holidays(self): if self._year >= 1900: - name = ( + self._add_holiday_1st_mon_of_aug( # Terry Fox Day. tr("Terry Fox Day") if self._year >= 2015 # Civic Holiday. else tr("Civic Holiday") ) - self._add_holiday_1st_mon_of_aug(name) if self._year >= 1931: # Remembrance Day. diff --git a/holidays/countries/chile.py b/holidays/countries/chile.py index 4c08d74e8..002c7174f 100644 --- a/holidays/countries/chile.py +++ b/holidays/countries/chile.py @@ -143,10 +143,8 @@ def _populate_public_holidays(self): # Day of National Liberation. self._add_holiday_sep_11(tr("Día de la Liberación Nacional")) elif 1999 <= self._year <= 2001: - self._add_holiday_1st_mon_of_sep( - # Day of National Unity. - tr("Día de la Unidad Nacional") - ) + # Day of National Unity. + self._add_holiday_1st_mon_of_sep(tr("Día de la Unidad Nacional")) if self._year >= 2007: self._add_observed( @@ -168,14 +166,15 @@ def _populate_public_holidays(self): self._add_holiday_sep_20(tr("Fiestas Patrias")) if self._year >= 1922 and self._year != 1973: - name = ( - # Meeting of Two Worlds' Day. - tr("Día del Encuentro de dos Mundos") - if self._year >= 2000 - # Columbus Day. - else tr("Día de la Raza") + self._move_holiday( + self._add_columbus_day( + # Meeting of Two Worlds' Day. + tr("Día del Encuentro de dos Mundos") + if self._year >= 2000 + # Columbus Day. + else tr("Día de la Raza") + ) ) - self._move_holiday(self._add_columbus_day(name)) if self._year >= 2008: # This holiday is moved to the preceding Friday if it falls on a Tuesday, diff --git a/holidays/countries/costa_rica.py b/holidays/countries/costa_rica.py index cb0930eb6..ce9ed2ab0 100644 --- a/holidays/countries/costa_rica.py +++ b/holidays/countries/costa_rica.py @@ -106,7 +106,7 @@ def _populate_optional_holidays(self): if self._year >= 2021: aug_31 = self._add_holiday_aug_31( # Day of the Black Person and Afro-Costa Rican Culture. - self.tr("Día de la Persona Negra y la Cultura Afrocostarricense") + tr("Día de la Persona Negra y la Cultura Afrocostarricense") ) if self._year in {2021, 2022, 2023}: # Move to next Sunday. diff --git a/holidays/countries/croatia.py b/holidays/countries/croatia.py index c4a82f9b7..caba9b882 100644 --- a/holidays/countries/croatia.py +++ b/holidays/countries/croatia.py @@ -67,14 +67,13 @@ def _populate_public_holidays(self): # Anti-Fascist Struggle Day. self._add_holiday_jun_22(tr("Dan antifašističke borbe")) - name = ( + self._add_holiday_aug_5( # Victory and Homeland Thanksgiving Day and Croatian Veterans Day. tr("Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja") if self._year >= 2008 # Victory and Homeland Thanksgiving Day. else tr("Dan pobjede i domovinske zahvalnosti") ) - self._add_holiday_aug_5(name) # Assumption Day. self._add_assumption_of_mary_day(tr("Velika Gospa")) diff --git a/holidays/countries/czechia.py b/holidays/countries/czechia.py index f1e34b787..06b670930 100644 --- a/holidays/countries/czechia.py +++ b/holidays/countries/czechia.py @@ -36,7 +36,7 @@ def _populate_public_holidays(self): tr("Den obnovy samostatného českého státu") if self._year >= 2000 # New Year's Day. - else tr("Nový rok"), + else tr("Nový rok") ) if self._year <= 1951 or self._year >= 2016: diff --git a/holidays/countries/dominica.py b/holidays/countries/dominica.py index f31748282..89e7c7dfb 100644 --- a/holidays/countries/dominica.py +++ b/holidays/countries/dominica.py @@ -75,14 +75,13 @@ def _populate_public_holidays(self): # Whit Monday. self._add_whit_monday("Whit Monday") - first_monday_of_august_holiday_name = ( + self._add_holiday_1st_mon_of_aug( # Emancipation Day. "Emancipation Day" if self._year >= 1998 # First Monday of August. else "First Monday of August" ) - self._add_holiday_1st_mon_of_aug(first_monday_of_august_holiday_name) # Independence Day. self._add_observed(self._add_holiday_nov_3("Independence Day"), rule=SUN_TO_NEXT_TUE) diff --git a/holidays/countries/hungary.py b/holidays/countries/hungary.py index 8dbcd997a..cd9130702 100644 --- a/holidays/countries/hungary.py +++ b/holidays/countries/hungary.py @@ -54,7 +54,7 @@ def __init__(self, *args, **kwargs): def _populate_public_holidays(self): # New Year's Day. - self._add_new_years_day(self.tr("Újév")) + self._add_new_years_day(tr("Újév")) if 1945 <= self._year <= 1950 or self._year >= 1989: # National Day. @@ -90,7 +90,7 @@ def _populate_public_holidays(self): tr("A kenyér ünnepe") if 1950 <= self._year <= 1989 # State Foundation Day. - else tr("Az államalapítás ünnepe"), + else tr("Az államalapítás ünnepe") ) if self._year >= 1991: diff --git a/holidays/countries/israel.py b/holidays/countries/israel.py index 8fe08f6a8..283eff879 100644 --- a/holidays/countries/israel.py +++ b/holidays/countries/israel.py @@ -73,10 +73,9 @@ def _populate_public_holidays(self): # Yom Kippur (Day of Atonement). self._add_holiday(tr("יום כיפור"), self._get_holiday(YOM_KIPPUR)) - # Sukkot (Feast of Tabernacles). - name = tr("סוכות") sukkot_dt = self._get_holiday(SUKKOT) - self._add_holiday(name, sukkot_dt) + # Sukkot (Feast of Tabernacles). + self._add_holiday(tr("סוכות"), sukkot_dt) # Simchat Torah / Shemini Atzeret. self._add_holiday(tr("שמחת תורה/שמיני עצרת"), _timedelta(sukkot_dt, +7)) diff --git a/holidays/countries/latvia.py b/holidays/countries/latvia.py index 7eb7a1aa3..cc01d36a2 100644 --- a/holidays/countries/latvia.py +++ b/holidays/countries/latvia.py @@ -55,10 +55,8 @@ def _populate_public_holidays(self): self._add_labor_day(tr("Darba svētki")) if self._year >= 2002: - dt = self._add_holiday_may_4( - # Restoration of Independence Day. - tr("Latvijas Republikas Neatkarības atjaunošanas diena") - ) + # Restoration of Independence Day. + dt = self._add_holiday_may_4(tr("Latvijas Republikas Neatkarības atjaunošanas diena")) if self._year >= 2008: self._add_observed(dt) diff --git a/holidays/countries/lithuania.py b/holidays/countries/lithuania.py index 05e346102..316940e8d 100644 --- a/holidays/countries/lithuania.py +++ b/holidays/countries/lithuania.py @@ -70,7 +70,7 @@ def _populate_public_holidays(self) -> None: tr( "Valstybės (Lietuvos karaliaus Mindaugo karūnavimo) " "ir Tautiškos giesmės diena" - ), + ) ) # Assumption Day. diff --git a/holidays/countries/namibia.py b/holidays/countries/namibia.py index a16830923..61827b07a 100644 --- a/holidays/countries/namibia.py +++ b/holidays/countries/namibia.py @@ -73,7 +73,7 @@ def _populate_public_holidays(self): self._add_holiday_sep_10( "Day of the Namibian Women and International Human Rights Day" if self._year >= 2005 - else "International Human Rights Day", + else "International Human Rights Day" ) ) diff --git a/holidays/countries/new_zealand.py b/holidays/countries/new_zealand.py index fa67210ad..eaad52c10 100644 --- a/holidays/countries/new_zealand.py +++ b/holidays/countries/new_zealand.py @@ -122,9 +122,7 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def _get_nearest_monday(self, *args) -> Optional[date]: - dt = args if len(args) > 1 else args[0] - dt = dt if isinstance(dt, date) else date(self._year, *dt) - return self._get_observed_date(dt, rule=ALL_TO_NEAREST_MON) + return self._get_observed_date(date(self._year, *args), rule=ALL_TO_NEAREST_MON) def _populate_public_holidays(self): # Bank Holidays Act 1873 @@ -256,12 +254,9 @@ def _populate_subdiv_nsn_public_holidays(self): def _populate_subdiv_ntl_public_holidays(self): if 1964 <= self._year <= 1973: - name = "Waitangi Day" - dt = (FEB, 6) + self._add_holiday("Waitangi Day", self._get_nearest_monday(FEB, 6)) else: - name = "Auckland Anniversary Day" - dt = (JAN, 29) - self._add_holiday(name, self._get_nearest_monday(dt)) + self._add_holiday("Auckland Anniversary Day", self._get_nearest_monday(JAN, 29)) def _populate_subdiv_ota_public_holidays(self): # there is no easily determined single day of local observance?!?! diff --git a/holidays/countries/philippines.py b/holidays/countries/philippines.py index f396eaa0c..d528d2529 100644 --- a/holidays/countries/philippines.py +++ b/holidays/countries/philippines.py @@ -267,8 +267,8 @@ class PhilippinesStaticHolidays: (NOV, 2, additional_special), (DEC, 24, additional_special), ), - 2010: ((DEC, 24, additional_special),), - 2012: ((NOV, 2, additional_special),), + 2010: (DEC, 24, additional_special), + 2012: (NOV, 2, additional_special), 2013: ( (NOV, 2, additional_special), (DEC, 24, additional_special), diff --git a/holidays/countries/south_korea.py b/holidays/countries/south_korea.py index 2bf16dd88..263049582 100644 --- a/holidays/countries/south_korea.py +++ b/holidays/countries/south_korea.py @@ -399,10 +399,8 @@ class SouthKoreaStaticHolidays: # Joint Memorial Service for Fallen Soldiers. (JUN, 21, tr("전몰군인 합동위령제")), ), - 1951: ( - # Vice Presidential Election. - (MAY, 16, tr("부통령 선거일")), - ), + # Vice Presidential Election. + 1951: (MAY, 16, tr("부통령 선거일")), 1952: ( # City/Town/Township-level Local Elections. (APR, 25, local_election_day), @@ -411,10 +409,8 @@ class SouthKoreaStaticHolidays: # 2nd Presidential Election/3rd Vice President Election. (AUG, 5, presidential_election_day), ), - 1954: ( - # 3rd National Assembly Election. - (MAY, 20, national_assembly_election_day), - ), + # 3rd National Assembly Election. + 1954: (MAY, 20, national_assembly_election_day), 1956: ( # 3rd Presidential Election/4th Vice President Election. (MAY, 15, presidential_election_day), diff --git a/holidays/countries/thailand.py b/holidays/countries/thailand.py index 01897cdf5..d2070cf11 100644 --- a/holidays/countries/thailand.py +++ b/holidays/countries/thailand.py @@ -303,14 +303,15 @@ def _populate_public_holidays(self): # Now acts as the Queen Mother from 2017 onwards. if self._year >= 1976: - q_sirikit_bday = ( - # HM Queen Sirikit the Queen Mother's Birthday. - tr("วันเฉลิมพระชนมพรรษาสมเด็จพระบรมราชชนนีพันปีหลวง") - if self._year >= 2017 - # HM Queen Sirikit's Birthday. - else tr("วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสิริกิติ์ พระบรมราชินีนาถ") + self._add_observed( + self._add_holiday_aug_12( + # HM Queen Sirikit the Queen Mother's Birthday. + tr("วันเฉลิมพระชนมพรรษาสมเด็จพระบรมราชชนนีพันปีหลวง") + if self._year >= 2017 + # HM Queen Sirikit's Birthday. + else tr("วันเฉลิมพระชนมพรรษาสมเด็จพระนางเจ้าสิริกิติ์ พระบรมราชินีนาถ") + ) ) - self._add_observed(self._add_holiday_aug_12(q_sirikit_bday)) # วันแม่แห่งชาติ # Status: In-Use. @@ -496,7 +497,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("วันหยุดเพิ่มเติมสำหรับการปิดบัญชีประจำปีของธนาคารเพื่อการเกษตรและสหกรณ์การเกษตร") ) # วันหยุดภาคครึ่งปีของสถาบันการเงินและสถาบันการเงินเฉพาะกิจ @@ -505,10 +506,8 @@ def _populate_bank_holidays(self): # Abandoned in 2019. if self._year <= 2018: - self._add_holiday_jul_1( - # Mid-Year Closing Day - tr("วันหยุดภาคครึ่งปีของสถาบันการเงินและสถาบันการเงินเฉพาะกิจ"), - ) + # Mid-Year Closing Day + self._add_holiday_jul_1(tr("วันหยุดภาคครึ่งปีของสถาบันการเงินและสถาบันการเงินเฉพาะกิจ")) def _populate_government_holidays(self): # No Future Fixed Date Holidays diff --git a/holidays/countries/turkey.py b/holidays/countries/turkey.py index b409b79c7..93735276f 100644 --- a/holidays/countries/turkey.py +++ b/holidays/countries/turkey.py @@ -48,27 +48,25 @@ def _populate_public_holidays(self): # New Year's Day. self._add_new_years_day(tr("Yılbaşı")) - name = ( + self._add_holiday_apr_23( # National Sovereignty and Children's Day. tr("Ulusal Egemenlik ve Çocuk Bayramı") if self._year >= 1981 # National Sovereignty Day. else tr("Ulusal Egemenlik Bayramı") ) - self._add_holiday_apr_23(name) if self._year >= 2009: # Labour and Solidarity Day. self._add_labor_day(tr("Emek ve Dayanışma Günü")) - name = ( + self._add_holiday_may_19( # Commemoration of Atatürk, Youth and Sports Day. tr("Atatürk'ü Anma, Gençlik ve Spor Bayramı") if self._year >= 1981 # Youth and Sports Day. else tr("Gençlik ve Spor Bayramı") ) - self._add_holiday_may_19(name) if 1963 <= self._year <= 1980: # Freedom and Constitution Day. diff --git a/holidays/countries/united_states.py b/holidays/countries/united_states.py index 3905a8bfc..8c7b5f86a 100644 --- a/holidays/countries/united_states.py +++ b/holidays/countries/united_states.py @@ -293,12 +293,11 @@ def _populate_subdiv_al_public_holidays(self): def _populate_subdiv_ar_public_holidays(self): # Martin Luther King Jr. Day if self._year >= 1986: - name = ( + self._add_holiday_3rd_mon_of_jan( "Martin Luther King Jr. Day" if self._year >= 2018 else "Dr. Martin Luther King Jr. and Robert E. Lee's Birthdays" ) - self._add_holiday_3rd_mon_of_jan(name) # Washington's Birthday name = "George Washington's Birthday and Daisy Gatson Bates Day" @@ -479,7 +478,7 @@ def _populate_subdiv_id_public_holidays(self): self._add_holiday_3rd_mon_of_jan( "Martin Luther King Jr. / Idaho Human Rights Day" if self._year >= 2006 - else "Martin Luther King Jr. Day", + else "Martin Luther King Jr. Day" ) def _populate_subdiv_il_public_holidays(self): @@ -637,7 +636,7 @@ def _populate_subdiv_ms_public_holidays(self): # Martin Luther King Jr. Day if self._year >= 1986: self._add_holiday_3rd_mon_of_jan( - "Dr. Martin Luther King Jr. and Robert E. Lee's Birthdays", + "Dr. Martin Luther King Jr. and Robert E. Lee's Birthdays" ) # Confederate Memorial Day diff --git a/holidays/countries/uruguay.py b/holidays/countries/uruguay.py index adbb75b5d..7afddb5fa 100644 --- a/holidays/countries/uruguay.py +++ b/holidays/countries/uruguay.py @@ -134,14 +134,15 @@ def _populate_bank_holidays(self): self._move_holiday(dt) if self._year <= 1932 or self._year >= 1937: - name = ( - # Cultural Diversity Day. - tr("Día de la Diversidad Cultural") - if self._year >= 2014 - # Columbus Day. - else tr("Día de la Raza") + self._move_holiday( + self._add_columbus_day( + # Cultural Diversity Day. + tr("Día de la Diversidad Cultural") + if self._year >= 2014 + # Columbus Day. + else tr("Día de la Raza") + ) ) - self._move_holiday(self._add_columbus_day(name)) if self._year <= 1932 or self._year >= 1938: # All Souls' Day. diff --git a/holidays/holiday_base.py b/holidays/holiday_base.py index bf0bc72ec..052a4d137 100644 --- a/holidays/holiday_base.py +++ b/holidays/holiday_base.py @@ -448,8 +448,7 @@ def __getattr__(self, name): *_, month, day = tokens if month in MONTHS and day in DAYS: return lambda name: self._add_holiday( - name, - date(self._year, MONTHS[month], int(day)), + name, date(self._year, MONTHS[month], int(day)) ) elif len(tokens) == 7: @@ -687,15 +686,7 @@ def __str__(self) -> str: @property def __attribute_names(self): - return ( - "country", - "expand", - "language", - "market", - "observed", - "subdiv", - "years", - ) + return ("country", "expand", "language", "market", "observed", "subdiv", "years") @cached_property def _entity_code(self): diff --git a/holidays/utils.py b/holidays/utils.py index 1da1ae3e1..ae6bd0c72 100755 --- a/holidays/utils.py +++ b/holidays/utils.py @@ -252,11 +252,7 @@ def financial_holidays( try: return getattr(holidays, market)( - years=years, - subdiv=subdiv, - expand=expand, - observed=observed, - language=language, + years=years, subdiv=subdiv, expand=expand, observed=observed, language=language ) except AttributeError: raise NotImplementedError(f"Financial market {market} not available") diff --git a/tests/calendars/test_thai.py b/tests/calendars/test_thai.py index 6bf6531dd..ddf6f5207 100644 --- a/tests/calendars/test_thai.py +++ b/tests/calendars/test_thai.py @@ -66,10 +66,7 @@ def test_asarnha_bucha_date(self): 2150: date(2150, JUL, 9), } for year in asarnha_bucha_year_date: - self.assertEqual( - asarnha_bucha_year_date[year], - self.calendar.asarnha_bucha_date(year), - ) + self.assertEqual(asarnha_bucha_year_date[year], self.calendar.asarnha_bucha_date(year)) def test_atthami_bucha_date(self): # THAI_CALENDAR @@ -95,10 +92,7 @@ def test_atthami_bucha_date(self): 2150: date(2150, MAY, 19), } for year in atthami_bucha_year_date: - self.assertEqual( - atthami_bucha_year_date[year], - self.calendar.atthami_bucha_date(year), - ) + self.assertEqual(atthami_bucha_year_date[year], self.calendar.atthami_bucha_date(year)) # KHMER_CALENDAR athami_bochea_year_date = { self.calendar.START_YEAR - 1: None, @@ -140,8 +134,7 @@ def test_boun_haw_khao_salark(self): } for year in boun_haw_khao_salark_year_date: self.assertEqual( - boun_haw_khao_salark_year_date[year], - self.calendar.boun_haw_khao_salark_date(year), + boun_haw_khao_salark_year_date[year], self.calendar.boun_haw_khao_salark_date(year) ) def test_boun_suang_heua_date(self): @@ -155,8 +148,7 @@ def test_boun_suang_heua_date(self): } for year in boun_suang_heua_year_date: self.assertEqual( - boun_suang_heua_year_date[year], - self.calendar.boun_suang_heua_date(year), + boun_suang_heua_year_date[year], self.calendar.boun_suang_heua_date(year) ) def test_khao_phansa_date(self): @@ -199,10 +191,7 @@ def test_khao_phansa_date(self): 2150: date(2150, JUL, 10), } for year in khao_phansa_year_date: - self.assertEqual( - khao_phansa_year_date[year], - self.calendar.khao_phansa_date(year), - ) + self.assertEqual(khao_phansa_year_date[year], self.calendar.khao_phansa_date(year)) def test_loy_krathong_date(self): loy_krathong_year_date = { @@ -234,10 +223,7 @@ def test_loy_krathong_date(self): 2150: date(2150, NOV, 4), } for year in loy_krathong_year_date: - self.assertEqual( - loy_krathong_year_date[year], - self.calendar.loy_krathong_date(year), - ) + self.assertEqual(loy_krathong_year_date[year], self.calendar.loy_krathong_date(year)) def test_makha_bucha_date(self): # THAI_CALENDAR @@ -296,8 +282,7 @@ def test_makha_bucha_date(self): } for year in meak_bochea_year_date: self.assertEqual( - meak_bochea_year_date[year], - self.calendar.makha_bucha_date(year, KHMER_CALENDAR), + meak_bochea_year_date[year], self.calendar.makha_bucha_date(year, KHMER_CALENDAR) ) def test_ok_phansa_date(self): @@ -323,10 +308,7 @@ def test_ok_phansa_date(self): 2150: date(2150, OCT, 6), } for year in ok_phansa_year_date: - self.assertEqual( - ok_phansa_year_date[year], - self.calendar.ok_phansa_date(year), - ) + self.assertEqual(ok_phansa_year_date[year], self.calendar.ok_phansa_date(year)) def test_pchum_ben_date(self): pchum_ben_year_date = { @@ -345,10 +327,7 @@ def test_pchum_ben_date(self): 2025: date(2025, SEP, 22), } for year in pchum_ben_year_date: - self.assertEqual( - pchum_ben_year_date[year], - self.calendar.pchum_ben_date(year), - ) + self.assertEqual(pchum_ben_year_date[year], self.calendar.pchum_ben_date(year)) def test_preah_neangkoal_date(self): preah_neangkoal_year_date = { @@ -368,8 +347,7 @@ def test_preah_neangkoal_date(self): } for year in preah_neangkoal_year_date: self.assertEqual( - preah_neangkoal_year_date[year], - self.calendar.preah_neangkoal_date(year), + preah_neangkoal_year_date[year], self.calendar.preah_neangkoal_date(year) ) def test_visakha_bucha_date(self): @@ -412,10 +390,7 @@ def test_visakha_bucha_date(self): 2150: date(2150, MAY, 11), } for year in visakha_bucha_year_date: - self.assertEqual( - visakha_bucha_year_date[year], - self.calendar.visakha_bucha_date(year), - ) + self.assertEqual(visakha_bucha_year_date[year], self.calendar.visakha_bucha_date(year)) # KHMER_CALENDAR visaka_bochea_year_date = { self.calendar.START_YEAR - 1: None, diff --git a/tests/common.py b/tests/common.py index f70e4f8d5..2be822627 100644 --- a/tests/common.py +++ b/tests/common.py @@ -122,8 +122,7 @@ def _verify_type(self, holidays): def assertAliases(self, cls, *aliases): # noqa: N802 """Assert aliases match.""" self.assertTrue( - issubclass(cls, HolidayBase), - "The entity object must be a subclass of `HolidayBase`", + issubclass(cls, HolidayBase), "The entity object must be a subclass of `HolidayBase`" ) type_error_message = "The entity alias object must be a subclass of the entity class." @@ -389,17 +388,11 @@ class SundayHolidays(TestCase): def assertSundays(self, cls): # noqa: N802 holidays = cls(years=1989, include_sundays=True) - self.assertHoliday( - holidays, - "1989-12-31", - ) + self.assertHoliday(holidays, "1989-12-31") self.assertEqual(53, len([s for s in holidays if s.weekday() == SUN])) holidays = cls(years=2032, include_sundays=True) - self.assertHoliday( - holidays, - "2032-01-04", - ) + self.assertHoliday(holidays, "2032-01-04") self.assertEqual(52, len([s for s in holidays if s.weekday() == SUN])) self.assertNoHolidays(cls(include_sundays=True)) diff --git a/tests/countries/test_cambodia.py b/tests/countries/test_cambodia.py index a2796661a..d9f987645 100644 --- a/tests/countries/test_cambodia.py +++ b/tests/countries/test_cambodia.py @@ -52,16 +52,10 @@ def test_2022(self): ("2022-04-15", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), ("2022-04-16", "ពិធីបុណ្យចូលឆ្នាំថ្មីប្រពៃណីជាតិ"), ("2022-05-01", "ទិវាពលកម្មអន្តរជាតិ"), - ( - "2022-05-14", - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី", - ), + ("2022-05-14", "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី"), ("2022-05-15", "ពិធីបុណ្យវិសាខបូជា"), ("2022-05-19", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), - ( - "2022-06-18", - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ", - ), + ("2022-06-18", "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ"), ("2022-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ; ពិធីបុណ្យភ្ផុំបិណ្ឌ"), ("2022-09-25", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), ("2022-09-26", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), @@ -83,10 +77,7 @@ def test_2022(self): ), ("2022-11-07", "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក"), ("2022-11-08", "ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក"), - ( - "2022-11-09", - "ពិធីបុណ្យឯករាជ្យជាតិ; ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក", - ), + ("2022-11-09", "ពិធីបុណ្យឯករាជ្យជាតិ; ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក"), ) def test_2023(self): @@ -101,14 +92,8 @@ def test_2023(self): ("2023-05-01", "ទិវាពលកម្មអន្តរជាតិ"), ("2023-05-04", "ពិធីបុណ្យវិសាខបូជា"), ("2023-05-08", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), - ( - "2023-05-14", - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី", - ), - ( - "2023-06-18", - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ", - ), + ("2023-05-14", "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី"), + ("2023-06-18", "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ"), ("2023-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ"), ("2023-10-13", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), ("2023-10-14", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), @@ -300,14 +285,8 @@ def test_l10n_default(self): ("2023-05-01", "ទិវាពលកម្មអន្តរជាតិ"), ("2023-05-04", "ពិធីបុណ្យវិសាខបូជា"), ("2023-05-08", "ព្រះរាជពិធីច្រត់ព្រះនង្គ័ល"), - ( - "2023-05-14", - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី", - ), - ( - "2023-06-18", - "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ", - ), + ("2023-05-14", "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី"), + ("2023-06-18", "ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ"), ("2023-09-24", "ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ"), ("2023-10-13", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), ("2023-10-14", "ពិធីបុណ្យភ្ផុំបិណ្ឌ"), @@ -346,17 +325,11 @@ def test_l10n_en_us(self): ("2023-05-04", "Visaka Bochea Day"), ("2023-05-08", "Royal Ploughing Ceremony"), ("2023-05-14", "HM King Norodom Sihamoni's Birthday"), - ( - "2023-06-18", - "HM Queen Norodom Monineath Sihanouk the Queen-Mother's Birthday", - ), + ("2023-06-18", "HM Queen Norodom Monineath Sihanouk the Queen-Mother's Birthday"), ("2023-09-24", "Constitution Day"), ("2023-10-13", "Pchum Ben Day"), ("2023-10-14", "Pchum Ben Day"), - ( - "2023-10-15", - "HM King Norodom Sihanouk Mourning Day; Pchum Ben Day", - ), + ("2023-10-15", "HM King Norodom Sihanouk Mourning Day; Pchum Ben Day"), ("2023-10-29", "HM King Norodom Sihamoni's Coronation Day"), ("2023-11-09", "National Independence Day"), ("2023-11-26", "Water Festival"), diff --git a/tests/countries/test_germany.py b/tests/countries/test_germany.py index c38acd409..7fdcb6fad 100644 --- a/tests/countries/test_germany.py +++ b/tests/countries/test_germany.py @@ -49,7 +49,7 @@ def test_no_public_holidays_before_1990(self): self.assertNoHolidays(DE(years=1989, subdiv=p)) def test_no_by_catholic_holidays_before_1991(self): - self.assertNoHolidays(DE(subdiv="BY", years=1990, categories=(CATHOLIC))) + self.assertNoHolidays(DE(subdiv="BY", years=1990, categories=CATHOLIC)) def test_1990_present(self): y_1990 = set() @@ -337,7 +337,7 @@ def test_mariae_himmelfahrt(self): ) # Bayern (Catholic municipalities). self.assertHoliday( - DE(subdiv="BY", years=range(1991, 2050), categories=(CATHOLIC)), + DE(subdiv="BY", years=range(1991, 2050), categories=CATHOLIC), (f"{year}-08-15" for year in range(1991, 2050)), ) diff --git a/tests/countries/test_hongkong.py b/tests/countries/test_hongkong.py index 95fc29ab5..d303fa921 100644 --- a/tests/countries/test_hongkong.py +++ b/tests/countries/test_hongkong.py @@ -21,14 +21,14 @@ class TestHongKong(CommonCountryTests, TestCase): @classmethod def setUpClass(cls): super().setUpClass(HongKong, years=range(1963, 2050), years_non_observed=range(1963, 2050)) - cls.opt_holidays = HongKong(categories=(OPTIONAL,), years=range(1946, 2050)) + cls.opt_holidays = HongKong(categories=OPTIONAL, years=range(1946, 2050)) def test_country_aliases(self): self.assertAliases(HongKong, HK, HKG) def test_no_holidays(self): self.assertNoHolidays(HongKong(years=1962)) - self.assertNoHolidays(HongKong(categories=(OPTIONAL,), years=1945)) + self.assertNoHolidays(HongKong(categories=OPTIONAL, years=1945)) def test_special_holidays(self): self.assertHoliday( diff --git a/tests/countries/test_indonesia.py b/tests/countries/test_indonesia.py index 8f3123ddb..295354c78 100644 --- a/tests/countries/test_indonesia.py +++ b/tests/countries/test_indonesia.py @@ -188,8 +188,7 @@ def test_special_government(self): dt_observed = ("2020-12-31",) self.assertHoliday(Indonesia(categories=GOVERNMENT), dt, dt_observed) self.assertNoNonObservedHoliday( - Indonesia(categories=GOVERNMENT, observed=False), - dt_observed, + Indonesia(categories=GOVERNMENT, observed=False), dt_observed ) def test_new_years_day(self): diff --git a/tests/countries/test_israel.py b/tests/countries/test_israel.py index adba83ef1..59504a6b5 100644 --- a/tests/countries/test_israel.py +++ b/tests/countries/test_israel.py @@ -21,9 +21,9 @@ class TestIsrael(CommonCountryTests, TestCase): @classmethod def setUpClass(cls): super().setUpClass(Israel, years=range(1948, 2050)) - cls.opt_holidays = Israel(categories=(OPTIONAL,), years=range(2000, 2024)) + cls.opt_holidays = Israel(categories=OPTIONAL, years=range(2000, 2024)) cls.opt_holidays_non_observed = Israel( - observed=False, categories=(OPTIONAL,), years=range(2000, 2024) + observed=False, categories=OPTIONAL, years=range(2000, 2024) ) def test_country_aliases(self): @@ -143,7 +143,7 @@ def test_memorial_day(self): name, self.opt_holidays_non_observed, common_dt, non_obs_dt ) self.assertNoNonObservedHoliday(self.opt_holidays_non_observed, obs_dt) - self.assertNoHolidayName(name, Israel(categories=(OPTIONAL,), years=range(1948, 1963))) + self.assertNoHolidayName(name, Israel(categories=OPTIONAL, years=range(1948, 1963))) self.assertNoHolidayName(name) def test_optional_holidays(self): @@ -257,9 +257,9 @@ def test_taanit_ester(self): "2014-03-15", "2017-03-11", ) - school_holidays = Israel(categories=(SCHOOL,), years=range(2000, 2024)) + school_holidays = Israel(categories=SCHOOL, years=range(2000, 2024)) school_holidays_non_observed = Israel( - observed=False, categories=(SCHOOL,), years=range(2000, 2024) + observed=False, categories=SCHOOL, years=range(2000, 2024) ) self.assertHolidayName(name, school_holidays, common_dt) self.assertHolidayName(name_observed, school_holidays, obs_dt) @@ -313,7 +313,7 @@ def test_2023(self): def test_2021_optional(self): self.assertHolidays( - Israel(categories=(OPTIONAL,), years=2021), + Israel(categories=OPTIONAL, years=2021), ("2021-02-26", "פורים"), ("2021-03-29", "חול המועד פסח"), ("2021-03-30", "חול המועד פסח"), @@ -333,7 +333,7 @@ def test_2021_optional(self): def test_2022_optional(self): self.assertHolidays( - Israel(categories=(OPTIONAL,), years=2022), + Israel(categories=OPTIONAL, years=2022), ("2022-03-17", "פורים"), ("2022-04-17", "חול המועד פסח"), ("2022-04-18", "חול המועד פסח"), @@ -353,7 +353,7 @@ def test_2022_optional(self): def test_2023_optional(self): self.assertHolidays( - Israel(categories=(OPTIONAL,), years=2023), + Israel(categories=OPTIONAL, years=2023), ("2023-03-07", "פורים"), ("2023-04-07", "חול המועד פסח"), ("2023-04-08", "חול המועד פסח"), @@ -373,7 +373,7 @@ def test_2023_optional(self): def test_2021_school(self): self.assertHolidays( - Israel(categories=(SCHOOL,), years=2021), + Israel(categories=SCHOOL, years=2021), ("2021-02-25", "תענית אסתר"), ("2021-02-26", "פורים"), ("2021-03-29", "חול המועד פסח"), @@ -399,7 +399,7 @@ def test_2021_school(self): def test_2022_school(self): self.assertHolidays( - Israel(categories=(SCHOOL,), years=2022), + Israel(categories=SCHOOL, years=2022), ("2022-03-16", "תענית אסתר"), ("2022-03-17", "פורים"), ("2022-04-17", "חול המועד פסח"), @@ -425,7 +425,7 @@ def test_2022_school(self): def test_2023_school(self): self.assertHolidays( - Israel(categories=(SCHOOL,), years=2023), + Israel(categories=SCHOOL, years=2023), ("2023-03-06", "תענית אסתר"), ("2023-03-07", "פורים"), ("2023-04-07", "חול המועד פסח"), diff --git a/tests/countries/test_kazakhstan.py b/tests/countries/test_kazakhstan.py index ce0d4720f..c72d0560e 100644 --- a/tests/countries/test_kazakhstan.py +++ b/tests/countries/test_kazakhstan.py @@ -50,9 +50,7 @@ def test_nauryz(self): self.assertNoHolidayName(name, range(1991, 2002)) for year in set(range(2002, 2010)) - {2005, 2007}: self.assertNoNonObservedHoliday( - Kazakhstan(observed=False, years=year), - f"{year}-03-21", - f"{year}-03-23", + Kazakhstan(observed=False, years=year), f"{year}-03-21", f"{year}-03-23" ) def test_solidarity_day(self): diff --git a/tests/countries/test_laos.py b/tests/countries/test_laos.py index 1c931bb33..a9aaf45c1 100644 --- a/tests/countries/test_laos.py +++ b/tests/countries/test_laos.py @@ -335,10 +335,7 @@ def test_2017_workdays(self): ("2017-03-22", "ວັນສ້າງຕັ້ງພັກປະຊາຊົນປະຕິວັດລາວ"), ("2017-04-14", "ວັນສ້າງຕັ້ງສູນກາງຊາວໜຸ່ມປະຊາຊົນປະຕິວັດລາວ"), ("2017-06-01", "ວັນປູກຕົ້ນໄມ້ແຫ່ງຊາດ"), - ( - "2017-07-13", - "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ; ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ", - ), + ("2017-07-13", "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ; ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ"), ("2017-07-20", "ວັນສ້າງຕັ້ງສະຫະພັນແມ່ຍິງລາວ"), ("2017-08-13", "ວັນສື່ມວນຊົນແຫ່ງຊາດ ແລະ ວັນພິມຈໍາໜ່າຍ"), ("2017-08-15", "ວັນລັດຖະທໍາມະນູນແຫ່ງຊາດ"), @@ -355,10 +352,7 @@ def test_2022_workdays(self): ("2022-03-22", "ວັນສ້າງຕັ້ງພັກປະຊາຊົນປະຕິວັດລາວ"), ("2022-04-14", "ວັນສ້າງຕັ້ງສູນກາງຊາວໜຸ່ມປະຊາຊົນປະຕິວັດລາວ"), ("2022-06-01", "ວັນປູກຕົ້ນໄມ້ແຫ່ງຊາດ; ວັນເດັກສາກົນ"), - ( - "2022-07-13", - "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ; ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ", - ), + ("2022-07-13", "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ; ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ"), ("2022-07-20", "ວັນສ້າງຕັ້ງສະຫະພັນແມ່ຍິງລາວ"), ("2022-08-13", "ວັນສື່ມວນຊົນແຫ່ງຊາດ ແລະ ວັນພິມຈໍາໜ່າຍ"), ("2022-08-15", "ວັນລັດຖະທໍາມະນູນແຫ່ງຊາດ"), diff --git a/tests/countries/test_saint_kitts_and_nevis.py b/tests/countries/test_saint_kitts_and_nevis.py index 9dd4abbd2..b33916cfc 100644 --- a/tests/countries/test_saint_kitts_and_nevis.py +++ b/tests/countries/test_saint_kitts_and_nevis.py @@ -145,8 +145,7 @@ def test_national_heroes_day(self): def test_kim_collins_day(self): self.assertNoHoliday(SaintKittsAndNevis(categories=WORKDAY), "2002-08-25") self.assertHoliday( - SaintKittsAndNevis(categories=WORKDAY), - (f"{year}-08-25" for year in range(2003, 2051)), + SaintKittsAndNevis(categories=WORKDAY), (f"{year}-08-25" for year in range(2003, 2051)) ) def test_2015_holidays(self): # ? diff --git a/tests/countries/test_south_korea.py b/tests/countries/test_south_korea.py index 3ed9adf32..5c161462b 100644 --- a/tests/countries/test_south_korea.py +++ b/tests/countries/test_south_korea.py @@ -302,10 +302,7 @@ def test_tree_planting_day(self): self.assertNoHoliday( "1948-04-05", "1960-04-05", (f"{year}-04-05" for year in range(2006, 2050)) ) - self.assertHolidayName( - f"{name} 대체 휴일", - "1959-04-06", - ) + self.assertHolidayName(f"{name} 대체 휴일", "1959-04-06") def test_childrens_day(self): name = "어린이날" @@ -381,10 +378,7 @@ def test_constitution_day(self): self.assertNoHoliday(f"{year}-07-17" for year in range(2008, 2050)) self.assertNoHolidayName(name, range(2008, 2050)) - self.assertHolidayName( - f"{name} 대체 휴일", - "1960-07-18", - ) + self.assertHolidayName(f"{name} 대체 휴일", "1960-07-18") def test_liberation_day(self): name = "광복절" @@ -476,10 +470,7 @@ def test_armed_forces_day(self): name = "국군의 날" self.assertHolidayName(name, (f"{year}-10-01" for year in range(1976, 1991))) - self.assertHolidayName( - f"{name} 대체 휴일", - "1989-10-02", - ) + self.assertHolidayName(f"{name} 대체 휴일", "1989-10-02") self.assertNoHolidayName(f"{name} 대체 휴일", range(1976, 1989), range(1990, 1992)) def test_national_foundation_day(self): diff --git a/tests/test_docs.py b/tests/test_docs.py index da324f808..d3b16df85 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -181,8 +181,7 @@ def test_supported_countries_table(self): ( f"{c} != {s}" for c, s in zip( - supported_countries[country_code], - country_subdivisions[country_code], + supported_countries[country_code], country_subdivisions[country_code] ) if c != s ) @@ -242,9 +241,7 @@ def test_supported_markets_table(self): table_content = [ line.strip() for line in re.findall( - r"Info\s+- Supported Languages(.*)Contributions", - self.readme_content, - re.DOTALL, + r"Info\s+- Supported Languages(.*)Contributions", self.readme_content, re.DOTALL )[0].split("\n") if line ] diff --git a/tests/test_holiday_base.py b/tests/test_holiday_base.py index 4291dad84..c5563c6b1 100644 --- a/tests/test_holiday_base.py +++ b/tests/test_holiday_base.py @@ -991,8 +991,7 @@ def test_getitem(self): ) self.assertListEqual(self.hb["2014-01-01":"2013-12-24":3], [date(2014, 1, 1)]) self.assertListEqual( - self.hb["2014-01-01":"2013-12-24":7], - [date(2014, 1, 1), date(2013, 12, 25)], + self.hb["2014-01-01":"2013-12-24":7], [date(2014, 1, 1), date(2013, 12, 25)] ) self.assertListEqual(self.hb["2013-12-31":"2014-01-02":-3], []) self.assertListEqual(self.hb["2014-01-01" : "2013-12-24" : td(days=3)], [date(2014, 1, 1)]) diff --git a/tests/test_holiday_groups.py b/tests/test_holiday_groups.py index d96d89224..d30e27b7b 100644 --- a/tests/test_holiday_groups.py +++ b/tests/test_holiday_groups.py @@ -24,10 +24,7 @@ class TestChristianHolidays(TestCase): def test_check_calendar(self): - self.assertRaises( - ValueError, - lambda: ChristianHolidays("INVALID_CALENDAR"), - ) + self.assertRaises(ValueError, lambda: ChristianHolidays("INVALID_CALENDAR")) def test_add_christmas_day_three(self): class TestHolidays(HolidayBase, ChristianHolidays): @@ -60,8 +57,7 @@ def __init__(self, *args, **kwargs): self.assertIn("2022-11-20", test_holidays) self.assertEqual(1, len(test_holidays)) self.assertRaises( - ValueError, - lambda: test_holidays._add_childrens_day("Invalid", "INVALID_TYPE"), + ValueError, lambda: test_holidays._add_childrens_day("Invalid", "INVALID_TYPE") ) diff --git a/tests/test_utils.py b/tests/test_utils.py index ed2356534..51d3d431d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -188,14 +188,12 @@ def assertLocalizedEntities(self, localized_entities, supported_entities): # no def test_localized_countries(self): self.assertLocalizedEntities( - list_localized_countries(), - list_supported_countries(include_aliases=False), + list_localized_countries(), list_supported_countries(include_aliases=False) ) def test_localized_financial(self): self.assertLocalizedEntities( - list_localized_financial(), - list_supported_financial(include_aliases=False), + list_localized_financial(), list_supported_financial(include_aliases=False) ) @@ -215,10 +213,7 @@ def test_list_supported_countries(self): countries_files = [ path for path in Path("holidays/countries").glob("*.py") if path.stem != "__init__" ] - self.assertEqual( - len(countries_files), - len(supported_countries), - ) + self.assertEqual(len(countries_files), len(supported_countries)) def test_list_supported_financial(self): supported_financial = list_supported_financial(include_aliases=False) @@ -232,7 +227,4 @@ def test_list_supported_financial(self): financial_files = [ path for path in Path("holidays/financial").glob("*.py") if path.stem != "__init__" ] - self.assertEqual( - len(financial_files), - len(supported_financial), - ) + self.assertEqual(len(financial_files), len(supported_financial))