Skip to content

Commit

Permalink
Merge pull request #1 from PPsyrius/pr_942_additional_testcases
Browse files Browse the repository at this point in the history
TH: additional testcases for the rest of Thai Lunar Holidays
  • Loading branch information
arkid15r authored Feb 14, 2023
2 parents 540da12 + a9c2d10 commit e3b108b
Showing 1 changed file with 58 additions and 8 deletions.
66 changes: 58 additions & 8 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from datetime import date

from holidays import utils
from holidays.constants import MAY, JUN, JUL, OCT
from holidays.constants import FEB, MAR, MAY, JUN, JUL, AUG, OCT


class TestCountryHolidays(unittest.TestCase):
Expand Down Expand Up @@ -104,17 +104,34 @@ def setUp(self) -> None:
super().setUpClass()
self.calendar = utils._ThaiLuniSolar()

def test_asarnha_bucha_date(self):
asarnha_bucha_year_date = {
def test_makha_bucha_date(self):
makha_bucha_year_date = {
self.calendar.END_YEAR + 1: None,
self.calendar.START_YEAR - 1: None,
2022: date(2022, JUL, 13),
2025: date(2025, JUL, 10),
2022: date(2022, FEB, 16),
2023: date(2023, MAR, 6),
2024: date(2024, FEB, 24),
2025: date(2025, FEB, 12),
}
for year in asarnha_bucha_year_date:
for year in makha_bucha_year_date:
self.assertEqual(
asarnha_bucha_year_date[year],
self.calendar.asarnha_bucha_date(year),
makha_bucha_year_date[year],
self.calendar.makha_bucha_date(year),
)

def test_visakha_bucha_date(self):
visakha_bucha_year_date = {
self.calendar.END_YEAR + 1: None,
self.calendar.START_YEAR - 1: None,
2022: date(2022, MAY, 15),
2023: date(2023, JUN, 3),
2024: date(2024, MAY, 22),
2025: date(2025, MAY, 11),
}
for year in visakha_bucha_year_date:
self.assertEqual(
visakha_bucha_year_date[year],
self.calendar.visakha_bucha_date(year),
)

def test_atthami_bucha_date(self):
Expand All @@ -123,19 +140,52 @@ def test_atthami_bucha_date(self):
self.calendar.START_YEAR - 1: None,
2022: date(2022, MAY, 23),
2023: date(2023, JUN, 11),
2024: date(2024, MAY, 30),
2025: date(2025, MAY, 19),
}
for year in atthami_bucha_year_date:
self.assertEqual(
atthami_bucha_year_date[year],
self.calendar.atthami_bucha_date(year),
)

def test_asarnha_bucha_date(self):
asarnha_bucha_year_date = {
self.calendar.END_YEAR + 1: None,
self.calendar.START_YEAR - 1: None,
2022: date(2022, JUL, 13),
2023: date(2023, AUG, 1),
2024: date(2024, JUL, 20),
2025: date(2025, JUL, 10),
}
for year in asarnha_bucha_year_date:
self.assertEqual(
asarnha_bucha_year_date[year],
self.calendar.asarnha_bucha_date(year),
)

def test_khao_phansa_date(self):
khao_phansa_year_date = {
self.calendar.END_YEAR + 1: None,
self.calendar.START_YEAR - 1: None,
2022: date(2022, JUL, 14),
2023: date(2023, AUG, 2),
2024: date(2024, JUL, 21),
2025: date(2025, JUL, 11),
}
for year in khao_phansa_year_date:
self.assertEqual(
khao_phansa_year_date[year],
self.calendar.khao_phansa_date(year),
)

def test_ok_phansa_date(self):
ok_phansa_year_date = {
self.calendar.END_YEAR + 1: None,
self.calendar.START_YEAR - 1: None,
2022: date(2022, OCT, 10),
2023: date(2023, OCT, 29),
2024: date(2024, OCT, 17),
2025: date(2025, OCT, 7),
}
for year in ok_phansa_year_date:
Expand Down

0 comments on commit e3b108b

Please sign in to comment.