Repository: peopledoc/workalendar (python)

Issue:
2017 UnitedStates Christmas Day calculation is wrong
```
(datetime.date(2017, 12, 24), 'Christmas Eve'),
(datetime.date(2017, 12, 25), 'Christmas Day'),
(datetime.date(2017, 12, 25), 'Christmas Eve (Observed)'),
(datetime.date(2017, 12, 26), 'Christmas Eve (Observed)'),
(datetime.date(2017, 12, 27), 'Christmas Day (Observed)')
```

It should be:

```
(datetime.date(2017, 12, 24), 'Christmas Eve'),
(datetime.date(2017, 12, 25), 'Christmas Day'),
(datetime.date(2017, 12, 25), 'Christmas Eve (Observed)'),
(datetime.date(2017, 12, 26), 'Christmas Day (Observed)')
```

Pull request:
Fixing Federal Christmas Shift.
Fixes #241
Refs #232

Patch:
diff --git a/workalendar/usa/core.py b/workalendar/usa/core.py
index d1d8f45..f0fb80e 100644
--- a/workalendar/usa/core.py
+++ b/workalendar/usa/core.py
@@ -14,6 +14,7 @@ class UnitedStates(WesternCalendar, ChristianMixin):
         (7, 4, 'Independence Day'),
     )
     # Veterans day label
+    include_veterans_day = True
     veterans_day_label = 'Veterans Day'
 
     # MLK
@@ -104,8 +105,6 @@ class UnitedStates(WesternCalendar, ChristianMixin):
             # You are observing the 26th (TUE) and 27th (WED)
             elif christmas.weekday() == MON:
                 new_holidays.append((date(year, 12, 26),
-                                     "Christmas Eve (Observed)"))
-                new_holidays.append((date(year, 12, 27),
                                      "Christmas Day (Observed)"))
         return holidays + new_holidays
 
@@ -328,7 +327,8 @@ class UnitedStates(WesternCalendar, ChristianMixin):
 
     def get_fixed_holidays(self, year):
         days = super(UnitedStates, self).get_fixed_holidays(year)
-        days.append(self.get_veterans_day(year))
+        if self.include_veterans_day:
+            days.append(self.get_veterans_day(year))
         return days
 
     def get_calendar_holidays(self, year):


Test patch:
diff --git a/workalendar/tests/test_usa.py b/workalendar/tests/test_usa.py
index 4d163e2..1269fa6 100644
--- a/workalendar/tests/test_usa.py
+++ b/workalendar/tests/test_usa.py
@@ -112,6 +112,10 @@ class UnitedStatesTest(GenericCalendarTest):
         self.assertIn(date(2015, 11, 26), holidays)  # Thanskgiving
         self.assertIn(date(2015, 12, 25), holidays)  # XMas
 
+    def test_federal_year_2017(self):
+        holidays = self.cal.holidays_set(2017)
+        self.assertNotIn(date(2017, 12, 27), holidays)  # XMas
+
     def test_columbus_day(self):
         holidays = self.cal.holidays_set(2017)
         # Columbus Day is included here
@@ -976,6 +980,16 @@ class NorthCarolinaTest(NoPresidentialDay, NoColumbus, UnitedStatesTest):
         self.assertIn(date(2015, 12, 24), holidays)  # Xmas Eve
         self.assertIn(date(2015, 12, 26), holidays)  # Boxing Day
 
+    def test_federal_year_2017(self):
+        # It is different from other federal days.
+        holidays = self.cal.holidays_set(2017)
+        self.assertIn(date(2017, 4, 14), holidays)  # Good Friday
+        self.assertIn(date(2017, 11, 24), holidays)  # Thanksgiving Friday
+        self.assertIn(date(2017, 12, 24), holidays)  # Xmas Eve
+        self.assertIn(date(2017, 12, 25), holidays)  # Xmas Day
+        self.assertIn(date(2017, 12, 26), holidays)  # Day after Xmas
+        self.assertIn(date(2017, 12, 27), holidays)  # Xmas Shift
+
     def test_state_year_2016_xmas(self):
         # XMAS falls on SUN
         holidays = self.cal.holidays_set(2016)