Skip to content

Commit

Permalink
Relocated all tests to separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
s-weigand committed Oct 17, 2020
1 parent c98f728 commit ed1c7e3
Show file tree
Hide file tree
Showing 65 changed files with 8,450 additions and 0 deletions.
Empty file.
157 changes: 157 additions & 0 deletions tests/countries/test_argentina.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
from datetime import date
from dateutil.relativedelta import relativedelta
import unittest

import holidays


class TestAR(unittest.TestCase):
def setUp(self):
self.holidays = holidays.AR(observed=True)

def test_new_years(self):
self.holidays.observed = False
self.assertNotIn(date(2010, 12, 31), self.holidays)
self.assertNotIn(date(2017, 1, 2), self.holidays)
self.holidays.observed = True
self.assertIn(date(2017, 1, 1), self.holidays)
for year in range(1900, 2100):
dt = date(year, 1, 1)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_carnival_day(self):
for dt in [
date(2018, 2, 12),
date(2018, 2, 13),
date(2017, 2, 27),
date(2017, 2, 28),
date(2016, 2, 8),
date(2016, 2, 9),
]:
self.assertIn(dt, self.holidays)

def test_memory_national_day(self):
self.holidays.observed = False
self.assertNotIn(date(1907, 3, 24), self.holidays)
self.assertNotIn(date(2002, 3, 24), self.holidays)
self.holidays.observed = True
for dt in [date(2018, 3, 24), date(2017, 3, 24), date(2016, 3, 24)]:
self.assertIn(dt, self.holidays)

def test_holy_week_day(self):
for dt in [
date(2018, 3, 29),
date(2018, 3, 30),
date(2017, 4, 13),
date(2017, 4, 14),
date(2016, 3, 24),
date(2016, 3, 25),
]:
self.assertIn(dt, self.holidays)

def test_malvinas_war_day(self):
for year in range(1900, 2100):
dt = date(year, 4, 2)
self.assertIn(dt, self.holidays)

def test_labor_day(self):
self.holidays.observed = False
self.assertNotIn(date(2010, 4, 30), self.holidays)
self.assertNotIn(date(2011, 5, 2), self.holidays)
self.holidays.observed = True
self.assertIn(date(1922, 5, 1), self.holidays)
for year in range(1900, 2100):
dt = date(year, 5, 1)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_may_revolution_day(self):
self.holidays.observed = False
self.assertNotIn(date(1930, 5, 25), self.holidays)
self.assertNotIn(date(2014, 5, 25), self.holidays)
self.holidays.observed = True
for year in range(1900, 2100):
dt = date(year, 5, 1)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_guemes_day(self):
for year in range(1900, 2100):
dt = date(year, 6, 17)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_belgrano_day(self):
for year in range(1900, 2100):
dt = date(year, 6, 20)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_independence_day(self):
self.holidays.observed = False
self.assertNotIn(date(2017, 7, 9), self.holidays)
self.assertNotIn(date(2011, 7, 9), self.holidays)
self.holidays.observed = True
self.assertIn(date(2017, 7, 9), self.holidays)
self.assertIn(date(2011, 7, 9), self.holidays)
for year in range(1900, 2100):
dt = date(year, 7, 9)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_san_martin_day(self):
self.holidays.observed = False
self.assertNotIn(date(1930, 8, 10), self.holidays)
self.assertNotIn(date(2008, 8, 10), self.holidays)
self.holidays.observed = True
for year in range(1900, 2100):
dt = date(year, 8, 17)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_cultural_day(self):
self.holidays.observed = False
self.assertNotIn(date(2014, 10, 12), self.holidays)
self.assertNotIn(date(1913, 10, 12), self.holidays)
self.holidays.observed = True
for year in range(1900, 2100):
dt = date(year, 10, 12)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_national_sovereignty_day(self):
for year in range(1900, 2100):
dt = date(year, 11, 20)
if year < 2010:
self.assertNotIn(dt, self.holidays)
else:
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_inmaculate_conception_day(self):
self.holidays.observed = False
self.assertNotIn(date(1940, 12, 8), self.holidays)
self.assertNotIn(date(2013, 12, 8), self.holidays)
self.holidays.observed = True
for year in range(1900, 2100):
dt = date(year, 12, 8)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)

