Repository: peopledoc/workalendar
Pull request #388 (2019-07-05 21:19:49)

Fix Romania, mixin order matters when mixing in OrthodoxMixin
- [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.

 -->


brunobord: I think I see the problem you're solving here, but I'm trying to understand at least one thing: now that the mixin order is swapped, why are the original tests still green?
KidkArolis: I think its because sometimes Catholic and Orthodox Easter lines up. Worth
double checking though.


On Sun, 7 Jul 2019 at 21:26, Bruno Bord <notifications@github.com> wrote:

> I think I see the problem you're solving here, but I'm trying to
> understand at least one thing: now that the mixin order is swapped, why are
> the original tests still green?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/peopledoc/workalendar/pull/388?email_source=notifications&email_token=AACPGWDF7MQV5IOUTOVSOWTP6JGQ3A5CNFSM4H6OHGCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZLSPTI#issuecomment-509028301>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AACPGWFBCUHLHI6FATQLPCLP6JGQ3ANCNFSM4H6OHGCA>
> .
>

KidkArolis: You can see it below

* in 2019 Easter Sunday is Apr 21 Catholic vs Apr 28 Orthodox
* in 2017 Easter Sunday is Apr 16 in both cases

# 2019

<img width="686" alt="image" src="https://user-images.githubusercontent.com/324440/60774724-7ec68980-a110-11e9-9eae-01ec428cfd39.png">

<img width="698" alt="image" src="https://user-images.githubusercontent.com/324440/60774734-b59c9f80-a110-11e9-8054-f73690b14c71.png">


# 2017

<img width="681" alt="image" src="https://user-images.githubusercontent.com/324440/60774753-e977c500-a110-11e9-92ca-e223aaf80dc0.png">

<img width="705" alt="image" src="https://user-images.githubusercontent.com/324440/60774747-df55c680-a110-11e9-81cc-482e125319a1.png">

brunobord: ok, now I see. If I'm swapping the order of parent classes, the 2019 tests fail.
All you'll have to do is to fix the tiny flake8 issue (a fixup commit or an amended commit + push force would work) and I'll merge this as soon as I can.

Patch:
diff --git a/Changelog.md b/Changelog.md
index d8f31ef..82de224 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,7 +2,7 @@
 
 ## master (unreleased)
 
-Nothing here yet.
+- Fix Romania, make sure Easter and related holidays are calculated using the Orthodox calendar
 
 ## v5.2.2. (2019-07-07)
 
diff --git a/workalendar/europe/romania.py b/workalendar/europe/romania.py
index 129cc4d..c99ea14 100644
--- a/workalendar/europe/romania.py
+++ b/workalendar/europe/romania.py
@@ -6,7 +6,7 @@ from ..registry_tools import iso_register
 
 
 @iso_register('RO')
-class Romania(WesternCalendar, OrthodoxMixin):
+class Romania(OrthodoxMixin, WesternCalendar):
     'Romania'
 
     FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (


Test patch:
diff --git a/workalendar/tests/test_europe.py b/workalendar/tests/test_europe.py
index d2d9c2d..074cf25 100644
--- a/workalendar/tests/test_europe.py
+++ b/workalendar/tests/test_europe.py
@@ -798,6 +798,24 @@ class Romania(GenericCalendarTest):
         self.assertIn(date(2017, 12, 25), holidays)  # Crăciunul Christmas
         self.assertIn(date(2017, 12, 26), holidays)  # Crăciunul Christmas
 
+    def test_year_2019(self):
+        holidays = self.cal.holidays_set(2019)
+        self.assertIn(date(2019, 1, 1), holidays)  # Anul Nou New Year's Day
+        self.assertIn(date(2019, 1, 2), holidays)  # Anul Nou Day after New Yr
+        self.assertIn(date(2019, 1, 24), holidays)  # Unirea Principatelor Rom
+        self.assertIn(date(2019, 4, 26), holidays)  # Orthodox Good Fri
+        self.assertIn(date(2019, 4, 28), holidays)  # Orthodox Easter Sun
+        self.assertIn(date(2019, 4, 29), holidays)  # Orthodox Easter Mon
+        self.assertIn(date(2019, 5, 1), holidays)  # Ziua Muncii Labour Day
+        self.assertIn(date(2019, 6, 1), holidays)  # Ziua Copilului Children's
+        self.assertIn(date(2019, 6, 16), holidays)  # Pentecost
+        self.assertIn(date(2019, 6, 17), holidays)  # Whit Monday
+        self.assertIn(date(2019, 8, 15), holidays)  # Adormirea Maicii Domnului
+        self.assertIn(date(2019, 11, 30), holidays)  # Sfântul Andrei St. Andre
+        self.assertIn(date(2019, 12, 1), holidays)  # Ziua Națională/Marea Unir
+        self.assertIn(date(2019, 12, 25), holidays)  # Crăciunul Christmas
+        self.assertIn(date(2019, 12, 26), holidays)  # Crăciunul Christmas
+
 
 class Russia(GenericCalendarTest):
     cal_class = Russia