Skip to content
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 Malta #179

Merged
merged 3 commits into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CHANGELOG
=========

- Add Malta. thx @gregn610 (#179)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may want to add the header as for the others:

master (unreleased)
-------------------


1.0.0 (2016-12-12)
------------------

Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Europe
* Ireland
* Italy
* Luxembourg
* Malta
* Netherlands
* Norway
* Poland
Expand Down
2 changes: 2 additions & 0 deletions workalendar/europe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .ireland import Ireland
from .italy import Italy
from .luxembourg import Luxembourg
from .malta import Malta
from .netherlands import Netherlands
from .norway import Norway
from .poland import Poland
Expand Down Expand Up @@ -54,6 +55,7 @@
Ireland,
Italy,
Luxembourg,
Malta,
Netherlands,
Norway,
Poland,
Expand Down
26 changes: 26 additions & 0 deletions workalendar/europe/malta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
from workalendar.core import WesternCalendar, ChristianMixin


class Malta(WesternCalendar, ChristianMixin):
"Malta"

include_good_friday = True
include_assumption = True
include_immaculate_conception = True
include_christmas = True

FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
# National Holidays
(3, 31, "Freedom Day"), # (Jum il-Ħelsien)
(6, 7, "Sette Giugno"),
(9, 8, "Victory Day"), # (Jum il-Vitorja)
(9, 21, "Independence Day"), # (Jum l-Indipendenza)
(12, 13, "Republic Day"), # (Jum ir-Repubblika)
# Public Holidays
(1, 1, "New Year's Day"), # (L-Ewwel tas-Sena)
(2, 10, "Feast of Saint Paul's Shipwreck"),
(3, 19, "Feast of Saint Joseph"), # (San Ġużepp)
(5, 1, "Worker's Day"), # (Jum il-Ħaddiem)
(6, 29, "Feast of Saint Peter & Saint Paul"), # (L-Imnarja)
)
25 changes: 25 additions & 0 deletions workalendar/tests/test_europe.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from workalendar.europe import Ireland
from workalendar.europe import Italy
from workalendar.europe import Luxembourg
from workalendar.europe import Malta
from workalendar.europe import Netherlands
from workalendar.europe import Norway
from workalendar.europe import Poland
Expand Down Expand Up @@ -355,6 +356,30 @@ def test_year_2013(self):
self.assertIn(date(2013, 12, 26), holidays) # Second day of XMas


class MaltaTest(GenericCalendarTest):
"""Rollover rules changed in 2005"""
cal_class = Malta

def test_year_2017(self):
holidays = self.cal.holidays_set(2017)
# National Holidays
self.assertIn(date(2017, 3, 31), holidays) # Jum il-Ħelsien
self.assertIn(date(2017, 6, 7), holidays) # Sette Giugno
self.assertIn(date(2017, 9, 8), holidays) # Jum il-Vitorja
self.assertIn(date(2017, 9, 21), holidays) # Jum l-Indipendenza
self.assertIn(date(2017, 12, 13), holidays) # Jum ir-Repubblika
# Public Holidays
self.assertIn(date(2017, 1, 1), holidays) # L-Ewwel tas-Sena
self.assertIn(date(2017, 2, 10), holidays) # Nawfraġju ta' San Pawl
self.assertIn(date(2017, 3, 19), holidays) # San Ġużepp
self.assertIn(date(2017, 4, 14), holidays) # Il-Ġimgħa l-Kbira
self.assertIn(date(2017, 5, 1), holidays) # Jum il-Ħaddiem
self.assertIn(date(2017, 6, 29), holidays) # L-Imnarja
self.assertIn(date(2017, 8, 15), holidays) # Santa Marija
self.assertIn(date(2017, 12, 8), holidays) # Il-Kunċizzjoni
self.assertIn(date(2017, 12, 25), holidays) # Il-Milied


class NorwayTest(GenericCalendarTest):
cal_class = Norway

Expand Down