-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding vanuatu * comment changes * father lini day
- Loading branch information
1 parent
03592f4
commit a64a1e7
Showing
5 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <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.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <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_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"), | ||
) |