diff --git a/README.rst b/README.rst index d17c92acd..c7e2b0f7f 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. @@ -637,6 +637,10 @@ The list of supported countries, their subdivisions and supported languages - UZ - - + * - Vanuatu + - VU + - + - * - Vatican City - VA - diff --git a/holidays/countries/__init__.py b/holidays/countries/__init__.py index 3082bee05..7aead73d2 100644 --- a/holidays/countries/__init__.py +++ b/holidays/countries/__init__.py @@ -142,6 +142,7 @@ from .united_states_virgin_islands import UnitedStatesVirginIslands, VI, VIR, HolidaysVI from .uruguay import Uruguay, UY, URY from .uzbekistan import Uzbekistan, UZ, UZB +from .vanuatu import Vanuatu, VU, VTU from .vatican_city import VaticanCity, VA, VAT from .venezuela import Venezuela, VE, VEN from .vietnam import Vietnam, VN, VNM diff --git a/holidays/countries/vanuatu.py b/holidays/countries/vanuatu.py new file mode 100644 index 000000000..08062dee3 --- /dev/null +++ b/holidays/countries/vanuatu.py @@ -0,0 +1,87 @@ +# 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.calendars.gregorian import FEB, MAR, JUL, OCT, NOV +from holidays.holiday_base import HolidayBase +from holidays.holiday_groups import ChristianHolidays, InternationalHolidays + + +class Vanuatu(HolidayBase, ChristianHolidays, InternationalHolidays): + """ + https://en.wikipedia.org/wiki/Public_holidays_in_Vanuatu + https://www.timeanddate.com/holidays/vanuatu/ + https://www.gov.vu/index.php/events/holidays + """ + + country = "VU" + + def __init__(self, *args, **kwargs): + ChristianHolidays.__init__(self) + InternationalHolidays.__init__(self) + super().__init__(*args, **kwargs) + + def _populate(self, year): + # On 30 July 1980, Vanuatu gained independence from Britain and France. + if year <= 1980: + return None + + super()._populate(year) + + # New Years Day. + self._add_new_years_day("New Year's Day") + + if year >= 1991: + # Father Lini Day + self._add_holiday("Father Lini Day", FEB, 21) + + # Custom Chief's Day + self._add_holiday("Custom Chief's Day", MAR, 5) + + # Good Friday + self._add_good_friday("Good Friday") + + # Easter Monday + self._add_easter_monday("Easter Monday") + + # Labour Day + self._add_labor_day("Labour Day") + + # Ascension Day + self._add_ascension_thursday("Ascension Day") + + # Children's Day + self._add_holiday("Children's Day", JUL, 24) + + # Independence Day + self._add_holiday("Independence Day", JUL, 30) + + # Assumption Day + self._add_assumption_of_mary_day("Assumption Day") + + # Constitution Day + self._add_holiday("Constitution Day", OCT, 5) + + # National Unity Day + self._add_holiday("National Unity Day", NOV, 29) + + # Christmas Day + self._add_christmas_day("Christmas Day") + + # Family day + self._add_christmas_day_two("Family Day") + + +class VU(Vanuatu): + pass + + +class VTU(Vanuatu): + pass diff --git a/holidays/registry.py b/holidays/registry.py index 957de7041..d8f1e74a6 100644 --- a/holidays/registry.py +++ b/holidays/registry.py @@ -148,6 +148,7 @@ "united_states": ("UnitedStates", "US", "USA"), "uruguay": ("Uruguay", "UY", "URY"), "uzbekistan": ("Uzbekistan", "UZ", "UZB"), + "vanuatu": ("Vanuatu", "VU", "VTU"), "vatican_city": ("VaticanCity", "VA", "VAT"), "venezuela": ("Venezuela", "VE", "VEN"), "vietnam": ("Vietnam", "VN", "VNM"), diff --git a/tests/countries/test_vanuatu.py b/tests/countries/test_vanuatu.py new file mode 100644 index 000000000..a34f614f4 --- /dev/null +++ b/tests/countries/test_vanuatu.py @@ -0,0 +1,49 @@ +# 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.vanuatu import Vanuatu, VU, VTU +from tests.common import TestCase + + +class TestVanuatu(TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass(Vanuatu) + + def test_country_aliases(self): + self.assertCountryAliases(Vanuatu, VU, VTU) + + def test_no_holidays(self): + self.assertNoHolidays(Vanuatu(years=1980)) + + def test_father_lini_day(self): + name = "Father Lini Day" + self.assertHolidayName(name, (f"{year}-02-21" for year in range(1991, 2050))) + self.assertNoHolidayName(name, Vanuatu(years=range(1981, 1991))) + self.assertNoHoliday(f"{year}-02-21" for year in range(1981, 1991)) + + def test_2022(self): + self.assertHolidays( + ("2022-01-01", "New Year's Day"), + ("2022-02-21", "Father Lini Day"), + ("2022-03-05", "Custom Chief's Day"), + ("2022-04-15", "Good Friday"), + ("2022-04-18", "Easter Monday"), + ("2022-05-01", "Labour Day"), + ("2022-05-26", "Ascension Day"), + ("2022-07-24", "Children's Day"), + ("2022-07-30", "Independence Day"), + ("2022-08-15", "Assumption Day"), + ("2022-10-05", "Constitution Day"), + ("2022-11-29", "National Unity Day"), + ("2022-12-25", "Christmas Day"), + ("2022-12-26", "Family Day"), + )