Skip to content

Commit

Permalink
Added Canary Islands calendar
Browse files Browse the repository at this point in the history
refs #531
  • Loading branch information
brunobord committed Oct 2, 2020
1 parent bf7b48d commit 91bdc57
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Changelog.md
Expand Up @@ -2,7 +2,7 @@

## master (unreleased)

- Added Spain regions: Andalusia, Aragon, Castile and León, Castilla-La Mancha (#531).
- Added Spain regions: Andalusia, Aragon, Castile and León, Castilla-La Mancha, Canary Islands (#531).
- Refactored Spain test modules (#531).
- Fix Catalonia calendar by removing *Sant Juan* day, which does not appear to be an official holiday (#531).

Expand Down
5 changes: 3 additions & 2 deletions workalendar/europe/__init__.py
Expand Up @@ -31,7 +31,8 @@
from .slovakia import Slovakia
from .slovenia import Slovenia
from .spain import (
Andalusia, Aragon, Spain, Catalonia, CastileAndLeon, CastillaLaMancha
Andalusia, Aragon, Spain, Catalonia, CastileAndLeon, CastillaLaMancha,
CanaryIslands
)
from .sweden import Sweden
from .ukraine import Ukraine
Expand Down Expand Up @@ -120,7 +121,7 @@

# Spain
'Spain', 'Andalusia', 'Aragon', 'Catalonia', 'CastileAndLeon',
'CastillaLaMancha',
'CastillaLaMancha', 'CanaryIslands',

# Switzerland
'Switzerland',
Expand Down
10 changes: 10 additions & 0 deletions workalendar/europe/spain.py
Expand Up @@ -63,6 +63,16 @@ class CastillaLaMancha(Spain):
include_holy_thursday = True # Also called Maundy thursday


@iso_register('ES-CN')
class CanaryIslands(Spain):
"Canary Islands"
FIXED_HOLIDAYS = Spain.FIXED_HOLIDAYS + (
(5, 30, "Día de Canarias"),
)
# Christian holiday
include_holy_thursday = True # Also called Maundy thursday


@iso_register('ES-CT')
class Catalonia(Spain):
"Catalonia"
Expand Down
6 changes: 4 additions & 2 deletions workalendar/tests/test_registry_europe.py
Expand Up @@ -12,7 +12,8 @@

# Spain & regions
from ..europe import (
Spain, Andalusia, Aragon, Catalonia, CastileAndLeon, CastillaLaMancha
Spain, Andalusia, Aragon, Catalonia, CastileAndLeon, CastillaLaMancha,
CanaryIslands,
)

# Switzerland
Expand Down Expand Up @@ -52,7 +53,8 @@
)

SPAIN_REGION_CLASSES = (
Andalusia, Aragon, Catalonia, CastileAndLeon, CastillaLaMancha
Andalusia, Aragon, Catalonia, CastileAndLeon, CastillaLaMancha,
CanaryIslands
)


Expand Down
17 changes: 17 additions & 0 deletions workalendar/tests/test_spain.py
Expand Up @@ -3,6 +3,7 @@
from . import GenericCalendarTest
from ..europe import (
Spain, Andalusia, Aragon, Catalonia, CastileAndLeon, CastillaLaMancha,
CanaryIslands,
)


Expand Down Expand Up @@ -108,6 +109,22 @@ def test_region_year_2020(self):
self.assertEqual(len(holidays), 12)


class CanaryIslandsTest(SpainTest):
cal_class = CanaryIslands

def test_region_year_2019(self):
holidays = self.cal.holidays_set(2019)
self.assertIn(date(2019, 4, 18), holidays) # Maundy/Holy Thursday
self.assertIn(date(2019, 5, 30), holidays) # Regional Day
self.assertEqual(len(holidays), 12)

def test_region_year_2020(self):
holidays = self.cal.holidays_set(2020)
self.assertIn(date(2020, 4, 9), holidays) # Maundy/Holy Thursday
self.assertIn(date(2020, 5, 30), holidays) # Regional Day
self.assertEqual(len(holidays), 12)


class CataloniaTest(SpainTest):
cal_class = Catalonia

Expand Down

0 comments on commit 91bdc57

Please sign in to comment.