diff --git a/CHANGELOG b/CHANGELOG index 24e555d6..02c6de92 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,10 +1,21 @@ CHANGELOG ========= -0.2 (unreleased) +0.3 (unreleased) ---------------- -- Nothing changed yet. +- Germany calendar added, thx to @rndusr + + +0.2.0 (2014-07-15) +------------------ + +- How to contribute documentation, +- Added Belgium, European Central Bank, Sweden, every specific calendar in the + United States of America, Canada. +- BUGFIX: fixed a corpus christi bug. This day used to be included in every + ChristianMixin calendar, except noticed otherwise. Now it's not included by + default and should be set to "True" when needed. 0.1 (2014-02-17) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000..c017f676 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,206 @@ +========================= +Contribute to Workalendar +========================= + +Use it (and test it) +==================== + +If you are using ``workalendar``, you are already contributing to it. As long +as you are able to check its result, compare the designated working days and +holidays to the reality, and make sure these are right, you're helping. + +If any of the computed holidays for the country / area your are using is +**wrong**, please report +`it using the Github issues `_. + +Report an issue +=============== + +If you think you've found a bug you can report an issue. In order to help us +sort this out, please follow the guidelines: + +* Tell us which ``workalendar`` version (master, PyPI release) you are using. +* Tell us which Python version you are using, and your platform. +* Give us extensive details on the country / area Calendar, the exact date(s) that was (were) computed and the one(s) that should have been the correct result. +* If possible, please provide us a reliable source about the designated country / area calendar, where we could effectively check that we were wrong about a date, and giving us a way to patch our code properly so we can fix the bug. + + +Adding new calendars +==================== + +Since ``workalendar`` is mainly built around configuration variables and generic +methods, it's not that difficult to add a calendar to our codebase. A few +**mandatory** steps should be observed: + +1. Fork the repository and create a new branch named after the calendar you want to implement, +2. Add a test class to the workalendar test suite that checks holidays, +3. Implement the class using the core class APIs as much as possible. Test it until all tests pass. +4. Make a nice pull-request we'll be glad to review and merge when it's perfect. + +.. note:: + + Please respect the PEP8 convention, otherwise your PR won't be accepted. + +Example +------- + +Let's assume you want to include the holidays of the magic (fictional) kingdom +of *"Zhraa"*, which has a few holidays of different kind. + +For the sake of the example, it has the following specs: + +* it's a Gregorian-based Calendar (i.e. the Western European / American one), +* even if the King is not versed into religions, the kingdom includes a few Christian holidays, +* even if you never knew about it, it is set in Oceania, + +Here is a list of the holidays in *Zhraa*: + +* January 1st, New year's Day, +* May 1st, Labour day, +* Easter Monday, which is variable (from March to May), +* The first monday in June, to celebrate the birth of the Founder of the Kingdom, Zhraa (nobody knows the exact day he was born, so this day was chosen as a convention), +* The birthday of the King, August 2nd. +* Christmas Day, Dec 25th. + + +Getting ready +############# + +You'll need to install ``workalendar`` dependencies beforehand. What's great is +that you'll use virtualenv to set it up. Or even better: ``virtualenvwrapper``. +Just go in your working copy (cloned from github) of workalendar and type, for +example:: + + mkvirtualenv WORKALENDAR + pip install -e ./ + + +Test-driven start +################# + + +Let's prepare the Zhraa class. In the ``workalendar/oceania.py`` file, add +a class like this:: + + class Zhraa(WesternCalendar): + pass + + +Now, we're building a test class. Edit the ``workalendar/tests/test_oceania.py`` +file and add the following code:: + + from workalendar.oceania import Zhraa + # snip... + + class ZhraaTest(GenericCalendarTest): + cal_class = Zhraa + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) # new year + self.assertIn(date(2014, 5, 1), holidays) # labour day + self.assertIn(date(2014, 8, 2), holidays) # king birthday + self.assertIn(date(2014, 12, 25), holidays) # Xmas + # variable days + self.assertIn(date(2014, 4, 21), holidays) # easter monday + self.assertIn(date(2014, 6, 2), holidays) # First MON in June + +of course, if you run the test using the ``tox`` or ``nosetests`` command, +this will fail, since we haven't implemented anything yet. + +Install tox using the following command:: + + workon WORKALENDAR + pip install tox + +With the ``WesternCalendar`` base class you have at least one holiday as a +bonus: the New year's day, which is commonly a holiday. + +Add fixed days +############## + +:: + + class Zhraa(WesternCalendar): + FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( + (5, 1, "Labour Day"), + (8, 2, "King Birthday"), + ) + +Now we've got 3 holidays out of 6. + +Add religious holidays +###################### + +Using ChristianMixin as a base to our Zhraa class will instantly add Christmas +Day as a holiday. Now we can add Easter monday just by triggering the correct +flag. + +:: + + class Zhraa(WesternCalendar, ChristianMixin): + include_easter_monday = True + FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( + (5, 1, "Labour Day"), + (8, 2, "King Birthday"), + ) + +Almost there, 5 holidays out of 6. + +Add variable "non-usual" holidays +################################# + +There are many static methods that will grant you a clean access to variable +days computation. It's very easy to add days like the "Birthday of the Founder":: + + + class Zhraa(WesternCalendar, ChristianMixin): + include_easter_monday = True + FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( + (5, 1, "Labour Day"), + (8, 2, "King Birthday"), + ) + + def get_variable_days(self, year): + # usual variable days + days = super(Zhraa, self).get_variable_days(year) + + days.append( + (Zhraa.get_nth_weekday_in_month(year, 6, MON), + 'Day of the Founder'), + ) + return days + +.. note:: + + Please mind that the returned "variable_days" is a list of tuples. The first + item being a date object (in the Python ``datetime.date`` sense) and the + second one is the label string. + + +There you are. Commit with a nice commit message, test, make sure it works for +the other years as well and you're almost there. + +The final steps +############### + +Do not forget to: + +1. put the appropriate doctring in the Calendar class. +2. add your calendar in the ``README.rst`` file, included in the appropriate continent. + +.. note:: + + We're planning to build a complete documentation for the other cases + (special holiday rules, other calendar types, other religions, etc). But + with this tutorial you're sorted for a lot of other calendars. + + +Other code contributions +======================== + +There are dozens of calendars all over the world. We'd appreciate you to +contribute to the core of the library by adding some new Mixins or Calendars. + +Bear in mind that the code you'd provide **must** be tested using unittests +before you submit your pull-request. diff --git a/README.rst b/README.rst index 181f3576..e92654e8 100644 --- a/README.rst +++ b/README.rst @@ -71,10 +71,13 @@ Available Calendars Europe ------ +* Belgium * Czech Republic +* European Central Bank * Finland * France * France (Alsace / Moselle) +* Germany * Greece * Hungary * Iceland @@ -91,7 +94,8 @@ America * Chile * Mexico * Panama -* United States of America (only the federal state holidays at the moment) +* United States of America (including state holidays) +* Canada (including provincial and territory holidays) Asia ---- @@ -128,6 +132,13 @@ the same official day decided by religious authorities, and this may vary country by country. Whenever it's possible, try to adjust your results with the official data provided by the adequate authorities. +Contributing +============ + +Please read our `CONTRIBUTING.rst `_ +document to discover how you can contribute to ``workalendar``. Pull-requests +are very welcome. + License ======= diff --git a/setup.py b/setup.py index 67eaea97..692e915e 100644 --- a/setup.py +++ b/setup.py @@ -25,35 +25,37 @@ def read_relative_file(filename): 'pytz', 'pyCalverter', ] -__VERSION__ = '0.2-dev' +__VERSION__ = '0.3-dev' if PY2: REQUIREMENTS.append('pyephem') else: REQUIREMENTS.append('ephem') +params = dict( + name=NAME, + description=DESCRIPTION, + packages=['workalendar'], + version=__VERSION__, + long_description=read_relative_file('README.rst'), + author='Bruno Bord', + author_email='bruno.bord@novapost.fr', + url='https://github.com/novapost/workalendar', + license='MIT License', + include_package_data=True, + install_requires=REQUIREMENTS, + zip_safe=False, + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + ], +) + if __name__ == '__main__': - setup( - name=NAME, - description=DESCRIPTION, - packages=['workalendar'], - version=__VERSION__, - long_description=read_relative_file('README.rst'), - author='Bruno Bord', - author_email='bruno.bord@novapost.fr', - url='https://github.com/novapost/workalendar', - license='MIT License', - include_package_data=True, - install_requires=REQUIREMENTS, - zip_safe=False, - classifiers=( - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - ) - ) + setup(**params) diff --git a/workalendar/america.py b/workalendar/america.py index 1f7a35c2..85f3f558 100644 --- a/workalendar/america.py +++ b/workalendar/america.py @@ -8,72 +8,6 @@ from workalendar.core import SUN, MON, TUE, WED, FRI, SAT -class UnitedStates(WesternCalendar, ChristianMixin): - "United States of America" - FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( - Holiday(date(2000, 7, 4), 'Independence Day', indication='July 4'), - Holiday(date(2000, 11, 11), 'Veterans Day', indication='Nov 11'), - ) - - @staticmethod - def is_presidential_year(year): - return (year % 4) == 0 - - def get_variable_days(self, year): - # usual variable days - days = super(UnitedStates, self).get_variable_days(year) - days += [ - Holiday( - date(year, 1, 1) + rd.relativedelta(weekday=rd.MO(3)), - "Martin Luther King, Jr. Day", - indication="3rd Monday in January", - ), - - Holiday( - date(year, 2, 1) + rd.relativedelta(weekday=rd.MO(3)), - "Washington's Birthday", - indication="3rd Monday in February", - ), - - Holiday( - date(year, 5, 31) + rd.relativedelta(weekday=rd.MO(-1)), - "Memorial Day", - indication="Last Monday in May", - ), - - Holiday( - date(year, 9, 1) + rd.relativedelta(weekday=rd.MO(1)), - "Labor Day", - indication="1st Monday in September", - ), - - Holiday( - date(year, 10, 1) + rd.relativedelta(weekday=rd.MO(2)), - "Colombus Day", - indication="2nd Monday in October", - ), - - Holiday( - date(year, 11, 1) + rd.relativedelta(weekday=rd.TH(4)), - "Thanksgiving Day", - indication="4th Thursday in November", - ), - ] - # Inauguration day - if UnitedStates.is_presidential_year(year - 1): - inauguration_day = date(year, 1, 20) - if inauguration_day.weekday() == SUN: - inauguration_day = date(year, 1, 21) - ind = "January 20 (or 21st if Sunday) following an election year" - h = Holiday( - inauguration_day, - "Inauguration Day", - indication=ind, - ) - days.append(h) - return days - - class Brazil(WesternCalendar, ChristianMixin): "Brazil" FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( diff --git a/workalendar/canada.py b/workalendar/canada.py new file mode 100644 index 00000000..a0d81f79 --- /dev/null +++ b/workalendar/canada.py @@ -0,0 +1,341 @@ +# -*- coding: utf-8 -*- + +from __future__ import (absolute_import, division, print_function, + unicode_literals) +from datetime import date +from workalendar.core import WesternCalendar, ChristianMixin, Calendar +from workalendar.core import SUN, MON, SAT + + +class Canada(WesternCalendar, ChristianMixin): + "Canada" + FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( + (7, 1, "Canada Day"), + ) + shift_new_years_day = True + + def get_variable_days(self, year): + # usual variable days + days = super(Canada, self).get_variable_days(year) + days += [ + (Canada.get_nth_weekday_in_month(year, 9, MON, 1), "Labor Day") + ] + canadaday = date(year, 7, 1) + if canadaday.weekday() in self.get_weekend_days(): + shift = self.find_following_working_day(canadaday) + days.append((shift, "Canada Day Shift")) + christmas = date(year, 12, 25) + if christmas.weekday() in self.get_weekend_days(): + shift = self.find_following_working_day(christmas) + days.append((shift, "Christmas Shift")) + return days + + +class EarlyFamilyDayMixin(Calendar): + "2nd Monday of February" + + def get_family_day(self, year, label="Family Day"): + return (self.get_nth_weekday_in_month(year, 2, MON, 2), label) + + +class LateFamilyDayMixin(Calendar): + "3rd Monday of February" + + def get_family_day(self, year, label="Family Day"): + return (self.get_nth_weekday_in_month(year, 2, MON, 3), label) + + +class VictoriaDayMixin(Calendar): + "Monday preceding the 25th of May" + + def get_victoria_day(self, year): + for day in range(18, 25): + if date(year, 5, day).weekday() == MON: + return (date(year, 5, day), "Victoria Day") + + +class AugustCivicHolidayMixin(Calendar): + "1st Monday of August; different names depending on location" + + def get_civic_holiday(self, year, label="Civic Holiday"): + return (self.get_nth_weekday_in_month(year, 8, MON), + label) + + +class ThanksgivingMixin(Calendar): + "2nd Monday of October" + + def get_thanksgiving(self, year): + return (self.get_nth_weekday_in_month(year, 10, MON, 2), + "Thanksgiving") + + +class BoxingDayMixin(Calendar): + "26th of December; shift to next working day" + + def get_boxing_day(self, year): + boxingday = date(year, 12, 26) + if boxingday.weekday() == MON: + days = [(boxingday, "Boxing Day"), (date(year, 12, 27), + "Boxing Day (Shift)")] + elif boxingday.weekday() == SAT or boxingday.weekday() == SUN: + days = [(boxingday, "Boxing Day"), (date(year, 12, 28), + "Boxing Day (Shift)")] + else: + days = [(boxingday, "Boxing Day")] + return days + + +class StJeanBaptisteMixin(Calendar): + "24th of June; shift to next working day" + + def get_st_jean(self, year): + stjean = date(year, 6, 24) + if stjean.weekday() in self.get_weekend_days(): + days = [(stjean, "St Jean Baptiste"), + (self.find_following_working_day(stjean), + "St Jean Baptiste (Shift)")] + else: + days = [(stjean, "St Jean Baptiste")] + return days + + +class RemembranceDayShiftMixin(Calendar): + "11th of November; shift to next day" + def get_remembrance_day(self, year): + remembranceday = date(year, 11, 11) + if remembranceday.weekday() in self.get_weekend_days(): + days = [(remembranceday, "Remembrance Day"), + (self.find_following_working_day(remembranceday), + "Remembrance Day (Shift)")] + else: + days = [(remembranceday, "Remembrance Day")] + return days + + +class Ontario(Canada, BoxingDayMixin, ThanksgivingMixin, VictoriaDayMixin, + LateFamilyDayMixin, AugustCivicHolidayMixin): + "Ontario" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Ontario, self).get_variable_days(year) + days += [ + (self.get_family_day(year)), + (self.get_victoria_day(year)), + (self.get_civic_holiday(year, "Civic Holiday (Not for all)")), + (self.get_thanksgiving(year)), + ] + days += self.get_boxing_day(year) + + return days + + +class Quebec(Canada, VictoriaDayMixin, StJeanBaptisteMixin, ThanksgivingMixin): + "Quebec" + include_easter_monday = True + + def get_variable_days(self, year): + days = super(Quebec, self).get_variable_days(year) + days += [ + (self.get_victoria_day(year)), + (self.get_thanksgiving(year)), + ] + days += self.get_st_jean(year) + + return days + + +class BritishColumbia(Canada, VictoriaDayMixin, AugustCivicHolidayMixin, + ThanksgivingMixin, EarlyFamilyDayMixin): + "British Columbia" + + include_good_friday = True + + FIXED_HOLIDAYS = Canada.FIXED_HOLIDAYS + ( + (11, 11, "Remembrance Day"), + ) + + def get_variable_days(self, year): + days = super(BritishColumbia, self).get_variable_days(year) + days += [ + (self.get_family_day(year)), + (self.get_victoria_day(year)), + (self.get_civic_holiday(year, "British Columbia Day")), + (self.get_thanksgiving(year)), + ] + + return days + + +class Alberta(Canada, LateFamilyDayMixin, VictoriaDayMixin, ThanksgivingMixin): + "Alberta" + include_good_friday = True + + FIXED_HOLIDAYS = Canada.FIXED_HOLIDAYS + ( + (11, 11, "Remembrance Day"), + ) + + def get_variable_days(self, year): + days = super(Alberta, self).get_variable_days(year) + days += [ + (self.get_family_day(year)), + (self.get_victoria_day(year)), + (self.get_thanksgiving(year)), + ] + + return days + + +class Saskatchewan(Canada, LateFamilyDayMixin, VictoriaDayMixin, + RemembranceDayShiftMixin, AugustCivicHolidayMixin, + ThanksgivingMixin): + "Saskatchewan" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Saskatchewan, self).get_variable_days(year) + days += [ + (self.get_family_day(year)), + (self.get_victoria_day(year)), + (self.get_civic_holiday(year)), + (self.get_thanksgiving(year)), + ] + days += self.get_remembrance_day(year) + + return days + + +class Manitoba(Canada, LateFamilyDayMixin, VictoriaDayMixin, + AugustCivicHolidayMixin, ThanksgivingMixin): + "Manitoba" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Manitoba, self).get_variable_days(year) + days += [ + (self.get_family_day(year, "Louis Riel Day")), + (self.get_victoria_day(year)), + (self.get_civic_holiday(year)), + (self.get_thanksgiving(year)), + ] + + return days + + +class NewBrunswick(Canada, AugustCivicHolidayMixin): + "New Brunswick" + + FIXED_HOLIDAYS = Canada.FIXED_HOLIDAYS + ( + (11, 11, "Remembrance Day"), + ) + + include_good_friday = True + + def get_variable_days(self, year): + days = super(NewBrunswick, self).get_variable_days(year) + days += [ + (self.get_civic_holiday(year)), + ] + return days + + +class NovaScotia(Canada, RemembranceDayShiftMixin, LateFamilyDayMixin): + "Nova Scotia" + + include_good_friday = True + + def get_variable_days(self, year): + days = super(NovaScotia, self).get_variable_days(year) + days += (self.get_remembrance_day(year)) + + if year >= 2015: + days += [ + (self.get_family_day(year, "Viola Desmond Day")), + ] + + return days + + +class PrinceEdwardIsland(Canada, LateFamilyDayMixin, RemembranceDayShiftMixin): + "Prince Edward Island" + + include_good_friday = True + + def get_variable_days(self, year): + days = super(PrinceEdwardIsland, self).get_variable_days(year) + days += [ + (self.get_family_day(year, "Islander Day")), + ] + days += (self.get_remembrance_day(year)) + + return days + + +class Newfoundland(Canada): + "Newfoundland" + include_good_friday = True + + +class Yukon(Canada, VictoriaDayMixin, ThanksgivingMixin): + "Yukon" + + FIXED_HOLIDAYS = Canada.FIXED_HOLIDAYS + ( + (11, 11, "Remembrance Day"), + ) + + include_good_friday = True + + def get_variable_days(self, year): + days = super(Yukon, self).get_variable_days(year) + days += [ + (self.get_nth_weekday_in_month(year, 8, MON, 3), + "Discovery Day"), + (self.get_victoria_day(year)), + (self.get_thanksgiving(year)), + ] + + return days + + +class NorthwestTerritories(Canada, RemembranceDayShiftMixin, VictoriaDayMixin, + ThanksgivingMixin): + "Northwest Territories" + + FIXED_HOLIDAYS = Canada.FIXED_HOLIDAYS + ( + (6, 21, "National Aboriginal Day"), + ) + + include_good_friday = True + + def get_variable_days(self, year): + days = super(NorthwestTerritories, self).get_variable_days(year) + days += [ + (self.get_victoria_day(year)), + (self.get_thanksgiving(year)), + ] + + days += (self.get_remembrance_day(year)) + + return days + + +class Nunavut(Canada, VictoriaDayMixin, ThanksgivingMixin, + RemembranceDayShiftMixin): + "Nunavut" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Nunavut, self).get_variable_days(year) + days += [ + (self.get_victoria_day(year)), + (self.get_thanksgiving(year)), + ] + + days += (self.get_remembrance_day(year)) + nuvanutday = date(year, 7, 9) + days += [(nuvanutday, "Nuvanut Day")] + if nuvanutday.weekday() == SUN: + days += [(date(year, 7, 10), "Nuvanut Day (Shift)")] + + return days diff --git a/workalendar/core.py b/workalendar/core.py index ec521b75..10c7d180 100644 --- a/workalendar/core.py +++ b/workalendar/core.py @@ -302,7 +302,7 @@ class ChristianMixin(Calendar): whit_sunday_label = 'Whit Sunday' include_whit_monday = False whit_monday_label = 'Whit Monday' - include_corpus_christi = True + include_corpus_christi = False include_boxing_day = False boxing_day_label = "Boxing Day" diff --git a/workalendar/europe.py b/workalendar/europe.py index d699c363..179d6e27 100644 --- a/workalendar/europe.py +++ b/workalendar/europe.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from datetime import date, timedelta from workalendar.core import WesternCalendar, ChristianMixin, OrthodoxMixin from workalendar.core import THU, MON, FRI, SAT @@ -326,3 +327,165 @@ def get_variable_days(self, year): self.find_following_working_day(battle_of_boyne), "Battle of the Boyne substitute")) return days + + +class EuropeanCentralBank(WesternCalendar, ChristianMixin): + "European Central Bank" + FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( + (5, 1, "Labour Day"), + (12, 26, "St. Stephen's Day"), + ) + + include_good_friday = True + include_easter_monday = True + + +class Belgium(WesternCalendar, ChristianMixin): + "Belgium" + + FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( + (5, 1, "Labour Day"), + (7, 21, "Labour Day"), + (11, 11, "Armistice of 1918"), + ) + + include_easter_monday = True + include_ascension = True + include_whit_monday = True + include_assumption = True + include_all_saints = True + + +class Germany(WesternCalendar, ChristianMixin): + "Germany" + + FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( + (5, 1, "Labour Day"), + (10, 3, "Day of German Unity"), + ) + + include_easter_monday = True + include_ascension = True + include_whit_monday = True + include_good_friday = True + include_boxing_day = True + boxing_day_label = "Second Christmas Day" + + +class BadenWurttemberg(Germany): + "Baden-Württemberg" + + include_epiphany = True + include_corpus_christi = True + include_all_saints = True + + +class Bavaria(Germany): + "Bavaria" + + include_epiphany = True + include_corpus_christi = True + include_all_saints = True + include_assumption = True + + +class Berlin(Germany): + "Berlin" + + +class Brandenburg(Germany): + "Brandenburg" + + FIXED_HOLIDAYS = Germany.FIXED_HOLIDAYS + ( + (10, 31, "Reformation Day"), + ) + + +class Bremen(Germany): + "Bremen" + + +class Hamburg(Germany): + "Hamburg" + + +class Hesse(Germany): + "Hesse" + + include_corpus_christi = True + + +class MecklenburgVorpommern(Germany): + "Mecklenburg-Vorpommern" + + FIXED_HOLIDAYS = Germany.FIXED_HOLIDAYS + ( + (10, 31, "Reformation Day"), + ) + + +class LowerSaxony(Germany): + "Lower Saxony" + + +class NorthRhineWestphalia(Germany): + "North Rhine-Westphalia" + + include_corpus_christi = True + include_all_saints = True + + +class RhinelandPalatinate(Germany): + "Rhineland-Palatinate" + + include_corpus_christi = True + include_all_saints = True + + +class Saarland(Germany): + "Saarland" + + include_corpus_christi = True + include_assumption = True + include_all_saints = True + + +class Saxony(Germany): + "Saxony" + + FIXED_HOLIDAYS = Germany.FIXED_HOLIDAYS + ( + (10, 31, "Reformation Day"), + ) + + def get_repentance_day(self, year): + "Wednesday before November 23" + day = date(year, 11, 23) + while day.weekday() != 2: # 2=Wednesday + day -= timedelta(days=1) + return (day, "Repentance Day") + + def get_variable_days(self, year): + days = super(Germany, self).get_variable_days(year) + days.append(self.get_repentance_day(year)) + return days + + +class SaxonyAnhalt(Germany): + "Saxony-Anhalt" + + FIXED_HOLIDAYS = Germany.FIXED_HOLIDAYS + ( + (10, 31, "Reformation Day"), + ) + + include_epiphany = True + + +class SchleswigHolstein(Germany): + "Schleswig-Holstein" + + +class Thuringia(Germany): + "Thuringia" + + FIXED_HOLIDAYS = Germany.FIXED_HOLIDAYS + ( + (10, 31, "Reformation Day"), + ) diff --git a/workalendar/tests/test_america.py b/workalendar/tests/test_america.py index e63fbfda..bb913ee8 100644 --- a/workalendar/tests/test_america.py +++ b/workalendar/tests/test_america.py @@ -1,47 +1,11 @@ # -*- coding: utf-8 -*- from datetime import date from workalendar.tests import GenericCalendarTest -from workalendar.america import UnitedStates from workalendar.america import Brazil, BrazilSaoPauloState from workalendar.america import BrazilSaoPauloCity from workalendar.america import Mexico, Chile, Panama -class UnitedStatesTest(GenericCalendarTest): - cal_class = UnitedStates - - def test_year_2013(self): - holidays = self.cal.holidays_set(2013) - self.assertIn(date(2013, 1, 1), holidays) # new year - self.assertIn(date(2013, 7, 4), holidays) # Nation day - self.assertIn(date(2013, 11, 11), holidays) # Armistice - self.assertIn(date(2013, 12, 25), holidays) # Christmas - # Variable days - self.assertIn(date(2013, 1, 21), holidays) # Martin Luther King - self.assertIn(date(2013, 2, 18), holidays) # Washington's bday - self.assertIn(date(2013, 5, 27), holidays) # Memorial day - self.assertIn(date(2013, 9, 2), holidays) # Labour day - self.assertIn(date(2013, 10, 14), holidays) # Colombus - self.assertIn(date(2013, 11, 28), holidays) # Thanskgiving - - def test_presidential_year(self): - self.assertTrue(UnitedStates.is_presidential_year(2012)) - self.assertFalse(UnitedStates.is_presidential_year(2013)) - self.assertFalse(UnitedStates.is_presidential_year(2014)) - self.assertFalse(UnitedStates.is_presidential_year(2015)) - self.assertTrue(UnitedStates.is_presidential_year(2016)) - - def test_inauguration_day(self): - holidays = self.cal.holidays_set(2008) - self.assertNotIn(date(2008, 1, 20), holidays) - holidays = self.cal.holidays_set(2009) - self.assertIn(date(2009, 1, 20), holidays) - # case when inauguration day is a sunday - holidays = self.cal.holidays_set(1985) - self.assertNotIn(date(1985, 1, 20), holidays) - self.assertIn(date(1985, 1, 21), holidays) - - class BrazilTest(GenericCalendarTest): cal_class = Brazil diff --git a/workalendar/tests/test_canada.py b/workalendar/tests/test_canada.py new file mode 100644 index 00000000..f34ce70e --- /dev/null +++ b/workalendar/tests/test_canada.py @@ -0,0 +1,307 @@ +# -*- coding: utf-8 -*- +from datetime import date +from workalendar.tests import GenericCalendarTest +from workalendar.canada import Canada, Ontario, Quebec, BritishColumbia +from workalendar.canada import Alberta, Saskatchewan, Manitoba, NewBrunswick +from workalendar.canada import NovaScotia, PrinceEdwardIsland, Newfoundland +from workalendar.canada import Yukon, NorthwestTerritories, Nunavut + + +class CanadaTest(GenericCalendarTest): + cal_class = Canada + + def test_holidays_2011(self): + holidays = self.cal.holidays_set(2011) + self.assertIn(date(2011, 1, 3), holidays) + self.assertIn(date(2011, 7, 1), holidays) + self.assertIn(date(2011, 9, 5), holidays) + self.assertIn(date(2011, 12, 26), holidays) + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) # New years shift + self.assertIn(date(2012, 7, 2), holidays) # Canada day shift + self.assertIn(date(2012, 9, 3), holidays) # Labour day + self.assertIn(date(2012, 12, 25), holidays) + + def test_holidays_2013(self): + holidays = self.cal.holidays_set(2013) + self.assertIn(date(2013, 1, 1), holidays) + self.assertNotIn(date(2013, 3, 29), holidays) # Good Friday not in QC + self.assertNotIn(date(2013, 4, 1), holidays) # Easter Monday QC only + self.assertIn(date(2013, 7, 1), holidays) + self.assertIn(date(2013, 9, 2), holidays) + self.assertIn(date(2013, 12, 25), holidays) + + def test_holidays_2017(self): + holidays = self.cal.holidays_set(2017) + self.assertIn(date(2017, 1, 2), holidays) + + +class OntarioTest(GenericCalendarTest): + cal_class = Ontario + + def test_holidays_2010(self): + holidays = self.cal.holidays_set(2010) + self.assertIn(date(2010, 12, 27), holidays) # Christmas day shift + self.assertIn(date(2010, 12, 28), holidays) # Boxing day shift + + def test_holidays_2011(self): + holidays = self.cal.holidays_set(2011) + self.assertIn(date(2011, 1, 3), holidays) + self.assertIn(date(2011, 2, 21), holidays) # Family Day Ontario + self.assertIn(date(2011, 4, 22), holidays) # Good Friday + self.assertNotIn(date(2011, 4, 25), holidays) # Easter Monday + self.assertIn(date(2011, 5, 23), holidays) # Victoria Day + self.assertIn(date(2011, 7, 1), holidays) # Canada Day + self.assertIn(date(2011, 8, 1), holidays) # Civic holiday + self.assertIn(date(2011, 9, 5), holidays) # Labour Day + self.assertIn(date(2011, 10, 10), holidays) # Canadian Thanksgiving + self.assertIn(date(2011, 12, 26), holidays) + self.assertIn(date(2011, 12, 27), holidays) # Boxing day shift + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertIn(date(2012, 2, 20), holidays) # Family Day Ontario + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + self.assertIn(date(2012, 12, 26), holidays) # Boxing day + + +class QuebecTest(GenericCalendarTest): + cal_class = Quebec + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertNotIn(date(2012, 4, 6), holidays) # Good Friday + self.assertIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 6, 24), holidays) # St Jean Baptise + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + + +class BritishColumbiaTest(GenericCalendarTest): + cal_class = BritishColumbia + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertIn(date(2012, 2, 13), holidays) # Family Day BC + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 8, 6), holidays) # BC Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + + +class AlbertaTest(GenericCalendarTest): + cal_class = Alberta + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertIn(date(2012, 2, 20), holidays) # Family Day + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertNotIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + + +class SaskatchewanTest(GenericCalendarTest): + cal_class = Saskatchewan + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertIn(date(2012, 2, 20), holidays) # Family Day + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertIn(date(2012, 11, 12), holidays) # Remembrance Day (Shift) + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + + +class ManitobaTest(GenericCalendarTest): + cal_class = Manitoba + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertIn(date(2012, 2, 20), holidays) # Louis Riel Day + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertNotIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertNotIn(date(2012, 11, 12), holidays) # Remembrance Day Shift + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + self.assertNotIn(date(2012, 12, 26), holidays) # Boxing day + + +class NewBrunswickTest(GenericCalendarTest): + cal_class = NewBrunswick + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertNotIn(date(2012, 2, 20), holidays) # Family Day + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertNotIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertNotIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertNotIn(date(2012, 11, 12), holidays) # Remembrance Day Shift + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + self.assertNotIn(date(2012, 12, 26), holidays) # Boxing day + + +class NovaScotiaTest(GenericCalendarTest): + cal_class = NovaScotia + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertNotIn(date(2012, 2, 20), holidays) # Family Day + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertNotIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertNotIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertNotIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertIn(date(2012, 11, 12), holidays) # Remembrance Day Shift + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + self.assertNotIn(date(2012, 12, 26), holidays) # Boxing day + + def test_holidays_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 2, 16), holidays) # Viola Desmond day + + +class PrinceEdwardIslandTest(GenericCalendarTest): + cal_class = PrinceEdwardIsland + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertIn(date(2012, 2, 20), holidays) # Islander Day + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertNotIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertNotIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertNotIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertIn(date(2012, 11, 12), holidays) # Remembrance Day Shift + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + self.assertNotIn(date(2012, 12, 26), holidays) # Boxing day + + +class NewfoundlandTest(GenericCalendarTest): + cal_class = Newfoundland + + def test_holidays_2013(self): + holidays = self.cal.holidays_set(2013) + self.assertIn(date(2013, 1, 1), holidays) + self.assertIn(date(2013, 3, 29), holidays) # Good Friday + self.assertNotIn(date(2013, 4, 1), holidays) # Easter Monday + self.assertIn(date(2013, 7, 1), holidays) + self.assertIn(date(2013, 9, 2), holidays) + self.assertIn(date(2013, 12, 25), holidays) + + +class YukonTest(GenericCalendarTest): + cal_class = Yukon + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertNotIn(date(2012, 2, 20), holidays) # Family Day + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertNotIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertIn(date(2012, 8, 20), holidays) # Discovery Day + self.assertIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertNotIn(date(2012, 11, 12), holidays) # Remembrance Day Shift + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + self.assertNotIn(date(2012, 12, 26), holidays) # Boxing day + + +class NorthwestTerritoriesTest(GenericCalendarTest): + cal_class = NorthwestTerritories + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertNotIn(date(2012, 2, 20), holidays) # Family Day + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertNotIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertIn(date(2012, 6, 21), holidays) # National Aboriginal Day + self.assertIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertIn(date(2012, 11, 12), holidays) # Remembrance Day Shift + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + self.assertNotIn(date(2012, 12, 26), holidays) # Boxing day + + +class NunavutTests(GenericCalendarTest): + cal_class = Nunavut + + def test_holidays_2012(self): + holidays = self.cal.holidays_set(2012) + self.assertIn(date(2012, 1, 2), holidays) + self.assertNotIn(date(2012, 2, 20), holidays) # Family Day + self.assertIn(date(2012, 4, 6), holidays) # Good Friday + self.assertNotIn(date(2012, 4, 9), holidays) # Easter Monday + self.assertIn(date(2012, 5, 21), holidays) # Victoria Day + self.assertIn(date(2012, 7, 1), holidays) # Canada Day + self.assertIn(date(2012, 9, 3), holidays) # Labour Day + self.assertIn(date(2012, 7, 9), holidays) # Nunavut Day + self.assertNotIn(date(2012, 8, 6), holidays) # Civic Holiday + self.assertNotIn(date(2012, 6, 21), holidays) # Nat. Aboriginal Day + self.assertIn(date(2012, 10, 8), holidays) # Canadian Thanksgiving + self.assertIn(date(2012, 11, 11), holidays) # Remembrance Day + self.assertIn(date(2012, 11, 12), holidays) # Remembrance Day Shift + self.assertIn(date(2012, 12, 25), holidays) # Christmas day + self.assertNotIn(date(2012, 12, 26), holidays) # Boxing day diff --git a/workalendar/tests/test_core.py b/workalendar/tests/test_core.py index b2b199dd..dfdd37c3 100644 --- a/workalendar/tests/test_core.py +++ b/workalendar/tests/test_core.py @@ -5,8 +5,8 @@ from workalendar.tests import GenericCalendarTest from workalendar.core import MON, TUE, THU, FRI, SAT, SUN -from workalendar.core import Calendar, LunarCalendar -from workalendar.core import IslamicMixin, JalaliMixin +from workalendar.core import Calendar, LunarCalendar, WesternCalendar +from workalendar.core import IslamicMixin, JalaliMixin, ChristianMixin from workalendar.core import EphemMixin from workalendar.core import Holiday @@ -301,3 +301,38 @@ def test_qingming_festivals(self): self.cal.solar_term(2014, 15), date(2014, 4, 4) ) + + +class MockChristianCalendar(WesternCalendar, ChristianMixin): + pass + + +class MockChristianCalendarTest(GenericCalendarTest): + cal_class = MockChristianCalendar + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertNotIn(date(2014, 1, 6), holidays) # Epiphany + self.assertNotIn(date(2014, 3, 3), holidays) # Clean Monday + self.assertNotIn(date(2014, 3, 5), holidays) # Ash Wednesday + self.assertNotIn(date(2014, 3, 25), holidays) # Annunciation + self.assertNotIn(date(2014, 4, 17), holidays) # Holy Thursday + self.assertNotIn(date(2014, 4, 18), holidays) # 'Good Friday + self.assertNotIn(date(2014, 4, 19), holidays) # Easter sat + self.assertNotIn(date(2014, 4, 20), holidays) # Easter Sun + self.assertNotIn(date(2014, 4, 21), holidays) # Easter Mon + self.assertNotIn(date(2014, 5, 29), holidays) # Ascension + self.assertNotIn(date(2014, 6, 8), holidays) # Whit Sunday + self.assertNotIn(date(2014, 6, 9), holidays) # Whit Monday + self.assertNotIn(date(2014, 6, 19), holidays) # Corp. Christi + self.assertNotIn(date(2014, 8, 15), holidays) # Assumption + self.assertNotIn(date(2014, 11, 1), holidays) # All Saints + self.assertNotIn(date(2014, 12, 8), holidays) # Imm. Conc. + self.assertNotIn(date(2014, 12, 24), holidays) # Xmas Eve + self.assertNotIn(date(2014, 12, 26), holidays) # Boxing Day + + # The only Christian day that is a holiday for every calendar + self.assertIn(date(2014, 12, 25), holidays) # XMas + + # Only 2 days: Jan 1st and Christmas + self.assertEquals(len(holidays), 2) diff --git a/workalendar/tests/test_europe.py b/workalendar/tests/test_europe.py index 1ffc0fa9..d122ac43 100644 --- a/workalendar/tests/test_europe.py +++ b/workalendar/tests/test_europe.py @@ -12,6 +12,14 @@ from workalendar.europe import Poland from workalendar.europe import UnitedKingdom from workalendar.europe import UnitedKingdomNorthernIreland +from workalendar.europe import EuropeanCentralBank +from workalendar.europe import Belgium +from workalendar.europe import (Germany, BadenWurttemberg, Bavaria, Berlin, + Brandenburg, Bremen, Hamburg, Hesse, + MecklenburgVorpommern, LowerSaxony, + NorthRhineWestphalia, RhinelandPalatinate, + Saarland, Saxony, SaxonyAnhalt, + SchleswigHolstein, Thuringia) class CzechRepublicTest(GenericCalendarTest): @@ -333,3 +341,283 @@ def test_regional_2014(self): holidays = self.cal.holidays_set(2014) self.assertIn(date(2014, 7, 12), holidays) # Battle of the Boyne self.assertIn(date(2014, 7, 14), holidays) # Battle of the Boyne sub + + +class EuropeanCentralBankTest(GenericCalendarTest): + cal_class = EuropeanCentralBank + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) # New year's day + self.assertIn(date(2014, 4, 18), holidays) # Good friday + self.assertIn(date(2014, 4, 21), holidays) # easter monday + self.assertIn(date(2014, 5, 1), holidays) # Labour day + self.assertIn(date(2014, 12, 25), holidays) # XMas + self.assertIn(date(2014, 12, 26), holidays) # St Stephen + + +class BelgiumTest(GenericCalendarTest): + cal_class = Belgium + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 4, 21), holidays) + self.assertIn(date(2014, 5, 1), holidays) + self.assertIn(date(2014, 5, 29), holidays) + self.assertIn(date(2014, 6, 9), holidays) + self.assertIn(date(2014, 7, 21), holidays) + self.assertIn(date(2014, 8, 15), holidays) + self.assertIn(date(2014, 11, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 4, 6), holidays) + self.assertIn(date(2015, 5, 1), holidays) + self.assertIn(date(2015, 5, 14), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 21), holidays) + self.assertIn(date(2015, 8, 15), holidays) + self.assertIn(date(2015, 11, 1), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class GermanyTest(GenericCalendarTest): + cal_class = Germany + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 4, 21), holidays) + self.assertIn(date(2014, 5, 1), holidays) + self.assertIn(date(2014, 5, 29), holidays) + self.assertIn(date(2014, 6, 9), holidays) + self.assertIn(date(2014, 10, 3), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 4, 6), holidays) + self.assertIn(date(2015, 5, 1), holidays) + self.assertIn(date(2015, 5, 14), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 10, 3), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 26), holidays) + + +class BadenWurttembergTest(GermanyTest): + cal_class = BadenWurttemberg + + def test_extra_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 6), holidays) + self.assertIn(date(2014, 6, 19), holidays) + self.assertIn(date(2014, 11, 1), holidays) + + def test_extra_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 6), holidays) + self.assertIn(date(2015, 6, 4), holidays) + self.assertIn(date(2015, 11, 1), holidays) + + +class BavariaTest(GenericCalendarTest): + cal_class = Bavaria + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 6), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 4, 21), holidays) + self.assertIn(date(2014, 5, 1), holidays) + self.assertIn(date(2014, 5, 29), holidays) + self.assertIn(date(2014, 6, 9), holidays) + self.assertIn(date(2014, 6, 19), holidays) + self.assertIn(date(2014, 8, 15), holidays) + self.assertIn(date(2014, 10, 3), holidays) + self.assertIn(date(2014, 11, 1), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 6), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 4, 6), holidays) + self.assertIn(date(2015, 5, 1), holidays) + self.assertIn(date(2015, 5, 14), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 6, 4), holidays) + self.assertIn(date(2015, 8, 15), holidays) + self.assertIn(date(2015, 10, 3), holidays) + self.assertIn(date(2015, 11, 1), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 26), holidays) + + +class BerlinTest(GermanyTest): + cal_class = Berlin + + +class BrandenburgTest(GenericCalendarTest): + cal_class = Brandenburg + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 4, 21), holidays) + self.assertIn(date(2014, 5, 1), holidays) + self.assertIn(date(2014, 5, 29), holidays) + self.assertIn(date(2014, 6, 9), holidays) + self.assertIn(date(2014, 10, 3), holidays) + self.assertIn(date(2014, 10, 31), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 4, 6), holidays) + self.assertIn(date(2015, 5, 1), holidays) + self.assertIn(date(2015, 5, 14), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 10, 3), holidays) + self.assertIn(date(2015, 10, 31), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 26), holidays) + + +class BremenTest(GermanyTest): + cal_class = Bremen + + +class HamburgTest(GermanyTest): + cal_class = Hamburg + + +class HesseTest(GermanyTest): + cal_class = Hesse + + def test_extra_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 6, 19), holidays) + + def test_extra_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 6, 4), holidays) + + +class MecklenburgVorpommernTest(GermanyTest): + cal_class = MecklenburgVorpommern + + def test_extra_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 10, 31), holidays) + + def test_extra_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 10, 31), holidays) + + +class LowerSaxonyTest(GermanyTest): + cal_class = LowerSaxony + + +class NorthRhineWestphaliaTest(GermanyTest): + cal_class = NorthRhineWestphalia + + def test_extra_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 6, 19), holidays) + self.assertIn(date(2014, 11, 1), holidays) + + def test_extra_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 6, 4), holidays) + self.assertIn(date(2015, 11, 1), holidays) + + +class RhinelandPalatinateTest(GermanyTest): + cal_class = RhinelandPalatinate + + def test_extra_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 6, 19), holidays) + self.assertIn(date(2014, 11, 1), holidays) + + def test_extra_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 6, 4), holidays) + self.assertIn(date(2015, 11, 1), holidays) + + +class SaarlandTest(GermanyTest): + cal_class = Saarland + + def test_extra_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 6, 19), holidays) + self.assertIn(date(2014, 8, 15), holidays) + self.assertIn(date(2014, 11, 1), holidays) + + def test_extra_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 6, 4), holidays) + self.assertIn(date(2015, 8, 15), holidays) + self.assertIn(date(2015, 11, 1), holidays) + + +class SaxonyTest(GermanyTest): + cal_class = Saxony + + def test_extra_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 11, 19), holidays) + self.assertIn(date(2014, 10, 31), holidays) + + def test_extra_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 11, 18), holidays) + self.assertIn(date(2015, 10, 31), holidays) + + +class SaxonyAnhaltTest(GermanyTest): + cal_class = SaxonyAnhalt + + def test_extra_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 10, 31), holidays) + self.assertIn(date(2014, 1, 6), holidays) + + def test_extra_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 10, 31), holidays) + self.assertIn(date(2015, 1, 6), holidays) + + +class SchleswigHolsteinTest(GermanyTest): + cal_class = SchleswigHolstein + + +class ThuringiaTest(GermanyTest): + cal_class = Thuringia + + def test_extra_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 10, 31), holidays) + + def test_extra_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 10, 31), holidays) diff --git a/workalendar/tests/test_usa.py b/workalendar/tests/test_usa.py new file mode 100644 index 00000000..252cb966 --- /dev/null +++ b/workalendar/tests/test_usa.py @@ -0,0 +1,1662 @@ +# -*- coding: utf-8 -*- +from datetime import date +from workalendar.tests import GenericCalendarTest +from workalendar.usa import (UnitedStates, Alabama, Florida, Arkansas, + Alaska, Arizona, California, Colorado, + Connecticut, Delaware, Georgia, Indiana, + Illinois, Idaho, Iowa, Kansas, Kentucky, + Louisiana, Maine, Maryland, Massachusetts, + Minnesota, Michigan, Mississippi, Missouri, + Montana, Nebraska, Nevada, NewHampshire, + NewJersey, NewMexico, NewYork, NorthCarolina, + NorthDakota, Ohio, Oklahoma, Oregon, Pennsylvania, + RhodeIsland, SouthCarolina, SouthDakota, + Tennessee, Texas, Utah, Vermont, Virginia, + Washington, WestVirginia, Wisconsin, Wyoming) + + +class UnitedStatesTest(GenericCalendarTest): + cal_class = UnitedStates + + def test_year_2013(self): + holidays = self.cal.holidays_set(2013) + self.assertIn(date(2013, 1, 1), holidays) # new year + self.assertIn(date(2013, 7, 4), holidays) # Nation day + self.assertIn(date(2013, 11, 11), holidays) # Armistice + self.assertIn(date(2013, 12, 25), holidays) # Christmas + # Variable days + self.assertIn(date(2013, 1, 21), holidays) # Martin Luther King + self.assertIn(date(2013, 2, 18), holidays) # Washington's bday + self.assertIn(date(2013, 5, 27), holidays) # Memorial day + self.assertIn(date(2013, 9, 2), holidays) # Labour day + self.assertIn(date(2013, 10, 14), holidays) # Colombus + self.assertIn(date(2013, 11, 28), holidays) # Thanskgiving + + def test_presidential_year(self): + self.assertTrue(UnitedStates.is_presidential_year(2012)) + self.assertFalse(UnitedStates.is_presidential_year(2013)) + self.assertFalse(UnitedStates.is_presidential_year(2014)) + self.assertFalse(UnitedStates.is_presidential_year(2015)) + self.assertTrue(UnitedStates.is_presidential_year(2016)) + + def test_inauguration_day(self): + holidays = self.cal.holidays_set(2008) + self.assertNotIn(date(2008, 1, 20), holidays) + holidays = self.cal.holidays_set(2009) + self.assertIn(date(2009, 1, 20), holidays) + # case when inauguration day is a sunday + holidays = self.cal.holidays_set(1985) + self.assertNotIn(date(1985, 1, 20), holidays) + self.assertIn(date(1985, 1, 21), holidays) + + +class AlabamaTest(GenericCalendarTest): + cal_class = Alabama + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 28), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 6, 2), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 27), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 6, 1), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + def test_year_2010(self): + holidays = self.cal.holidays_set(2010) + self.assertIn(date(2010, 1, 1), holidays) + self.assertIn(date(2010, 1, 18), holidays) + self.assertIn(date(2010, 2, 15), holidays) + self.assertIn(date(2010, 4, 26), holidays) + self.assertIn(date(2010, 5, 31), holidays) + self.assertIn(date(2010, 6, 7), holidays) + self.assertIn(date(2010, 7, 5), holidays) + self.assertIn(date(2010, 9, 6), holidays) + self.assertIn(date(2010, 10, 11), holidays) + self.assertIn(date(2010, 11, 11), holidays) + self.assertIn(date(2010, 11, 25), holidays) + self.assertIn(date(2010, 12, 24), holidays) + self.assertIn(date(2010, 12, 31), holidays) + + +class AlaskaTest(GenericCalendarTest): + cal_class = Alaska + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 3, 31), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 17), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 3, 30), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 19), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class ArizonaTest(GenericCalendarTest): + cal_class = Arizona + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class ArkansasTest(GenericCalendarTest): + cal_class = Arkansas + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 24), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 24), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + def test_christmas_2016(self): + holidays = self.cal.holidays_set(2016) + self.assertIn(date(2016, 12, 23), holidays) + self.assertIn(date(2016, 12, 26), holidays) + + def test_christmas_2010(self): + holidays = self.cal.holidays_set(2010) + self.assertIn(date(2010, 12, 23), holidays) + self.assertIn(date(2010, 12, 24), holidays) + + +class CaliforniaTest(GenericCalendarTest): + cal_class = California + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 3, 31), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 3, 31), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class ColoradoTest(GenericCalendarTest): + cal_class = Colorado + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 3, 31), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 3, 31), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class ConnecticutTest(GenericCalendarTest): + cal_class = Connecticut + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 12), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 12), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class DelawareTest(GenericCalendarTest): + cal_class = Delaware + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class FloridaTest(GenericCalendarTest): + cal_class = Florida + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class GeorgiaTest(GenericCalendarTest): + cal_class = Georgia + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 4, 28), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 4, 27), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 24), holidays) + + +class HawaiiTest(GenericCalendarTest): + pass + + +class IdahoTest(GenericCalendarTest): + cal_class = Idaho + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class IllinoisTest(GenericCalendarTest): + cal_class = Illinois + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 12), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 12), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class IndianaTest(GenericCalendarTest): + cal_class = Indiana + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 24), holidays) + + +class IowaTest(GenericCalendarTest): + cal_class = Iowa + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class KansasTest(GenericCalendarTest): + cal_class = Kansas + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 24), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 24), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 26), holidays) + + +class KentuckyTest(GenericCalendarTest): + cal_class = Kentucky + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 26), holidays) + + +class LouisianaTest(GenericCalendarTest): + cal_class = Louisiana + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 3, 4), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 17), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class MaineTest(GenericCalendarTest): + cal_class = Maine + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 21), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 20), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class MarylandTest(GenericCalendarTest): + cal_class = Maryland + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class MassachusettsTest(GenericCalendarTest): + cal_class = Massachusetts + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 21), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 20), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class MichiganTest(GenericCalendarTest): + cal_class = Michigan + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 24), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 31), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 24), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 31), holidays) + + +class MinnesotaTest(GenericCalendarTest): + cal_class = Minnesota + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class MississippiTest(GenericCalendarTest): + cal_class = Mississippi + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 28), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 27), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class MissouriTest(GenericCalendarTest): + cal_class = Missouri + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 12), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 8), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 8), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class MontanaTest(GenericCalendarTest): + cal_class = Montana + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class NebraskaTest(GenericCalendarTest): + cal_class = Nebraska + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 25), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 24), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class NevadaTest(GenericCalendarTest): + cal_class = Nevada + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 31), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 30), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class NewHampshireTest(GenericCalendarTest): + cal_class = NewHampshire + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class NewJerseyTest(GenericCalendarTest): + cal_class = NewJersey + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class NewMexicoTest(GenericCalendarTest): + cal_class = NewMexico + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class NewYorkTest(GenericCalendarTest): + cal_class = NewYork + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 12), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 12), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class NorthCarolinaTest(GenericCalendarTest): + cal_class = NorthCarolina + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 24), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 24), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 26), holidays) + + +class NorthDakotaTest(GenericCalendarTest): + cal_class = NorthDakota + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class OhioTest(GenericCalendarTest): + cal_class = Ohio + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 1), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 1), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class OklahomaTest(GenericCalendarTest): + cal_class = Oklahoma + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 24), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 24), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class OregonTest(GenericCalendarTest): + cal_class = Oregon + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class Pennsylvania(GenericCalendarTest): + cal_class = Pennsylvania + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class RhodeIslandTest(GenericCalendarTest): + cal_class = RhodeIsland + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 8, 11), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 8, 10), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class SouthCarolinaTest(GenericCalendarTest): + cal_class = SouthCarolina + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 9), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 24), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 10), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 24), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 26), holidays) + + +class SouthDakotaTest(GenericCalendarTest): + cal_class = SouthDakota + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class TennesseeTest(GenericCalendarTest): + cal_class = Tennessee + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class TexasTest(GenericCalendarTest): + cal_class = Texas + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 19), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 3, 2), holidays) + self.assertIn(date(2014, 3, 31), holidays) + self.assertIn(date(2014, 4, 18), holidays) + self.assertIn(date(2014, 4, 21), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 6, 19), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 8, 27), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 3, 2), holidays) + self.assertIn(date(2015, 3, 31), holidays) + self.assertIn(date(2015, 4, 3), holidays) + self.assertIn(date(2015, 4, 21), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 6, 19), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 8, 27), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class UtahTest(GenericCalendarTest): + cal_class = Utah + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 7, 24), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 7, 24), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class VermontTest(GenericCalendarTest): + cal_class = Vermont + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 3, 4), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 8, 15), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 3, 3), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 8, 17), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class VirginiaTest(GenericCalendarTest): + cal_class = Virginia + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 17), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 26), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 24), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 26), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 16), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 25), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 24), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 26), holidays) + + +class WashingtonTest(GenericCalendarTest): + cal_class = Washington + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 25), holidays) + + +class WestVirginiaTest(GenericCalendarTest): + cal_class = WestVirginia + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 6, 20), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 10, 13), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 24), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 31), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 6, 20), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 10, 12), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 24), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 31), holidays) + + +class WisconsinTest(GenericCalendarTest): + cal_class = Wisconsin + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 11, 28), holidays) + self.assertIn(date(2014, 12, 24), holidays) + self.assertIn(date(2014, 12, 25), holidays) + self.assertIn(date(2014, 12, 31), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 11, 27), holidays) + self.assertIn(date(2015, 12, 24), holidays) + self.assertIn(date(2015, 12, 25), holidays) + self.assertIn(date(2015, 12, 31), holidays) + + +class WyomingTest(GenericCalendarTest): + cal_class = Wyoming + + def test_year_2014(self): + holidays = self.cal.holidays_set(2014) + self.assertIn(date(2014, 1, 1), holidays) + self.assertIn(date(2014, 1, 20), holidays) + self.assertIn(date(2014, 2, 17), holidays) + self.assertIn(date(2014, 5, 26), holidays) + self.assertIn(date(2014, 7, 4), holidays) + self.assertIn(date(2014, 9, 1), holidays) + self.assertIn(date(2014, 11, 11), holidays) + self.assertIn(date(2014, 11, 27), holidays) + self.assertIn(date(2014, 12, 25), holidays) + + def test_year_2015(self): + holidays = self.cal.holidays_set(2015) + self.assertIn(date(2015, 1, 1), holidays) + self.assertIn(date(2015, 1, 19), holidays) + self.assertIn(date(2015, 2, 16), holidays) + self.assertIn(date(2015, 5, 25), holidays) + self.assertIn(date(2015, 7, 3), holidays) + self.assertIn(date(2015, 9, 7), holidays) + self.assertIn(date(2015, 11, 11), holidays) + self.assertIn(date(2015, 11, 26), holidays) + self.assertIn(date(2015, 12, 25), holidays) diff --git a/workalendar/usa.py b/workalendar/usa.py new file mode 100644 index 00000000..adf4f85d --- /dev/null +++ b/workalendar/usa.py @@ -0,0 +1,1004 @@ +# -*- coding: utf-8 -*- + +from __future__ import (absolute_import, division, print_function, + unicode_literals) +from datetime import date, timedelta +from dateutil import relativedelta as rd +from workalendar.core import (WesternCalendar, ChristianMixin, Calendar, + Holiday) +from workalendar.core import SUN, MON, TUE, WED, THU, FRI, SAT + +NONE, NEAREST_WEEKDAY, MONDAY = range(3) + + +class UnitedStates(WesternCalendar, ChristianMixin): + "United States of America" + FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + ( + Holiday(date(2000, 7, 4), 'Independence Day', indication='July 4'), + Holiday(date(2000, 11, 11), 'Veterans Day', indication='Nov 11'), + ) + + @staticmethod + def is_presidential_year(year): + return (year % 4) == 0 + + def get_variable_days(self, year): + # usual variable days + days = super(UnitedStates, self).get_variable_days(year) + days += [ + Holiday( + date(year, 1, 1) + rd.relativedelta(weekday=rd.MO(3)), + "Martin Luther King, Jr. Day", + indication="3rd Monday in January", + ), + + Holiday( + date(year, 2, 1) + rd.relativedelta(weekday=rd.MO(3)), + "Washington's Birthday", + indication="3rd Monday in February", + ), + + Holiday( + date(year, 5, 31) + rd.relativedelta(weekday=rd.MO(-1)), + "Memorial Day", + indication="Last Monday in May", + ), + + Holiday( + date(year, 9, 1) + rd.relativedelta(weekday=rd.MO(1)), + "Labor Day", + indication="1st Monday in September", + ), + + Holiday( + date(year, 10, 1) + rd.relativedelta(weekday=rd.MO(2)), + "Colombus Day", + indication="2nd Monday in October", + ), + + Holiday( + date(year, 11, 1) + rd.relativedelta(weekday=rd.TH(4)), + "Thanksgiving Day", + indication="4th Thursday in November", + ), + ] + # Inauguration day + if UnitedStates.is_presidential_year(year - 1): + inauguration_day = date(year, 1, 20) + if inauguration_day.weekday() == SUN: + inauguration_day = date(year, 1, 21) + ind = "January 20 (or 21st if Sunday) following an election year" + h = Holiday( + inauguration_day, + "Inauguration Day", + indication=ind, + ) + days.append(h) + return days + + +class FloatToNearestWeekdayMixin(Calendar): + "Float Saturady to Friday, Sunday to Monday" + def float(self, holidays, year=0): + new_holidays = [] + holiday_lookup = [x[0] for x in holidays] + for holiday in holidays: + if holiday[0].weekday() == SAT: + new_holidays.append((holiday[0] - timedelta(days=1), + holiday[1] + " (Observed)")) + elif holiday[0].weekday() == SUN: + new_holidays.append((holiday[0] + timedelta(days=1), + holiday[1] + " (Observed)")) + + if year > 0 and date(year+1, 1, 1).weekday() == SAT: + new_holidays.append((date(year, 12, 31,), + "New Years Day (Observed)")) + + year = holiday_lookup[0].year + if (date(year, 12, 25) in holiday_lookup + and date(year, 12, 24) in holiday_lookup and + date(year, 12, 25).weekday() == SAT): + new_holidays.append((date(year, 12, 23), + "Christmas Eve (Observed)")) + if (date(year, 12, 25) in holiday_lookup + and date(year, 12, 24) in holiday_lookup and + date(year, 12, 25).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 + + +class WashingtonsBirthdayInDecemberMixin(Calendar): + """Floating observance, to give long weekend at christmas""" + def get_washington_birthday(self, year, + label="Washington's Birthday (Observed)"): + chrsitmas_day = date(year, 12, 25).weekday() + if chrsitmas_day == MON: + day = (date(year, 12, 26), label) # TUE + elif chrsitmas_day == TUE: + day = (date(year, 12, 24), label) # MON + elif chrsitmas_day == WED: + day = (date(year, 12, 24), label) # TUE + elif chrsitmas_day == THU: + day = (date(year, 12, 26), label) # FRI + elif chrsitmas_day == FRI: + day = (date(year, 12, 24), label) # THU + elif chrsitmas_day == SAT: + day = (date(year, 12, 23), label) # THU + else: # chrsitmas_day == SUN: + day = (date(year, 12, 23), label) # FRI + return day + + +class CesarChavezDayMixin(Calendar): + """31st of March, float to 1st April if Monday""" + def get_chavez_day(self, year): + days = [(date(year, 3, 31), "Cesar Chavez Day")] + if date(year, 3, 31).weekday() == SUN: + days += [(date(year, 4, 1), "Cesar Chavez Day (Observed)")] + return days + + +class MardiGrasMixin(ChristianMixin): + """Tuesday before Ash Wednesday""" + def get_mardis_gras(self, year): + sunday = self.get_easter_sunday(year) + return (sunday - timedelta(days=47), "Mardi Gras") + + +class DayAfterChristmasNoFloatMixin(Calendar): + """26th of December - but doesn't ever float""" + def get_day_after_christmas(self, year): + days = (date(year, 12, 26), "Day After Christmas") + return days + + +class PatriotsDayMixin(Calendar): + """3rd Monday of April""" + def get_patriots_day(self, year): + days = (self.get_nth_weekday_in_month(year, 4, MON, 3), + "Patriots Day") + return days + + +class ConfederateMemorialDayMixin(Calendar): + """4th Monday of April""" + def get_confederate_day(self, year): + return (Alabama.get_nth_weekday_in_month(year, 4, MON, 4), + "Confederate Day") + + +class ThanksgivingFridayMixin(Calendar): + "4th Friday in November" + def get_thanksgiving_friday(self, year, label="Thanksgiving Friday"): + return (self.get_nth_weekday_in_month(year, 11, FRI, 4), label) + + +class Alabama(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ConfederateMemorialDayMixin): + "Alabama" + def get_variable_days(self, year): + days = super(Alabama, self).get_variable_days(year) + days = super(Alabama, self).float(days) + days = days + [self.get_confederate_day(year)] + days = days + [(Alabama.get_nth_weekday_in_month(year, 6, MON, 1), + "Jefferson Davis Birthday")] + return days + + def get_fixed_holidays(self, year): + days = super(Alabama, self).get_fixed_holidays(year) + days = super(Alabama, self).float(days, year) + return days + + +class Alaska(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Alaska""" + FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + ( + (10, 18, 'Alaska Day'), + ) + + def get_variable_days(self, year): + days = super(Alaska, self).get_variable_days(year) + days = super(Alaska, self).float(days) + days = days + [(Alabama.get_last_weekday_in_month(year, 3, MON), + "Seward's Day")] + return days + + def get_fixed_holidays(self, year): + days = super(Alaska, self).get_fixed_holidays(year) + days = super(Alaska, self).float(days, year) + return days + + +class Arizona(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Arizona""" + def get_variable_days(self, year): + days = super(Arizona, self).get_variable_days(year) + days = super(Arizona, self).float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Arizona, self).get_fixed_holidays(year) + days = super(Arizona, self).float(days, year) + return days + + +class Arkansas(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Arkansas""" + include_christmas_eve = True + + def get_variable_days(self, year): + days = super(Arkansas, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Arkansas, self).get_fixed_holidays(year) + days = super(Arkansas, self).float(days, year) + return days + + +class California(UnitedStates, WesternCalendar, ThanksgivingFridayMixin, + FloatToNearestWeekdayMixin, CesarChavezDayMixin): + """California""" + def get_variable_days(self, year): + days = super(California, self).get_variable_days(year) + days += [self.get_thanksgiving_friday(year)] + days += [(self.get_nth_weekday_in_month(year, 10, MON, 2), + "Indingenous People's Day")] + days += self.get_chavez_day(year) + return days + + def get_fixed_holidays(self, year): + days = super(California, self).get_fixed_holidays(year) + days = super(California, self).float(days, year) + return days + + +class Colorado(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + CesarChavezDayMixin): + """Colorado""" + + def get_variable_days(self, year): + days = super(Colorado, self).get_variable_days(year) + days += self.get_chavez_day(year) + return days + + def get_fixed_holidays(self, year): + days = super(Colorado, self).get_fixed_holidays(year) + days = super(Colorado, self).float(days, year) + return days + + +class Connecticut(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Connecticut""" + FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + ( + (2, 12, "Lincoln's Birthday"), + ) + + include_good_friday = True + + def get_variable_days(self, year): + days = super(Connecticut, self).get_variable_days(year) + days = super(Connecticut, self).float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Connecticut, self).get_fixed_holidays(year) + days = super(Connecticut, self).float(days, year) + return days + + +class Delaware(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Delaware""" + + include_good_friday = True + + def get_variable_days(self, year): + days = super(Delaware, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Delaware, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Florida(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Florida""" + def get_variable_days(self, year): + days = super(Florida, self).get_variable_days(year) + days = super(Florida, self).float(days) + days = days + [(Florida.get_nth_weekday_in_month(year, 11, FRI, 4), + "Friday after Thanksgiving")] + return days + + def get_fixed_holidays(self, year): + days = super(Florida, self).get_fixed_holidays(year) + days = super(Florida, self).float(days, year) + return days + + +class Georgia(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + WashingtonsBirthdayInDecemberMixin, ConfederateMemorialDayMixin): + """Georgia""" + def get_variable_days(self, year): + days = super(Georgia, self).get_variable_days(year) + days = super(Georgia, self).float(days) + days += [self.get_confederate_day(year)] + days += [(Georgia.get_nth_weekday_in_month(year, 11, FRI, 4), + "Robert E. Lee's Birthday (Observed)")] + days += [self.get_washington_birthday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Georgia, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Hawaii(UnitedStates, WesternCalendar): + """Hawaii""" + pass + + +class Idaho(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Idaho""" + def get_variable_days(self, year): + days = super(Idaho, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Idaho, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Illinois(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Illinois""" + FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + ( + (2, 12, "Lincoln's Birthday"), + ) + + def get_variable_days(self, year): + days = super(Illinois, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Illinois, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Indiana(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + WashingtonsBirthdayInDecemberMixin, ThanksgivingFridayMixin): + """Indiana""" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Indiana, self).get_variable_days(year) + days = self.float(days) + days += [self.get_washington_birthday(year)] + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Indiana, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Iowa(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Iowa""" + def get_variable_days(self, year): + days = super(Iowa, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Iowa, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Kansas(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin, DayAfterChristmasNoFloatMixin): + """Kansas""" + include_christmas_eve = True + + def get_variable_days(self, year): + days = super(Kansas, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + days += [self.get_day_after_christmas(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Kansas, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Kentucky(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin, DayAfterChristmasNoFloatMixin): + """Kentucky""" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Kentucky, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + days += [self.get_day_after_christmas(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Kentucky, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Louisiana(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + MardiGrasMixin): + """Louisiana""" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Louisiana, self).get_variable_days(year) + days = self.float(days) + days += [self.get_mardis_gras(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Louisiana, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Maine(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + PatriotsDayMixin, ThanksgivingFridayMixin): + """Maine""" + + def get_variable_days(self, year): + days = super(Maine, self).get_variable_days(year) + days = self.float(days) + days += [self.get_patriots_day(year)] + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Maine, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Maryland(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Maryland""" + def get_variable_days(self, year): + days = super(Maryland, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Maryland, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Massachusetts(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + PatriotsDayMixin): + """Massachusetts""" + def get_variable_days(self, year): + days = super(Massachusetts, self).get_variable_days(year) + days = self.float(days) + days += [self.get_patriots_day(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Massachusetts, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Michigan(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Michigan""" + include_christmas_eve = True + + def get_variable_days(self, year): + days = super(Michigan, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Michigan, self).get_fixed_holidays(year) + days += [(date(year, 12, 31), "New Years Eve")] + days = self.float(days, year) + return days + + +class Minnesota(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Minnesota""" + def get_variable_days(self, year): + days = super(Minnesota, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Minnesota, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Mississippi(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin, ConfederateMemorialDayMixin): + """Mississippi""" + def get_variable_days(self, year): + days = super(Mississippi, self).get_variable_days(year) + days = self.float(days) + days += [self.get_confederate_day(year)] + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Mississippi, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Missouri(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Missouri""" + FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + ( + (2, 12, "Lincoln's Birthday"), + (5, 8, "Truman Day"), + ) + + def get_variable_days(self, year): + days = super(Missouri, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Missouri, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Montana(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Montana""" + + def get_variable_days(self, year): + days = super(Montana, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Montana, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Nebraska(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Nebraska""" + def get_variable_days(self, year): + days = super(Nebraska, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + days += [(self.get_last_weekday_in_month(year, 4, FRI), + "Arbor Day")] + return days + + def get_fixed_holidays(self, year): + days = super(Nebraska, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Nevada(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Nevada""" + def get_variable_days(self, year): + days = super(Nevada, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + days += [(self.get_last_weekday_in_month(year, 10, FRI), + "Nevada Day")] + return days + + def get_fixed_holidays(self, year): + days = super(Nevada, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class NewHampshire(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """NewHampshire""" + def get_variable_days(self, year): + days = super(NewHampshire, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(NewHampshire, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class NewJersey(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """NewJersey""" + include_good_friday = True + + def get_variable_days(self, year): + days = super(NewJersey, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(NewJersey, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class NewMexico(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """NewMexico""" + def get_variable_days(self, year): + days = super(NewMexico, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(NewMexico, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class NewYork(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """NewYork""" + FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + ( + (2, 12, "Lincoln's Birthday"), + ) + + def get_variable_days(self, year): + days = super(NewYork, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(NewYork, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class NorthCarolina(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin, DayAfterChristmasNoFloatMixin): + """NorthCarolina""" + include_good_friday = True + include_christmas_eve = True + + def get_variable_days(self, year): + days = super(NorthCarolina, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + days += [self.get_day_after_christmas(year)] + return days + + def get_fixed_holidays(self, year): + days = super(NorthCarolina, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class NorthDakota(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """NorthDakota""" + include_good_friday = True + + def get_variable_days(self, year): + days = super(NorthDakota, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(NorthDakota, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Ohio(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Ohio""" + FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + ( + (12, 1, "Rosa Parks Day"), + ) + + def get_variable_days(self, year): + days = super(Ohio, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Ohio, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Oklahoma(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Oklahoma""" + include_christmas_eve = True + + def get_variable_days(self, year): + days = super(Oklahoma, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Oklahoma, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Oregon(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Oregon""" + + def get_variable_days(self, year): + days = super(Oregon, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Oregon, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Pennsylvania(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Pennsylvania""" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Pennsylvania, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Pennsylvania, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class RhodeIsland(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """RhodeIsland""" + + def get_variable_days(self, year): + days = super(RhodeIsland, self).get_variable_days(year) + days = self.float(days) + days += [(self.get_nth_weekday_in_month(year, 8, MON, 2), + "Victory Day")] + return days + + def get_fixed_holidays(self, year): + days = super(RhodeIsland, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class SouthCarolina(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin, DayAfterChristmasNoFloatMixin): + """SouthCarolina""" + FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + ( + (5, 10, "Confederate Memorial Day"), + ) + include_good_friday = True + include_christmas_eve = True + + def get_variable_days(self, year): + days = super(SouthCarolina, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + days += [self.get_day_after_christmas(year)] + return days + + def get_fixed_holidays(self, year): + days = super(SouthCarolina, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class SouthDakota(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """SouthDakota""" + def get_variable_days(self, year): + days = super(SouthDakota, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(SouthDakota, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Tennessee(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Tennessee""" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Tennessee, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Tennessee, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Texas(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + CesarChavezDayMixin): + """Texas""" + include_good_friday = True + + def get_variable_days(self, year): + days = super(Texas, self).get_variable_days(year) + days = self.float(days) + days += self.get_chavez_day(year) + return days + + def get_fixed_holidays(self, year): + days = super(Texas, self).get_fixed_holidays(year) + days = self.float(days, year) + days += [(date(year, 1, 19), "Confederate Heroes Day")] + days += [(date(year, 3, 2), "Texas Independence Day")] + days += [(date(year, 4, 21), "San Jacinto Day")] + days += [(date(year, 6, 19), "Emancipation Day")] + days += [(date(year, 8, 27), "Lyndon B. Jonhson Day")] + return days + + +class Utah(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Utah""" + FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + ( + (7, 24, "Pioneer Day"), + ) + + def get_variable_days(self, year): + days = super(Utah, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Utah, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Vermont(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Vermont""" + FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + ( + (8, 16, "Bennington Battle Day"), + ) + + def get_variable_days(self, year): + days = super(Vermont, self).get_variable_days(year) + days = self.float(days) + days += [(self.get_nth_weekday_in_month(year, 3, TUE, 1), + "Town Meeting Day")] + return days + + def get_fixed_holidays(self, year): + days = super(Vermont, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class Virginia(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin, DayAfterChristmasNoFloatMixin): + """Virginia""" + include_christmas_eve = True + + def get_variable_days(self, year): + days = super(Virginia, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + days += [(self.get_nth_weekday_in_month(year, 1, FRI, 3), + "Lee-Jackson Day")] + days += [(self.get_nth_weekday_in_month(year, 11, WED, 4), + "Additional Thanksgiving Holiday")] + return days + + def get_fixed_holidays(self, year): + days = super(Virginia, self).get_fixed_holidays(year) + days = self.float(days, year) + days += [self.get_day_after_christmas(year)] + return days + + +class Washington(UnitedStates, WesternCalendar, ThanksgivingFridayMixin, + FloatToNearestWeekdayMixin): + """Washington""" + def get_variable_days(self, year): + days = super(Washington, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Washington, self).get_fixed_holidays(year) + days = self.float(days, year) + return days + + +class WestVirginia(UnitedStates, WesternCalendar, ThanksgivingFridayMixin, + FloatToNearestWeekdayMixin): + """WestVirginia""" + include_christmas_eve = True + + def get_variable_days(self, year): + days = super(WestVirginia, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + days += [(date(year, 6, 20), "West Virgina Day")] + if date(year, 6, 20).weekday() == SUN: + days += [(date(year, 6, 21), "West Virgina Day (Observed)")] + + return days + + def get_fixed_holidays(self, year): + days = super(WestVirginia, self).get_fixed_holidays(year) + days = self.float(days, year) + days += [(date(year, 12, 31), "New Years Eve")] + return days + + +class Wisconsin(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin, + ThanksgivingFridayMixin): + """Wisconsin""" + include_christmas_eve = True + + def get_variable_days(self, year): + days = super(Wisconsin, self).get_variable_days(year) + days = self.float(days) + days += [self.get_thanksgiving_friday(year)] + return days + + def get_fixed_holidays(self, year): + days = super(Wisconsin, self).get_fixed_holidays(year) + days += [(date(year, 12, 31), "New Years Eve")] + days = self.float(days, year) + return days + + +class Wyoming(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin): + """Wyoming""" + def get_variable_days(self, year): + days = super(Wyoming, self).get_variable_days(year) + days = self.float(days) + return days + + def get_fixed_holidays(self, year): + days = super(Wyoming, self).get_fixed_holidays(year) + days = self.float(days, year) + return days