From da8fbb5e671ec11192a555da3d7dd4913f77283e Mon Sep 17 00:00:00 2001 From: PPsyrius <19505219+PPsyrius@users.noreply.github.com> Date: Wed, 27 Sep 2023 11:10:24 +0700 Subject: [PATCH] [LA] Implementing Suggestions 20230926 Co-Authored-By: ~Jhellico --- holidays/calendars/thai.py | 2 +- holidays/countries/laos.py | 39 +++++++++++-------------- snapshots/countries/LA.json | 55 ++++++++++++++---------------------- tests/countries/test_laos.py | 41 ++++++++++++++++++++++----- 4 files changed, 73 insertions(+), 64 deletions(-) diff --git a/holidays/calendars/thai.py b/holidays/calendars/thai.py index 2fda87e2a..68cc78b38 100644 --- a/holidays/calendars/thai.py +++ b/holidays/calendars/thai.py @@ -396,7 +396,7 @@ def atthami_bucha_date(self, year: int, calendar=None) -> Optional[date]: else +169 ) - def asarnha_bucha_date(self, year: int, calendar=None) -> Optional[date]: + def asarnha_bucha_date(self, year: int) -> Optional[date]: """ Calculate the estimated Gregorian date of Asarnha Bucha. If the Gregorian year input is invalid, this will outputs None instead. diff --git a/holidays/countries/laos.py b/holidays/countries/laos.py index fb2e62160..9ea629d9c 100644 --- a/holidays/countries/laos.py +++ b/holidays/countries/laos.py @@ -9,7 +9,6 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) -from datetime import date from gettext import gettext as tr from holidays.calendars.gregorian import JAN, MAR, APR, MAY, JUL, OCT, DEC @@ -138,10 +137,7 @@ class Laos(ObservedHolidayBase, InternationalHolidays, ThaiCalendarHolidays): def __init__(self, *args, **kwargs): InternationalHolidays.__init__(self) ThaiCalendarHolidays.__init__(self, KHMER_CALENDAR) - super().__init__(observed_rule=SAT_SUN_TO_NEXT_MON, *args, **kwargs) - - def _is_observed(self, dt: date) -> bool: - return self._year >= 2018 + super().__init__(observed_rule=SAT_SUN_TO_NEXT_MON, observed_since=2018, *args, **kwargs) def _populate_bank_holidays(self): # Based on both LSX and BCEL calendar. @@ -170,7 +166,7 @@ def _populate_bank_holidays(self): # Lao Year-End Bank Holiday. year_end_bank_holiday = tr("ສາມວັນລັດຖະການສຸດທ້າຍຂອງທຸກໆປີ") - dec_31 = date(self._year, DEC, 31) + dec_31 = (DEC, 31) if self._is_monday(dec_31): self._add_holiday_last_thu_of_dec(year_end_bank_holiday) self._add_holiday_last_fri_of_dec(year_end_bank_holiday) @@ -213,6 +209,11 @@ def _populate_public_holidays(self): # ບຸນປີໃໝ່ລາວ # Status: In-Use. # Celebrated for 3 days from 14-16 April annualy. + # Observed dates prior to 2018 are assigned manually. + # - CASE 1: THU-FRI-SAT -> in-lieu on MON. + # - CASE 2: FRI-SAT-SUN -> in-lieu on MON-TUE. + # - CASE 3: SAT-SUN-MON -> in-lieu on TUE-WED. + # - CASE 4: SUN-MON-TUE -> in-lieu on WED. # Lao New Year's Day. name = tr("ບຸນປີໃໝ່ລາວ") @@ -220,16 +221,8 @@ def _populate_public_holidays(self): self._add_holiday_apr_15(name) self._add_holiday_apr_16(name) - # ພັກຊົດເຊີຍບຸນປີໃໝ່ລາວ - # Dates prior to 2018 are assigned manually - # Status: In-Use. - # - CASE 1: THU-FRI-SAT -> in-lieu on MON. - # - CASE 2: FRI-SAT-SUN -> in-lieu on MON-TUE. - # - CASE 3: SAT-SUN-MON -> in-lieu on TUE-WED. - # - CASE 4: SUN-MON-TUE -> in-lieu on WED. - if self._year >= 2018: - self._add_observed(dt, rule=THU_FRI_SAT_TO_NEXT_MON_TUE) - self._add_observed(dt, rule=FRI_SAT_SUN_TO_NEXT_TUE_WED) + self._add_observed(dt, rule=THU_FRI_SAT_TO_NEXT_MON_TUE) + self._add_observed(dt, rule=FRI_SAT_SUN_TO_NEXT_TUE_WED) # ວັນກຳມະກອນສາກົນ # Status: In-Use. @@ -380,10 +373,11 @@ def _populate_workday_holidays(self): # ວັນປູກຕົ້ນໄມ້ແຫ່ງຊາດ # Status: In-Use. - # No information on when this was first observed is available in Thai or English sources. + # Assumed to first observed in 1989 following the National Forestry Conference in May. - # National Arbor Day. - self._add_holiday_jun_1(tr("ວັນປູກຕົ້ນໄມ້ແຫ່ງຊາດ")) + if self._year >= 1989: + # National Arbor Day. + self._add_holiday_jun_1(tr("ວັນປູກຕົ້ນໄມ້ແຫ່ງຊາດ")) # ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ # Status: In-Use. @@ -394,10 +388,11 @@ def _populate_workday_holidays(self): # ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ # Status: In-Use. - # No information on when this was first observed is available in Thai or English sources. + # First designated in 1997 to concide with Souphanouvong's Birthday anniversary. - # The National Day for Wildlife and Aquatic Animal Conservation. - self._add_holiday_jul_13(tr("ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ")) + if self._year >= 1997: + # The National Day for Wildlife and Aquatic Animal Conservation. + self._add_holiday_jul_13(tr("ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ")) # ວັນສ້າງຕັ້ງສະຫະພັນແມ່ຍິງລາວ # Status: In-Use. diff --git a/snapshots/countries/LA.json b/snapshots/countries/LA.json index b7eda3339..86d6e682a 100644 --- a/snapshots/countries/LA.json +++ b/snapshots/countries/LA.json @@ -10,9 +10,8 @@ "1976-04-16": "Lao New Year's Day", "1976-05-01": "Labor Day", "1976-05-13": "Visakha Bousa Festival", - "1976-06-01": "National Arbor Day", "1976-07-11": "Begin of Buddhist Lent", - "1976-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1976-07-13": "President Souphanouvong's Birthday", "1976-07-20": "Establishment Day of the Lao Women's Union", "1976-08-13": "Lao National Mass Media and Publishing Day", "1976-08-23": "National Uprising Day", @@ -38,8 +37,7 @@ "1977-04-16": "Lao New Year's Day", "1977-05-01": "Labor Day", "1977-05-02": "Visakha Bousa Festival", - "1977-06-01": "National Arbor Day", - "1977-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1977-07-13": "President Souphanouvong's Birthday", "1977-07-20": "Establishment Day of the Lao Women's Union", "1977-07-30": "Begin of Buddhist Lent", "1977-08-13": "Lao National Mass Media and Publishing Day", @@ -66,8 +64,7 @@ "1978-04-16": "Lao New Year's Day", "1978-05-01": "Labor Day", "1978-05-21": "Visakha Bousa Festival", - "1978-06-01": "National Arbor Day", - "1978-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1978-07-13": "President Souphanouvong's Birthday", "1978-07-19": "Begin of Buddhist Lent", "1978-07-20": "Establishment Day of the Lao Women's Union", "1978-08-13": "Lao National Mass Media and Publishing Day", @@ -94,9 +91,8 @@ "1979-04-16": "Lao New Year's Day", "1979-05-01": "Labor Day", "1979-05-10": "Visakha Bousa Festival", - "1979-06-01": "National Arbor Day", "1979-07-09": "Begin of Buddhist Lent", - "1979-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1979-07-13": "President Souphanouvong's Birthday", "1979-07-20": "Establishment Day of the Lao Women's Union", "1979-08-13": "Lao National Mass Media and Publishing Day", "1979-08-22": "Boun Haw Khao Padapdin", @@ -120,8 +116,7 @@ "1980-04-16": "Lao New Year's Day", "1980-04-29": "Visakha Bousa Festival", "1980-05-01": "Labor Day", - "1980-06-01": "National Arbor Day", - "1980-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1980-07-13": "President Souphanouvong's Birthday", "1980-07-20": "Establishment Day of the Lao Women's Union", "1980-07-27": "Begin of Buddhist Lent", "1980-08-13": "Lao National Mass Media and Publishing Day", @@ -148,8 +143,7 @@ "1981-04-16": "Lao New Year's Day", "1981-05-01": "Labor Day", "1981-05-18": "Visakha Bousa Festival", - "1981-06-01": "National Arbor Day", - "1981-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1981-07-13": "President Souphanouvong's Birthday", "1981-07-16": "Begin of Buddhist Lent", "1981-07-20": "Establishment Day of the Lao Women's Union", "1981-08-13": "Lao National Mass Media and Publishing Day", @@ -176,9 +170,8 @@ "1982-04-16": "Lao New Year's Day", "1982-05-01": "Labor Day", "1982-05-07": "Visakha Bousa Festival", - "1982-06-01": "National Arbor Day", "1982-07-05": "Begin of Buddhist Lent", - "1982-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1982-07-13": "President Souphanouvong's Birthday", "1982-07-20": "Establishment Day of the Lao Women's Union", "1982-08-13": "Lao National Mass Media and Publishing Day", "1982-08-18": "Boun Haw Khao Padapdin", @@ -204,8 +197,7 @@ "1983-04-16": "Lao New Year's Day", "1983-04-26": "Visakha Bousa Festival", "1983-05-01": "Labor Day", - "1983-06-01": "National Arbor Day", - "1983-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1983-07-13": "President Souphanouvong's Birthday", "1983-07-20": "Establishment Day of the Lao Women's Union", "1983-07-24": "Begin of Buddhist Lent", "1983-08-13": "Lao National Mass Media and Publishing Day", @@ -232,9 +224,8 @@ "1984-04-16": "Lao New Year's Day", "1984-05-01": "Labor Day", "1984-05-14": "Visakha Bousa Festival", - "1984-06-01": "National Arbor Day", "1984-07-12": "Begin of Buddhist Lent", - "1984-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1984-07-13": "President Souphanouvong's Birthday", "1984-07-20": "Establishment Day of the Lao Women's Union", "1984-08-13": "Lao National Mass Media and Publishing Day", "1984-08-23": "National Uprising Day", @@ -260,8 +251,7 @@ "1985-04-16": "Lao New Year's Day", "1985-05-01": "Labor Day", "1985-05-03": "Visakha Bousa Festival", - "1985-06-01": "National Arbor Day", - "1985-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1985-07-13": "President Souphanouvong's Birthday", "1985-07-20": "Establishment Day of the Lao Women's Union", "1985-07-31": "Begin of Buddhist Lent", "1985-08-13": "Lao National Mass Media and Publishing Day", @@ -288,8 +278,7 @@ "1986-04-16": "Lao New Year's Day", "1986-05-01": "Labor Day", "1986-05-22": "Visakha Bousa Festival", - "1986-06-01": "National Arbor Day", - "1986-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1986-07-13": "President Souphanouvong's Birthday", "1986-07-20": "Begin of Buddhist Lent; Establishment Day of the Lao Women's Union", "1986-08-13": "Lao National Mass Media and Publishing Day", "1986-08-23": "National Uprising Day", @@ -315,9 +304,8 @@ "1987-04-16": "Lao New Year's Day", "1987-05-01": "Labor Day", "1987-05-11": "Visakha Bousa Festival", - "1987-06-01": "National Arbor Day", "1987-07-10": "Begin of Buddhist Lent", - "1987-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1987-07-13": "President Souphanouvong's Birthday", "1987-07-20": "Establishment Day of the Lao Women's Union", "1987-08-13": "Lao National Mass Media and Publishing Day", "1987-08-23": "Boun Haw Khao Padapdin; National Uprising Day", @@ -341,8 +329,7 @@ "1988-04-16": "Lao New Year's Day", "1988-04-30": "Visakha Bousa Festival", "1988-05-01": "Labor Day", - "1988-06-01": "National Arbor Day", - "1988-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1988-07-13": "President Souphanouvong's Birthday", "1988-07-20": "Establishment Day of the Lao Women's Union", "1988-07-28": "Begin of Buddhist Lent", "1988-08-13": "Lao National Mass Media and Publishing Day", @@ -370,7 +357,7 @@ "1989-05-01": "Labor Day", "1989-05-19": "Visakha Bousa Festival", "1989-06-01": "National Arbor Day", - "1989-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1989-07-13": "President Souphanouvong's Birthday", "1989-07-17": "Begin of Buddhist Lent", "1989-07-20": "Establishment Day of the Lao Women's Union", "1989-08-13": "Lao National Mass Media and Publishing Day", @@ -399,7 +386,7 @@ "1990-05-08": "Visakha Bousa Festival", "1990-06-01": "International Children Day; National Arbor Day", "1990-07-07": "Begin of Buddhist Lent", - "1990-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1990-07-13": "President Souphanouvong's Birthday", "1990-07-20": "Establishment Day of the Lao Women's Union", "1990-08-13": "Lao National Mass Media and Publishing Day", "1990-08-20": "Boun Haw Khao Padapdin", @@ -426,7 +413,7 @@ "1991-04-28": "Visakha Bousa Festival", "1991-05-01": "Labor Day", "1991-06-01": "International Children Day; National Arbor Day", - "1991-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1991-07-13": "President Souphanouvong's Birthday", "1991-07-20": "Establishment Day of the Lao Women's Union", "1991-07-26": "Begin of Buddhist Lent", "1991-08-13": "Lao National Mass Media and Publishing Day", @@ -456,7 +443,7 @@ "1992-05-01": "Labor Day", "1992-05-16": "Visakha Bousa Festival", "1992-06-01": "International Children Day; National Arbor Day", - "1992-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1992-07-13": "President Souphanouvong's Birthday", "1992-07-14": "Begin of Buddhist Lent", "1992-07-20": "Establishment Day of the Lao Women's Union", "1992-08-13": "Lao National Mass Media and Publishing Day", @@ -486,7 +473,7 @@ "1993-05-05": "Visakha Bousa Festival", "1993-06-01": "International Children Day; National Arbor Day", "1993-07-03": "Begin of Buddhist Lent", - "1993-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1993-07-13": "President Souphanouvong's Birthday", "1993-07-20": "Establishment Day of the Lao Women's Union", "1993-08-13": "Lao National Mass Media and Publishing Day", "1993-08-15": "Lao National Constitution Day", @@ -515,7 +502,7 @@ "1994-04-24": "Visakha Bousa Festival", "1994-05-01": "Labor Day", "1994-06-01": "International Children Day; National Arbor Day", - "1994-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1994-07-13": "President Souphanouvong's Birthday", "1994-07-20": "Establishment Day of the Lao Women's Union", "1994-07-22": "Begin of Buddhist Lent", "1994-08-13": "Lao National Mass Media and Publishing Day", @@ -546,7 +533,7 @@ "1995-05-13": "Visakha Bousa Festival", "1995-06-01": "International Children Day; National Arbor Day", "1995-07-11": "Begin of Buddhist Lent", - "1995-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1995-07-13": "President Souphanouvong's Birthday", "1995-07-20": "Establishment Day of the Lao Women's Union", "1995-08-13": "Lao National Mass Media and Publishing Day", "1995-08-15": "Lao National Constitution Day", @@ -574,7 +561,7 @@ "1996-04-16": "Lao New Year's Day", "1996-05-01": "Labor Day; Visakha Bousa Festival", "1996-06-01": "International Children Day; National Arbor Day", - "1996-07-13": "President Souphanouvong's Birthday; The National Day for Wildlife and Aquatic Animal Conservation", + "1996-07-13": "President Souphanouvong's Birthday", "1996-07-20": "Establishment Day of the Lao Women's Union", "1996-07-29": "Begin of Buddhist Lent", "1996-08-13": "Lao National Mass Media and Publishing Day", diff --git a/tests/countries/test_laos.py b/tests/countries/test_laos.py index 8d3f8c116..f9023091f 100644 --- a/tests/countries/test_laos.py +++ b/tests/countries/test_laos.py @@ -199,6 +199,21 @@ def test_2023_school_holiday(self): ("2023-11-27", "ວັນບຸນທາດຫລວງ"), ) + def test_1988_workday(self): + # Prior to National Arbor Day creation in 1989. + self.assertHolidays( + Laos(categories=(WORKDAY,), years=1988), + ("1988-01-20", "ວັນສ້າງຕັ້ງກອງທັບປະຊາຊົນລາວ"), + ("1988-02-01", "ວັນສ້າງຕັ້ງສະຫະພັນກໍາມະບານລາວ"), + ("1988-03-22", "ວັນສ້າງຕັ້ງພັກປະຊາຊົນປະຕິວັດລາວ"), + ("1988-04-14", "ວັນສ້າງຕັ້ງສູນກາງຊາວໜຸ່ມປະຊາຊົນປະຕິວັດລາວ"), + ("1988-07-13", "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ"), + ("1988-07-20", "ວັນສ້າງຕັ້ງສະຫະພັນແມ່ຍິງລາວ"), + ("1988-08-13", "ວັນສື່ມວນຊົນແຫ່ງຊາດ ແລະ ວັນພິມຈໍາໜ່າຍ"), + ("1988-08-23", "ວັນຍຶດອຳນາດທົ່ວປະເທດ"), + ("1988-10-12", "ວັນປະກາດເອກະລາດ"), + ) + def test_1990_workday(self): # Prior to Kaysone Phomvihane's Presidency and 1991 Constitution Adoption. self.assertHolidays( @@ -208,19 +223,31 @@ def test_1990_workday(self): ("1990-03-22", "ວັນສ້າງຕັ້ງພັກປະຊາຊົນປະຕິວັດລາວ"), ("1990-04-14", "ວັນສ້າງຕັ້ງສູນກາງຊາວໜຸ່ມປະຊາຊົນປະຕິວັດລາວ"), ("1990-06-01", "ວັນປູກຕົ້ນໄມ້ແຫ່ງຊາດ"), - ( - "1990-07-13", - ( - "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ; " - "ວັນປ່ອຍປາ ແລະ ວັນອະນຸລັກສັດນ້ຳ-ສັດປ່າແຫ່ງຊາດ" - ), - ), + ("1990-07-13", "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ"), ("1990-07-20", "ວັນສ້າງຕັ້ງສະຫະພັນແມ່ຍິງລາວ"), ("1990-08-13", "ວັນສື່ມວນຊົນແຫ່ງຊາດ ແລະ ວັນພິມຈໍາໜ່າຍ"), ("1990-08-23", "ວັນຍຶດອຳນາດທົ່ວປະເທດ"), ("1990-10-12", "ວັນປະກາດເອກະລາດ"), ) + def test_1996_workday(self): + # Prior to 1997's Lao Wildlife Conservation Day Designation. + self.assertHolidays( + Laos(categories=(WORKDAY,), years=1996), + ("1996-01-20", "ວັນສ້າງຕັ້ງກອງທັບປະຊາຊົນລາວ"), + ("1996-02-01", "ວັນສ້າງຕັ້ງສະຫະພັນກໍາມະບານລາວ"), + ("1996-03-22", "ວັນສ້າງຕັ້ງພັກປະຊາຊົນປະຕິວັດລາວ"), + ("1996-04-14", "ວັນສ້າງຕັ້ງສູນກາງຊາວໜຸ່ມປະຊາຊົນປະຕິວັດລາວ"), + ("1996-06-01", "ວັນປູກຕົ້ນໄມ້ແຫ່ງຊາດ"), + ("1996-07-13", "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ສຸພານຸວົງ"), + ("1996-07-20", "ວັນສ້າງຕັ້ງສະຫະພັນແມ່ຍິງລາວ"), + ("1996-08-13", "ວັນສື່ມວນຊົນແຫ່ງຊາດ ແລະ ວັນພິມຈໍາໜ່າຍ"), + ("1996-08-15", "ວັນລັດຖະທໍາມະນູນແຫ່ງຊາດ"), + ("1996-08-23", "ວັນຍຶດອຳນາດທົ່ວປະເທດ"), + ("1996-10-12", "ວັນປະກາດເອກະລາດ"), + ("1996-12-13", "ວັນຄ້າຍວັນເກີດ ທ່ານ ປະທານ ໄກສອນ ພົມວິຫານ"), + ) + def test_2017_workday(self): # Prior to 2018 International Children's Day is in `PUBLIC` category self.assertHolidays(