Skip to content

Commit

Permalink
Merge 69fb4ed into 07aaebd
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jan 14, 2018
2 parents 07aaebd + 69fb4ed commit 5b4c1ed
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 57 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Expand Up @@ -3,15 +3,12 @@
language: python

python:
- 2.6
- 2.7
- 3.3
- 3.4
- 3.5
- 3.6
- pypy
- pypy3.3-5.2-alpha1 # Python 3.3
- pypy3.5-5.8.0 # Python 3.5
- pypy3

env:
- DATEUTIL=python-dateutil==2.2
Expand All @@ -20,8 +17,7 @@ env:
install:
- pip install $DATEUTIL
- python setup.py install
- if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install flake8==2.6.2; fi
- if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then pip install flake8==3.4.1; fi
- pip install flake8
- pip install coveralls

before_script:
Expand Down
9 changes: 7 additions & 2 deletions CHANGES
@@ -1,3 +1,10 @@
Version 0.10
============

Unreleased

- Drop support for EOL Python 2.5, 2.6, 3.2 and 3.3

Version 0.9.1
=============

Expand All @@ -6,7 +13,6 @@ Released January 14, 2018
- Added tests for Irish calendar
- minor fixes and refactoring


Version 0.9
===========

Expand All @@ -24,7 +30,6 @@ Released January 14, 2018 (PR merging by dr-prodigy)
- Add AU/Queensland The Ekka Show (kirpit)
- Various fixes


Version 0.8.1
=============

Expand Down
18 changes: 9 additions & 9 deletions holidays.py
Expand Up @@ -119,10 +119,10 @@ def pop(self, key, default=None):
return dict.pop(self, self.__keytransform__(key), default)

def __eq__(self, other):
return (dict.__eq__(self, other) and self.__dict__ == other.__dict__)
return dict.__eq__(self, other) and self.__dict__ == other.__dict__

def __ne__(self, other):
return (dict.__ne__(self, other) or self.__dict__ != other.__dict__)
return dict.__ne__(self, other) or self.__dict__ != other.__dict__

def __add__(self, other):
if isinstance(other, int) and other == 0:
Expand Down Expand Up @@ -276,11 +276,11 @@ def _populate(self, year):
else:
self[dt1] = "St. George's Day"

# Victoria Day / National Patriotes Day (QC)
# Victoria Day / National Patriots' Day (QC)
if self.prov not in ('NB', 'NS', 'PE', 'NL', 'QC') and year >= 1953:
self[date(year, 5, 24) + rd(weekday=MO(-1))] = "Victoria Day"
elif self.prov == 'QC' and year >= 1953:
name = "National Patriotes Day"
name = "National Patriots' Day"
self[date(year, 5, 24) + rd(weekday=MO(-1))] = name

# National Aboriginal Day
Expand Down Expand Up @@ -693,7 +693,7 @@ def _populate(self, year):
# Lincoln's Birthday
name = "Lincoln's Birthday"
if (self.state in ('CT', 'IL', 'IA', 'NJ', 'NY') and year >= 1971) \
or (self.state == 'CA' and year >= 1971 and year <= 2009):
or (self.state == 'CA' and 1971 <= year <= 2009):
self[date(year, 2, 12)] = name
if self.observed and date(year, 2, 12).weekday() == 5:
self[date(year, 2, 11)] = name + " (Observed)"
Expand Down Expand Up @@ -2076,8 +2076,8 @@ def _populate(self, year):

e = easter(year)

