-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Vanuatu holidays #1423
Add Vanuatu holidays #1423
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,88 @@ | ||||||||||||
# 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 <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||||||||||||
# ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||||||||||||
# Website: https://github.com/dr-prodigy/python-holidays | ||||||||||||
# License: MIT (see LICENSE file) | ||||||||||||
|
||||||||||||
from holidays.constants import FEB, MAR, JUL, OCT, NOV, DEC | ||||||||||||
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) | ||||||||||||
|
||||||||||||
if year >= 1981: | ||||||||||||
# Independence Day | ||||||||||||
self._add_holiday("Independence Day", JUL, 30) | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
As we have no holidays until 1981. |
||||||||||||
|
||||||||||||
# 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_holiday("Family Day", DEC, 26) | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
||||||||||||
|
||||||||||||
class VU(Vanuatu): | ||||||||||||
pass | ||||||||||||
|
||||||||||||
|
||||||||||||
class VTU(Vanuatu): | ||||||||||||
pass |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,55 @@ | ||||||||||||||||||||||||||
# 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 <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||||||||||||||||||||||||||
# ryanss <ryanssdev@icloud.com> (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_fater_lina_day(self): | ||||||||||||||||||||||||||
name = "Father Lini Day" | ||||||||||||||||||||||||||
self.assertHolidayName(name, (f"{year}-2-21" for year in range(1991, 2050))) | ||||||||||||||||||||||||||
self.assertNoHolidayName(name, Vanuatu(years=range(1981, 1991))) | ||||||||||||||||||||||||||
self.assertNoHoliday( | ||||||||||||||||||||||||||
f"{year}-2-21" for year in set(range(1981, 1991)).difference({1982, 1984, 2085}) | ||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I don't see any reasons for exceptions for 1982, 1984. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I copied a code from another country and forgot to change it. Sorry |
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def test_independence_day(self): | ||||||||||||||||||||||||||
name = "Independence Day" | ||||||||||||||||||||||||||
self.assertHolidayName(name, (f"{year}-07-30" for year in range(1981, 2050))) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
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"), | ||||||||||||||||||||||||||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.