Skip to content

Commit

Permalink
Fixed Thai Calendar test case coverage (#2090)
Browse files Browse the repository at this point in the history
  • Loading branch information
PPsyrius authored Oct 30, 2024
1 parent a2ff133 commit d31f03f
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/test_holiday_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

from unittest import TestCase

from holidays.groups import ChristianHolidays, InternationalHolidays
from holidays.calendars.thai import KHMER_CALENDAR
from holidays.groups import ChristianHolidays, InternationalHolidays, ThaiCalendarHolidays
from holidays.holiday_base import HolidayBase


Expand Down Expand Up @@ -57,3 +58,30 @@ def __init__(self, *args, **kwargs):
ValueError,
lambda: test_holidays._add_childrens_day("Invalid", "INVALID_TYPE"),
)


class TestThaiCalendarHolidays(TestCase):
def test_add_thai_calendar_holiday(self):
# Check for out-of-range dates.
class TestHolidays(HolidayBase, ThaiCalendarHolidays):
def __init__(self, *args, **kwargs):
ThaiCalendarHolidays.__init__(self)
super().__init__(*args, **kwargs)

test_holidays = TestHolidays()

test_holidays._populate(2158)
test_holidays._add_asarnha_bucha("Asarnha Bucha")
test_holidays._add_boun_haw_khao_padapdin("Boun Haw Khao Padapdin")
test_holidays._add_boun_haw_khao_salark("Boun Haw Khao Salark")
test_holidays._add_boun_suang_heua("Boun Suang Huea")
test_holidays._add_khao_phansa("Khao Phansa")
test_holidays._add_loy_krathong("Loy Krathong")
test_holidays._add_makha_bucha("Makha Bucha")
test_holidays._add_makha_bucha("Meak Bochea", KHMER_CALENDAR)
test_holidays._add_ok_phansa("Ok Phansa")
test_holidays._add_pchum_ben("Pchum Ben")
test_holidays._add_preah_neangkoal("Royal Ploughing Ceremony (Cambodia)")
test_holidays._add_visakha_bucha("Visakha Bucha")
test_holidays._add_visakha_bucha("Visaka Bochea", KHMER_CALENDAR)
self.assertEqual(0, len(test_holidays))

0 comments on commit d31f03f

Please sign in to comment.