# carnival is no longer a holyday, but some companies let workers off.
# @todo recollect the years in which it was a public holyday
# carnival is no longer a holiday, but some companies let workers off.
# @todo recollect the years in which it was a public holiday
# self[e - rd(days=47)] = "Carnaval"
self[e - rd(days=2)] = "Sexta-feira Santa"
self[e] = "Páscoa"
Expand Down Expand Up @@ -2107,7 +2107,7 @@ class PortugalExt(Portugal):
- Carnival
- the day before and after xmas
- the day before the new year
- Lisbon's city holyday
- Lisbon's city holiday
"""
def _populate(self, year):
super(PortugalExt, self)._populate(year)
Expand Down Expand Up @@ -2176,7 +2176,7 @@ def _populate(self, year):
self[kings_day] = "Koningsdag"

# Queen's day
if year >= 1891 and year <= 2013:
if 1891 <= year <= 2013:
queens_day = date(year, 4, 30)
if year <= 1948:
queens_day = date(year, 8, 31)
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Expand Up @@ -35,7 +35,7 @@
py_modules=['holidays'],
description='Generate and work with holidays in Python',
long_description=codecs.open('README.rst', encoding='utf-8').read(),
install_requires=['python-dateutil'],
install_requires=['python-dateutil', 'six'],
platforms='any',
classifiers=[
'Development Status :: 4 - Beta',
Expand All @@ -44,15 +44,12 @@
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Office/Business :: Scheduling',
'Topic :: Software Development :: Libraries :: Python Modules',
Expand Down
70 changes: 35 additions & 35 deletions tests.py
Expand Up @@ -126,8 +126,8 @@ def test_add(self):
ca = holidays.CA(years=[2014], expand=False)
us = holidays.US(years=[2014, 2015], expand=True)
self.assertTrue((ca+us).expand)
self.assertEqual((ca+us).years, set([2014, 2015]))
self.assertEqual((us+ca).years, set([2014, 2015]))
self.assertEqual((ca+us).years, {2014, 2015})
self.assertEqual((us+ca).years, {2014, 2015})
na = holidays.CA()
na += holidays.US()
na += holidays.MX()
Expand Down Expand Up @@ -1080,9 +1080,9 @@ def test_washingtons_birthday(self):
("George Washington's Birthday "
"and Daisy Gatson Bates Day"))
self.assertTrue(holidays.US(state='PR').get('2015-02-16'),
("Presidents' Day"))
"Presidents' Day")
self.assertTrue(holidays.US(state='VI').get('2015-02-16'),
("Presidents' Day"))
"Presidents' Day")

def test_mardi_gras(self):
la_holidays = holidays.US(state='LA')
Expand Down Expand Up @@ -1346,7 +1346,7 @@ def test_kamehameha_day(self):
self.assertFalse(date(2006, 6, 12) in hi_holidays)
for dt in [date(2011, 6, 10), date(2016, 6, 10), date(2017, 6, 12)]:
self.assertTrue(dt in hi_holidays)
hi_holidays.get(dt) == "Kamehameha Day (Observed)"
self.assertEqual(hi_holidays.get(dt), "Kamehameha Day (Observed)")
hi_holidays.observed = False
for dt in [date(2011, 6, 10), date(2016, 6, 10), date(2017, 6, 12)]:
self.assertFalse(dt in hi_holidays)
Expand Down Expand Up @@ -2115,7 +2115,7 @@ def test_all_holidays_present(self):
all_holidays.insert(2, "New Zealand Day")
for holiday in all_holidays:
self.assertTrue(holiday in holidays_in_1974, holiday)
self.assertFalse("Waitangi Day" in holidays_in_1974, holiday)
self.assertFalse("Waitangi Day" in holidays_in_1974)


class TestAU(unittest.TestCase):
Expand Down Expand Up @@ -2377,28 +2377,28 @@ def test_all_holidays_present(self):
de_2015 = sum(holidays.DE(years=[2015], prov=p)
for p in holidays.DE.PROVINCES)
in_2015 = sum((de_2015.get_list(key) for key in de_2015), [])
all = ["Neujahr",
"Heilige Drei Könige",
"Karfreitag",
"Ostern",
"Ostermontag",
"Maifeiertag",
"Christi Himmelfahrt",
"Pfingsten",
"Pfingstmontag",
"Fronleichnam",
"Mariä Himmelfahrt",
"Tag der Deutschen Einheit",
"Reformationstag",
"Allerheiligen",
"Buß- und Bettag",
"Erster Weihnachtstag",
"Zweiter Weihnachtstag"]

for holiday in all:
self.assertTrue(holiday in in_2015, "missing: {0}".format(holiday))
all_de = ["Neujahr",
"Heilige Drei Könige",
"Karfreitag",
"Ostern",
"Ostermontag",
"Maifeiertag",
"Christi Himmelfahrt",
"Pfingsten",
"Pfingstmontag",
"Fronleichnam",
"Mariä Himmelfahrt",
"Tag der Deutschen Einheit",
"Reformationstag",
"Allerheiligen",
"Buß- und Bettag",
"Erster Weihnachtstag",
"Zweiter Weihnachtstag"]

for holiday in all_de:
self.assertTrue(holiday in in_2015, "missing: {}".format(holiday))
for holiday in in_2015:
self.assertTrue(holiday in all, "extra: {0}".format(holiday))
self.assertTrue(holiday in all_de, "extra: {}".format(holiday))

def test_fixed_holidays(self):
fixed_days_whole_country = (
Expand All @@ -2413,7 +2413,7 @@ def test_fixed_holidays(self):
self.assertTrue(date(y, m, d) in self.holidays)

def test_heilige_drei_koenige(self):
provinces_that_have = set(('BW', 'BY', 'ST'))
provinces_that_have = {'BW', 'BY', 'ST'}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have

for province, year in product(provinces_that_have, range(1991, 2050)):
Expand All @@ -2435,7 +2435,7 @@ def test_ostern(self):
(2017, 4, 16), (2018, 4, 1), (2019, 4, 21),
(2020, 4, 12), (2021, 4, 4), (2022, 4, 17),
(2023, 4, 9), (2024, 3, 31)]
provinces_that_have = set(('BB',))
provinces_that_have = {'BB'}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have

for province, (y, m, d) in product(provinces_that_have, known_good):
Expand Down Expand Up @@ -2466,7 +2466,7 @@ def test_pfingsten(self):
(2017, 6, 4), (2018, 5, 20), (2019, 6, 9),
(2020, 5, 31), (2021, 5, 23), (2022, 6, 5),
(2023, 5, 28), (2024, 5, 19)]
provinces_that_have = set(('BB',))
provinces_that_have = {'BB'}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have

for province, (y, m, d) in product(provinces_that_have, known_good):
Expand All @@ -2488,7 +2488,7 @@ def test_fronleichnam(self):
(2017, 6, 15), (2018, 5, 31), (2019, 6, 20),
(2020, 6, 11), (2021, 6, 3), (2022, 6, 16),
(2023, 6, 8), (2024, 5, 30)]
provinces_that_have = set(('BW', 'BY', 'HE', 'NW', 'RP', 'SL'))
provinces_that_have = {'BW', 'BY', 'HE', 'NW', 'RP', 'SL'}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have

for province, (y, m, d) in product(provinces_that_have, known_good):
Expand All @@ -2497,7 +2497,7 @@ def test_fronleichnam(self):
self.assertTrue(date(y, m, d) not in self.prov_hols[province])

def test_mariae_himmelfahrt(self):
provinces_that_have = set(('BY', 'SL'))
provinces_that_have = {'BY', 'SL'}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have

for province, year in product(provinces_that_have, range(1991, 2050)):
Expand All @@ -2506,7 +2506,7 @@ def test_mariae_himmelfahrt(self):
self.assertTrue(date(year, 8, 15) not in self.prov_hols[province])

def test_reformationstag(self):
provinces_that_have = set(('BB', 'MV', 'SN', 'ST', 'TH'))
provinces_that_have = {'BB', 'MV', 'SN', 'ST', 'TH'}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have

for province, year in product(provinces_that_have, range(1991, 2050)):
Expand All @@ -2524,7 +2524,7 @@ def test_reformationstag(self):
self.assertTrue(date(2017, 10, 31) in self.prov_hols[province])

def test_allerheiligen(self):
provinces_that_have = set(('BW', 'BY', 'NW', 'RP', 'SL'))
provinces_that_have = {'BW', 'BY', 'NW', 'RP', 'SL'}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have

for province, year in product(provinces_that_have, range(1991, 2050)):
Expand All @@ -2537,7 +2537,7 @@ def test_buss_und_bettag(self):
(2017, 11, 22), (2018, 11, 21), (2019, 11, 20),
(2020, 11, 18), (2021, 11, 17), (2022, 11, 16),
(2023, 11, 22), (2024, 11, 20)]
provinces_that_have = set(('SN',))
provinces_that_have = {'SN'}
provinces_that_dont = set(holidays.DE.PROVINCES) - provinces_that_have

for province, (y, m, d) in product(provinces_that_have, known_good):
Expand Down

0 comments on commit 5b4c1ed

Please sign in to comment.