Repository: peopledoc/workalendar
Pull request #259 (2018-03-17 14:39:40)

[Feat] add russia calendar holidays (add-russia)
refs #196 

<!-- if your contribution is a new calendar -->

For information, read and make sure you're okay with the [CONTRIBUTING document](https://github.com/novafloss/workalendar/blob/master/CONTRIBUTING.rst#adding-new-calendars).

- [x] Tests with a significant number of years to be tested for your calendar.
- [x] Docstrings for the Calendar class and specific methods.
- [x] Calendar country / label added to the README.rst file,
- [x] Changelog amended with a mention like: "Added ``<country>`` by ``@pseudo`` (#)"

<!-- if your contribution is a fix -->

- [ ] Tests with a significant number of years to be tested for your calendar.
- [ ] Changelog amended with a mention describing your changes.



Patch:
diff --git a/CHANGELOG b/CHANGELOG
index 4caf906..390b10b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,7 @@ master (unreleased)
 - Update ACT holidays( #251)
 - First step iteration on the "global registry" feature. European countries are now part of a registry loaded in the ``workalenda.registry`` module. Please use with care at the moment (#248).
 - Moved from `novafloss` to the `peopledoc` organization, the core People Doc Inc. organization (#255)
+- Added Russia, by @vanadium23 (#259)
 
 
 2.3.1 (2017-07-27)
diff --git a/README.rst b/README.rst
index b231e0b..17e6262 100644
--- a/README.rst
+++ b/README.rst
@@ -100,6 +100,7 @@ Europe
 * Poland
 * Portugal
 * Romania
+* Russia
 * Slovakia
 * Sweden
 * United Kingdom (incl. Northern Ireland)
diff --git a/workalendar/europe/__init__.py b/workalendar/europe/__init__.py
index 0eb7fb8..fab0548 100644
--- a/workalendar/europe/__init__.py
+++ b/workalendar/europe/__init__.py
@@ -23,6 +23,7 @@ from .norway import Norway
 from .poland import Poland
 from .portugal import Portugal
 from .romania import Romania
+from .russia import Russia
 from .slovakia import Slovakia
 from .slovenia import Slovenia
 from .spain import Spain, Catalonia
@@ -66,6 +67,7 @@ __all__ = (
     'Poland',
     'Portugal',
     'Romania',
+    'Russia',
     'Slovakia',
     'Slovenia',
     'Spain',
diff --git a/workalendar/europe/russia.py b/workalendar/europe/russia.py
new file mode 100644
index 0000000..ce673c1
--- /dev/null
+++ b/workalendar/europe/russia.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+from workalendar.core import WesternCalendar
+from workalendar.registry import iso_register
+
+
+@iso_register('RU')
+class Russia(WesternCalendar):
+    name = 'Russia'
+
+    shift_new_years_day = True
+
+    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
+        (1, 2, "Day After New Year"),
+        (1, 7, "Christmas"),
+        (2, 23, "Defendence of the Fatherland"),
+        (3, 8, "International Women's Day"),
+        (5, 1, "Labour Day"),
+        (5, 9, "Victory Day"),
+        (6, 12, "National Day"),
+        (11, 5, "Day of Unity"),
+    )


Test patch:
diff --git a/workalendar/tests/test_europe.py b/workalendar/tests/test_europe.py
index 12f69e2..41164db 100644
--- a/workalendar/tests/test_europe.py
+++ b/workalendar/tests/test_europe.py
@@ -28,6 +28,7 @@ from workalendar.europe import Norway
 from workalendar.europe import Poland
 from workalendar.europe import Portugal
 from workalendar.europe import Romania
+from workalendar.europe import Russia
 from workalendar.europe import Spain, Catalonia
 from workalendar.europe import Slovenia
 from workalendar.europe import Switzerland, Vaud
@@ -680,6 +681,22 @@ class Romania(GenericCalendarTest):
         self.assertIn(date(2017, 12, 26), holidays)  # Crăciunul Christmas
 
 
+class Russia(GenericCalendarTest):
+    cal_class = Russia
+
+    def test_year_2018(self):
+        holidays = self.cal.holidays_set(2018)
+        self.assertIn(date(2018, 1, 1), holidays)  # New Year's Day
+        self.assertIn(date(2018, 1, 2), holidays)  # Day after New Year
+        self.assertIn(date(2018, 1, 7), holidays)  # Christmas
+        self.assertIn(date(2018, 2, 23), holidays)  # Defendence of Fatherland
+        self.assertIn(date(2018, 3, 8), holidays)  # International Women's Day
+        self.assertIn(date(2018, 5, 1), holidays)  # Labour Day
+        self.assertIn(date(2018, 5, 9), holidays)  # Victory Day
+        self.assertIn(date(2018, 6, 12), holidays)  # National Day
+        self.assertIn(date(2018, 11, 5), holidays)  # Day of Unity
+
+
 class UnitedKingdomTest(GenericCalendarTest):
     cal_class = UnitedKingdom