Repository: peopledoc/workalendar
Pull request #435 (2019-12-05 13:33:45)

Added Serbia to the european countries
refs #

<!-- if your contribution is a new calendar -->

For information, read and make sure you're okay with the [Contributing guidelines](https://github.com/novafloss/workalendar/blob/master/contributing.md#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] Use the ``workalendar.registry_tools.iso_register`` decorator to register your new calendar using ISO codes (optional).
- [x] Calendar country / label added to the README.rst file.
- [x] Changelog amended with a mention like: "Added ``<country>`` by ``@pseudo`` (#)". **Note** *Please do NOT change the version number here. It's the project maintainers' duty.*

<!-- if your contribution is a fix -->

- [x] Tests with a significant number of years to be tested for your calendar.
- [x] Changelog amended with a mention describing your changes. **Note** *Please do NOT change the version number here. It's the project maintainers' duty.*

<!-- Release management

- Commit for the tag:
    - [ ] Edit version in setup.py
    - [ ] Add version in Changelog.md ; trim things
    - [ ] Push & wait for the tests to be green
    - [ ] tag me.
    - [ ] build sdist + wheel packages (``make package``)
- Back to dev commit:
    - [ ] Edit version in setup.py
    - [ ] Add the "master / nothing to see here" in Changelog.md
    - [ ] Push & wait for the tests to be green
- [ ] Merge --ff
- Github stuff
    - [ ] Push tag in Github
    - [ ] Edit release on Github using the changelog.
    - [ ] Delete branch
- [ ] upload release on PyPI using ``twine``
- [ ] (*optional*) Make feeback on the various PR or issues.

 -->



Patch:
diff --git a/Changelog.md b/Changelog.md
index ce97b32..6658a5d 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,7 +1,7 @@
 # CHANGELOG
 
 ## master (unreleased)
-
+- Added Serbia to the list
 - Small refactorings on the Gevena (Switzerland) holiday class.
 - Update China's public holidays for 2020.
 - Added Argentina calendar, by @ftatarli (#419).
diff --git a/README.rst b/README.rst
index 085b01f..8bf6c1a 100644
--- a/README.rst
+++ b/README.rst
@@ -105,6 +105,7 @@ Europe
 * Portugal
 * Romania
 * Russia
+* Serbia
 * Slovakia
 * Slovenia
 * Spain (incl. Catalonia)
diff --git a/workalendar/europe/__init__.py b/workalendar/europe/__init__.py
index 10756af..79dc51c 100644
--- a/workalendar/europe/__init__.py
+++ b/workalendar/europe/__init__.py
@@ -26,6 +26,7 @@ from .poland import Poland
 from .portugal import Portugal
 from .romania import Romania
 from .russia import Russia
+from .serbia import Serbia
 from .slovakia import Slovakia
 from .slovenia import Slovenia
 from .spain import Spain, Catalonia
@@ -81,6 +82,7 @@ __all__ = (
     'Portugal',
     'Romania',
     'Russia',
+    'Serbia',
     'Slovakia',
     'Slovenia',
     'Spain',
diff --git a/workalendar/europe/serbia.py b/workalendar/europe/serbia.py
new file mode 100644
index 0000000..aeed521
--- /dev/null
+++ b/workalendar/europe/serbia.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+from workalendar.core import WesternCalendar, OrthodoxMixin
+from ..registry_tools import iso_register
+
+
+@iso_register('RS')
+class Serbia(OrthodoxMixin, WesternCalendar):
+    'Serbia'
+
+    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
+        (1, 2, "Day After New Year"),
+        (1, 7, "Christmas"),
+        (2, 15, "Statehood Day"),
+        (2, 16, "Statehood Day"),
+        (5, 1, "Labour Day"),
+        (5, 2, "Labour Day Holiday"),
+        (11, 11, "Armistice Day"),
+    )
+
+    include_good_friday = True
+    include_easter_sunday = True
+    include_easter_monday = True
+    include_christmas = False


Test patch:
diff --git a/workalendar/tests/test_europe.py b/workalendar/tests/test_europe.py
index 279a6d8..dd8fc85 100644
--- a/workalendar/tests/test_europe.py
+++ b/workalendar/tests/test_europe.py
@@ -31,6 +31,7 @@ from workalendar.europe import Poland
 from workalendar.europe import Portugal
 from workalendar.europe import Romania
 from workalendar.europe import Russia
+from workalendar.europe import Serbia
 from workalendar.europe import Spain, Catalonia
 from workalendar.europe import Slovenia
 from workalendar.europe import Switzerland, Vaud, Geneva
@@ -1105,6 +1106,50 @@ class CataloniaTest(GenericCalendarTest):
         self.assertIn(date(2016, 12, 26), holidays)
 
 
+class SerbiaTest(GenericCalendarTest):
+    cal_class = Serbia
+
+    def test_year_2015(self):
+        holidays = self.cal.holidays_set(2015)
+        self.assertIn(date(2015, 1, 1), holidays)
+        self.assertIn(date(2015, 1, 2), holidays)
+        self.assertIn(date(2015, 1, 7), holidays)
+        self.assertIn(date(2015, 2, 15), holidays)
+        self.assertIn(date(2015, 2, 16), holidays)
+        self.assertIn(date(2015, 4, 10), holidays)
+        self.assertIn(date(2015, 4, 12), holidays)
+        self.assertIn(date(2015, 4, 13), holidays)
+        self.assertIn(date(2015, 5, 1), holidays)
+        self.assertIn(date(2015, 5, 2), holidays)
+        self.assertIn(date(2015, 11, 11), holidays)
+
+    def test_year_2016(self):
+        holidays = self.cal.holidays_set(2016)
+        self.assertIn(date(2016, 1, 1), holidays)
+        self.assertIn(date(2016, 1, 2), holidays)
+        self.assertIn(date(2016, 1, 7), holidays)
+        self.assertIn(date(2016, 2, 15), holidays)
+        self.assertIn(date(2016, 2, 16), holidays)
+        self.assertIn(date(2016, 4, 29), holidays)
+        self.assertIn(date(2016, 5, 1), holidays)
+        self.assertIn(date(2016, 5, 2), holidays)
+        self.assertIn(date(2016, 11, 11), holidays)
+
+    def test_year_2017(self):
+        holidays = self.cal.holidays_set(2017)
+        self.assertIn(date(2017, 1, 1), holidays)
+        self.assertIn(date(2017, 1, 2), holidays)
+        self.assertIn(date(2017, 1, 7), holidays)
+        self.assertIn(date(2017, 2, 15), holidays)
+        self.assertIn(date(2017, 2, 16), holidays)
+        self.assertIn(date(2017, 4, 14), holidays)
+        self.assertIn(date(2017, 4, 16), holidays)
+        self.assertIn(date(2017, 4, 17), holidays)
+        self.assertIn(date(2017, 5, 1), holidays)
+        self.assertIn(date(2017, 5, 2), holidays)
+        self.assertIn(date(2017, 11, 11), holidays)
+
+
 class SloveniaTest(GenericCalendarTest):
     cal_class = Slovenia