Skip to content

Commit

Permalink
Dates limites relatives aux commémorations de l'abolition de l'esclav…
Browse files Browse the repository at this point in the history
…age (#9)

Resolves #8
  • Loading branch information
TeddyBear06 authored Sep 9, 2021
1 parent 8ee3371 commit 36324bf
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 6 deletions.
12 changes: 6 additions & 6 deletions jours_feries_france/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,25 +172,25 @@ def deuxieme_jour_noel(year, zone):

@staticmethod
def abolition_esclavage(year, zone):
if zone == JoursFeries.check_zone("Mayotte"):
if zone == JoursFeries.check_zone("Mayotte") and year >= 1983:
return date(year, 4, 27)

if zone == JoursFeries.check_zone("Martinique"):
if zone == JoursFeries.check_zone("Martinique") and year >= 1983:
return date(year, 5, 22)

if zone == JoursFeries.check_zone("Guadeloupe"):
if zone == JoursFeries.check_zone("Guadeloupe") and year >= 1983:
return date(year, 5, 27)

if zone == JoursFeries.check_zone("Saint-Martin"):
if year >= 2018:
return date(year, 5, 28)
else:
elif year >= 1983:
return date(year, 5, 27)

if zone == JoursFeries.check_zone("Guyane"):
if zone == JoursFeries.check_zone("Guyane") and year >= 1983:
return date(year, 6, 10)

if zone == JoursFeries.check_zone("Saint-Barthélémy"):
if zone == JoursFeries.check_zone("Saint-Barthélémy") and year >= 1983:
return date(year, 10, 9)

if zone == JoursFeries.check_zone("La Réunion") and year >= 1981:
Expand Down
59 changes: 59 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,62 @@ def testAbolition_esclavage(self):
self.assertEquals(
JoursFeries.abolition_esclavage(2018, "Saint-Martin"), date(2018, 5, 28)
)

# Gestion des dates antérieures au décret officiel relatif à la commémoration de l'abolition de l'esclavage
# https://www.legifrance.gouv.fr/loda/id/JORFTEXT000000336997/

# Mayotte
self.assertEquals(
JoursFeries.abolition_esclavage(1982, "Mayotte"), None
)
self.assertEquals(
JoursFeries.abolition_esclavage(1983, "Mayotte"), date(1983, 4, 27)
)

# Martinique
self.assertEquals(
JoursFeries.abolition_esclavage(1982, "Martinique"), None
)
self.assertEquals(
JoursFeries.abolition_esclavage(1983, "Martinique"), date(1983, 5, 22)
)

# Guadeloupe
self.assertEquals(
JoursFeries.abolition_esclavage(1982, "Guadeloupe"), None
)
self.assertEquals(
JoursFeries.abolition_esclavage(1983, "Guadeloupe"), date(1983, 5, 27)
)

# Saint-Martin
self.assertEquals(
JoursFeries.abolition_esclavage(1982, "Saint-Martin"), None
)
self.assertEquals(
JoursFeries.abolition_esclavage(1983, "Saint-Martin"), date(1983, 5, 27)
)

# Guyane
self.assertEquals(
JoursFeries.abolition_esclavage(1982, "Guyane"), None
)
self.assertEquals(
JoursFeries.abolition_esclavage(1983, "Guyane"), date(1983, 6, 10)
)

# Saint-Barthélémy
self.assertEquals(
JoursFeries.abolition_esclavage(1982, "Saint-Barthélémy"), None
)
self.assertEquals(
JoursFeries.abolition_esclavage(1983, "Saint-Barthélémy"), date(1983, 10, 9)
)

# La Réunion
self.assertEquals(
JoursFeries.abolition_esclavage(1980, "La Réunion"), None
)
self.assertEquals(
JoursFeries.abolition_esclavage(1981, "La Réunion"), date(1981, 12, 20)
)

0 comments on commit 36324bf

Please sign in to comment.