diff --git a/README.rst b/README.rst index d17c92acd..d0a6e138e 100644 --- a/README.rst +++ b/README.rst @@ -109,7 +109,7 @@ Available Countries .. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes .. _ISO 639-2 code: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes -We currently support 131 country codes. The standard way to refer to a country +We currently support 132 country codes. The standard way to refer to a country is by using its `ISO 3166-1 alpha-2 code`_, the same used for domain names, and for a subdivision its `ISO 3166-2 code`_. Some of the countries support more than one language for holiday names output. @@ -185,6 +185,10 @@ The list of supported countries, their subdivisions and supported languages - BD - - + * - Barbados + - BB + - + - * - Belarus - BY - diff --git a/holidays/countries/__init__.py b/holidays/countries/__init__.py index 3082bee05..cbc7a8310 100644 --- a/holidays/countries/__init__.py +++ b/holidays/countries/__init__.py @@ -24,6 +24,7 @@ from .azerbaijan import Azerbaijan, AZ, AZE from .bahrain import Bahrain, BH, BAH from .bangladesh import Bangladesh, BD, BGD +from .barbados import Barbados, BB, BRB from .belarus import Belarus, BY, BLR from .belgium import Belgium, BE, BEL from .belize import Belize, BZ, BLZ diff --git a/holidays/countries/barbados.py b/holidays/countries/barbados.py new file mode 100644 index 000000000..c1bb2f70b --- /dev/null +++ b/holidays/countries/barbados.py @@ -0,0 +1,70 @@ +from holidays.calendars.gregorian import JUL +from holidays.holiday_base import HolidayBase +from holidays.holiday_groups import ChristianHolidays, InternationalHolidays + + +class Barbados(HolidayBase, ChristianHolidays, InternationalHolidays): + """ + https://en.wikipedia.org/wiki/Public_holidays_in_Barbados + https://www.timeanddate.com/holidays/barbados/ + """ + + country = "BB" + + special_holidays = { + # One off 50th Anniversary of CARICOM Holiday. + # See https://tinyurl.com/brbhol + 2023: (JUL, 31, "50th Anniversary of CARICOM Holiday") + } + + def __init__(self, *args, **kwargs) -> None: + ChristianHolidays.__init__(self) + InternationalHolidays.__init__(self) + super().__init__(*args, **kwargs) + + def _populate(self, year): + super()._populate(year) + + # New Year's Day + self._add_new_years_day("New Year's Day") + + # Errol Barrow Day + self._add_holiday_jan_21("Errol Barrow Day") + + # Good Friday + self._add_good_friday("Good Friday") + + # Easter Monday + self._add_easter_monday("Easter Monday") + + # National Heroes Day + self._add_holiday_apr_28("National Heroes Day") + + # May Day + self._add_labor_day("May Day") + + # Whit Monday + self._add_whit_monday("Whit Monday") + + # Emancipation Day + self._add_holiday_aug_1("Emancipation Day") + + # Kadooment Day + self._add_holiday_1st_mon_of_aug("Kadooment Day") + + # Independence Day + self._add_holiday_nov_30("Independence Day") + + # Christmas + self._add_christmas_day("Christmas Day") + + # Boxing Day + self._add_christmas_day_two("Boxing Day") + + +class BB(Barbados): + pass + + +class BRB(Barbados): + pass diff --git a/holidays/registry.py b/holidays/registry.py index 957de7041..894490e2d 100644 --- a/holidays/registry.py +++ b/holidays/registry.py @@ -30,6 +30,7 @@ "azerbaijan": ("Azerbaijan", "AZ", "AZE"), "bahrain": ("Bahrain", "BH", "BAH"), "bangladesh": ("Bangladesh", "BD", "BGD"), + "barbados": ("Barbados", "BB", "BRB"), "belarus": ("Belarus", "BY", "BLR"), "belgium": ("Belgium", "BE", "BEL"), "belize": ("Belize", "BZ", "BLZ"), diff --git a/tests/countries/test_barbados.py b/tests/countries/test_barbados.py new file mode 100644 index 000000000..9c85ad0b7 --- /dev/null +++ b/tests/countries/test_barbados.py @@ -0,0 +1,46 @@ +# python-holidays +# --------------- +# A fast, efficient Python library for generating country, province and state +# specific sets of holidays on the fly. It aims to make determining whether a +# specific date is a holiday as fast and flexible as possible. +# +# Authors: dr-prodigy (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +from holidays.countries.barbados import Barbados, BB, BRB +from tests.common import TestCase + + +class TestBarbados(TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass(Barbados) + + def test_country_aliases(self): + self.assertCountryAliases(Barbados, BB, BRB) + + def test_special_holidays(self): + self.assertHoliday("2023-07-31") + + def test_2023(self): + self.assertHolidays( + ("2023-01-01", "New Year's Day"), + ("2023-01-21", "Errol Barrow Day"), + ("2023-04-07", "Good Friday"), + ("2023-04-10", "Easter Monday"), + ("2023-04-28", "National Heroes Day"), + ("2023-05-01", "May Day"), + ("2023-05-29", "Whit Monday"), + ("2023-07-31", "50th Anniversary of CARICOM Holiday"), + ("2023-08-01", "Emancipation Day"), + ("2023-08-07", "Kadooment Day"), + ("2023-11-30", "Independence Day"), + ("2023-12-25", "Christmas Day"), + ("2023-12-26", "Boxing Day"), + ) + + def test_2024(self): + self.assertNoHoliday("2024-07-31") + self.assertNoHolidayName("50th Anniversary of CARICOM Holiday", Barbados(years=2024))