def test_christmas(self):
for year in range(1900, 2100):
dt = date(year, 12, 25)
self.assertIn(dt, self.holidays)
self.assertNotIn(dt + relativedelta(days=-1), self.holidays)
self.assertNotIn(dt + relativedelta(days=+1), self.holidays)
89 changes: 89 additions & 0 deletions tests/countries/test_aruba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
from datetime import date
import unittest

import holidays


class TestAruba(unittest.TestCase):
def setUp(self):
self.holidays = holidays.AW()

def test_2017(self):
self.assertIn(date(2017, 1, 1), self.holidays)
self.assertIn(date(2017, 1, 25), self.holidays)
self.assertIn(date(2017, 3, 18), self.holidays)
self.assertIn(date(2017, 2, 27), self.holidays)
self.assertIn(date(2017, 4, 14), self.holidays)
self.assertIn(date(2017, 4, 17), self.holidays)
self.assertIn(date(2017, 4, 27), self.holidays)
self.assertIn(date(2017, 5, 1), self.holidays)
self.assertIn(date(2017, 5, 25), self.holidays)
self.assertIn(date(2017, 12, 25), self.holidays)
self.assertIn(date(2017, 12, 26), self.holidays)

def test_new_years(self):
self.assertIn(date(2017, 1, 1), self.holidays)

def test_betico_day(self):
self.assertIn(date(2017, 1, 25), self.holidays)

def test_carnaval_monday(self):
self.assertIn(date(2017, 2, 27), self.holidays)

def test_anthem_and_flag_day(self):
self.assertIn(date(2017, 3, 18), self.holidays)

def test_good_friday(self):
self.assertIn(date(2017, 4, 14), self.holidays)

def test_easter_monday(self):
self.assertIn(date(2017, 4, 17), self.holidays)

def test_labour_day(self):
self.assertIn(date(2017, 5, 1), self.holidays)

def test_queens_day_between_1891_and_1948(self):
# Between 1891 and 1948 Queens Day was celebrated on 8-31
self.holidays = holidays.AW(years=[1901])
self.assertIn(date(1901, 8, 31), self.holidays)

def test_queens_day_between_1891_and_1948_substituted_later(self):
# Between 1891 and 1948 Queens Day was celebrated on 9-1
# (one day later) when Queens Day falls on a Sunday
self.holidays = holidays.AW(years=[1947])
self.assertIn(date(1947, 9, 1), self.holidays)

def test_queens_day_between_1949_and_2013(self):
self.holidays = holidays.AW(years=[1965])
self.assertIn(date(1965, 4, 30), self.holidays)

def test_queens_day_between_1949_and_1980_substituted_later(self):
self.holidays = holidays.AW(years=[1967])
self.assertIn(date(1967, 5, 1), self.holidays)

def test_queens_day_between_1980_and_2013_substituted_earlier(self):
self.holidays = holidays.AW(years=[2006])
self.assertIn(date(2006, 4, 29), self.holidays)

def test_kings_day_after_2014(self):
self.holidays = holidays.AW(years=[2013])
self.assertNotIn(date(2013, 4, 27), self.holidays)

self.holidays = holidays.AW(years=[2017])
self.assertIn(date(2017, 4, 27), self.holidays)

def test_kings_day_after_2014_substituted_earlier(self):
self.holidays = holidays.AW(years=[2188])
self.assertIn(date(2188, 4, 26), self.holidays)

def test_ascension_day(self):
self.holidays = holidays.AW(years=2017)
self.assertIn(date(2017, 5, 25), self.holidays)

def test_christmas(self):
self.holidays = holidays.AW(years=2017)
self.assertIn(date(2017, 12, 25), self.holidays)

def test_second_christmas(self):
self.holidays = holidays.AW(years=2017)
self.assertIn(date(2017, 12, 26), self.holidays)
Loading

0 comments on commit ed1c7e3

Please sign in to comment.