-
-
Notifications
You must be signed in to change notification settings - Fork 561
Split tests/test_holiday_groups.py #2803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # holidays | ||
| # -------- | ||
| # A fast, efficient Python library for generating country, province and state | ||
| # specific sets of holidays on the fly. It aims to make determining whether a | ||
| # specific date is a holiday as fast and flexible as possible. | ||
| # | ||
| # Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) | ||
| # dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
| # ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
| # Website: https://github.com/vacanza/holidays | ||
| # License: MIT (see LICENSE file) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # holidays | ||
| # -------- | ||
| # A fast, efficient Python library for generating country, province and state | ||
| # specific sets of holidays on the fly. It aims to make determining whether a | ||
| # specific date is a holiday as fast and flexible as possible. | ||
| # | ||
| # Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) | ||
| # dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
| # ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
| # Website: https://github.com/vacanza/holidays | ||
| # License: MIT (see LICENSE file) | ||
|
|
||
| from unittest import TestCase | ||
|
|
||
| from holidays.groups import BalineseSakaCalendarHolidays | ||
| from holidays.holiday_base import HolidayBase | ||
|
|
||
|
|
||
| class TestBalineseSakaCalendarHolidays(TestCase): | ||
| def test_add_balinese_saka_calendar_holiday(self): | ||
| # Check for out-of-range dates. | ||
| class TestHolidays(HolidayBase, BalineseSakaCalendarHolidays): | ||
| end_year = 2051 | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| BalineseSakaCalendarHolidays.__init__(self) | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| test_holidays = TestHolidays() | ||
|
|
||
| test_holidays._populate(2051) | ||
| test_holidays._add_nyepi("Day of Silence") | ||
| self.assertEqual(0, len(test_holidays)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # holidays | ||
| # -------- | ||
| # A fast, efficient Python library for generating country, province and state | ||
| # specific sets of holidays on the fly. It aims to make determining whether a | ||
| # specific date is a holiday as fast and flexible as possible. | ||
| # | ||
| # Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) | ||
| # dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
| # ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
| # Website: https://github.com/vacanza/holidays | ||
| # License: MIT (see LICENSE file) | ||
|
|
||
| from unittest import TestCase | ||
|
|
||
| from holidays.groups import ChristianHolidays | ||
| from holidays.holiday_base import HolidayBase | ||
|
|
||
|
|
||
| class TestChristianHolidays(TestCase): | ||
| def test_check_calendar(self): | ||
| self.assertRaises(ValueError, lambda: ChristianHolidays("INVALID_CALENDAR")) | ||
arkid15r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def test_add_christmas_day_three(self): | ||
| class TestHolidays(HolidayBase, ChristianHolidays): | ||
| def __init__(self, *args, **kwargs): | ||
| ChristianHolidays.__init__(self) | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| def _populate(self, year): | ||
| super()._populate(year) | ||
|
|
||
| test_holidays = TestHolidays() | ||
|
|
||
| test_holidays._populate(2022) | ||
| test_holidays._add_christmas_day_three("Third day") | ||
| self.assertIn("2022-12-27", test_holidays) | ||
| self.assertEqual(1, len(test_holidays)) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # holidays | ||
| # -------- | ||
| # A fast, efficient Python library for generating country, province and state | ||
| # specific sets of holidays on the fly. It aims to make determining whether a | ||
| # specific date is a holiday as fast and flexible as possible. | ||
| # | ||
| # Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) | ||
| # dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
| # ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
| # Website: https://github.com/vacanza/holidays | ||
| # License: MIT (see LICENSE file) | ||
|
|
||
| from unittest import TestCase | ||
|
|
||
| from holidays.groups import InternationalHolidays | ||
| from holidays.holiday_base import HolidayBase | ||
|
|
||
|
|
||
| class TestInternationalHolidays(TestCase): | ||
| def test_add_childrens_day(self): | ||
| class TestHolidays(HolidayBase, InternationalHolidays): | ||
| def __init__(self, *args, **kwargs): | ||
| InternationalHolidays.__init__(self) | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| test_holidays = TestHolidays() | ||
|
|
||
| test_holidays._populate(2022) | ||
| test_holidays._add_childrens_day("Children's Day (November 20)", "NOV") | ||
| self.assertIn("2022-11-20", test_holidays) | ||
| self.assertEqual(1, len(test_holidays)) | ||
| self.assertRaises( | ||
| ValueError, lambda: test_holidays._add_childrens_day("Invalid", "INVALID_TYPE") | ||
| ) | ||
arkid15r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # holidays | ||
| # -------- | ||
| # A fast, efficient Python library for generating country, province and state | ||
| # specific sets of holidays on the fly. It aims to make determining whether a | ||
| # specific date is a holiday as fast and flexible as possible. | ||
| # | ||
| # Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) | ||
| # dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
| # ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
| # Website: https://github.com/vacanza/holidays | ||
| # License: MIT (see LICENSE file) | ||
|
|
||
| from unittest import TestCase | ||
|
|
||
| from holidays.groups import MandaeanHolidays | ||
| from holidays.holiday_base import HolidayBase | ||
|
|
||
|
|
||
| class TestMandaeanCalendarHolidays(TestCase): | ||
| def test_add_mandaean_calendar_holiday(self): | ||
| # Check for out-of-range dates. | ||
| class TestHolidays(HolidayBase, MandaeanHolidays): | ||
| end_year = 2150 | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| MandaeanHolidays.__init__(self) | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| test_holidays = TestHolidays() | ||
| test_holidays._populate(2110) | ||
| test_holidays._add_dehwa_daimana_day("Dehwa Daimana Day") | ||
| test_holidays._add_parwanaya_day("Parwanaya Day") | ||
| test_holidays._add_great_feast_day("Great Feast Day") | ||
| test_holidays._add_dehwa_hanina_day("Dehwa Hanina Day") | ||
| self.assertEqual(0, len(test_holidays)) | ||
|
|
||
| test_holidays._populate(2050) | ||
| test_holidays._add_mandaean_holiday( | ||
| "Invalid Mandaean Day", test_holidays._mandaean.mandaean_to_gregorian(2049, 13, 10) | ||
| ) | ||
| self.assertEqual(0, len(test_holidays)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # holidays | ||
| # -------- | ||
| # A fast, efficient Python library for generating country, province and state | ||
| # specific sets of holidays on the fly. It aims to make determining whether a | ||
| # specific date is a holiday as fast and flexible as possible. | ||
| # | ||
| # Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) | ||
| # dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
| # ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
| # Website: https://github.com/vacanza/holidays | ||
| # License: MIT (see LICENSE file) | ||
|
|
||
| from unittest import TestCase | ||
|
|
||
| from holidays.groups import PersianCalendarHolidays | ||
| from holidays.holiday_base import HolidayBase | ||
|
|
||
|
|
||
| class TestPersianCalendarHolidays(TestCase): | ||
| def test_add_persian_calendar_holiday(self): | ||
| # Check for out-of-range dates. | ||
| class TestHolidays(HolidayBase, PersianCalendarHolidays): | ||
| end_year = 2102 | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| PersianCalendarHolidays.__init__(self) | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| test_holidays = TestHolidays() | ||
|
|
||
| test_holidays._populate(2102) | ||
| test_holidays._add_nowruz_day("Persian New Year") | ||
| test_holidays._add_islamic_republic_day("Islamic Republic Day") | ||
| test_holidays._add_natures_day("Nature's Day") | ||
| test_holidays._add_death_of_khomeini_day("Death of Khomeini") | ||
| test_holidays._add_khordad_uprising_day("Khordad National Uprising") | ||
| test_holidays._add_islamic_revolution_day("Islamic Revolution Day") | ||
| test_holidays._add_oil_nationalization_day("Iranian Oil Industry Nationalization Day") | ||
| self.assertEqual(0, len(test_holidays)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # holidays | ||
| # -------- | ||
| # A fast, efficient Python library for generating country, province and state | ||
| # specific sets of holidays on the fly. It aims to make determining whether a | ||
| # specific date is a holiday as fast and flexible as possible. | ||
| # | ||
| # Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) | ||
| # dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
| # ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
| # Website: https://github.com/vacanza/holidays | ||
| # License: MIT (see LICENSE file) | ||
|
|
||
| from unittest import TestCase | ||
|
|
||
| from holidays.calendars.thai import KHMER_CALENDAR | ||
| from holidays.groups import ThaiCalendarHolidays | ||
| from holidays.holiday_base import HolidayBase | ||
|
|
||
|
|
||
| class TestThaiCalendarHolidays(TestCase): | ||
| def test_add_thai_calendar_holiday(self): | ||
| # Check for out-of-range dates. | ||
| class TestHolidays(HolidayBase, ThaiCalendarHolidays): | ||
| end_year = 2158 | ||
|
|
||
| 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # holidays | ||
| # -------- | ||
| # A fast, efficient Python library for generating country, province and state | ||
| # specific sets of holidays on the fly. It aims to make determining whether a | ||
| # specific date is a holiday as fast and flexible as possible. | ||
| # | ||
| # Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) | ||
| # dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
| # ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
| # Website: https://github.com/vacanza/holidays | ||
| # License: MIT (see LICENSE file) | ||
|
|
||
| from unittest import TestCase | ||
|
|
||
| from holidays.groups import TibetanCalendarHolidays | ||
| from holidays.holiday_base import HolidayBase | ||
|
|
||
|
|
||
| class TestTibetanCalendarHolidays(TestCase): | ||
| def test_add_tibetan_calendar_holiday(self): | ||
| # Check for out-of-range dates. | ||
| class TestHolidays(HolidayBase, TibetanCalendarHolidays): | ||
| def __init__(self, *args, **kwargs): | ||
| TibetanCalendarHolidays.__init__(self) | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| test_holidays = TestHolidays() | ||
|
|
||
| test_holidays._populate(2100) | ||
| test_holidays._add_blessed_rainy_day("Blessed Rainy Day") | ||
| test_holidays._add_birth_of_guru_rinpoche("Birth of Guru Rinpoche") | ||
| test_holidays._add_buddha_first_sermon("Buddha First Sermon") | ||
| test_holidays._add_buddha_parinirvana("Buddha Parinirvana") | ||
| test_holidays._add_day_of_offering("Day of Offering") | ||
| test_holidays._add_death_of_zhabdrung("Death of Zhabdrung") | ||
| test_holidays._add_descending_day_of_lord_buddha("Descending Day of Lord Buddha") | ||
| test_holidays._add_losar("Losar") | ||
| test_holidays._add_thimphu_drubchen_day("Thimphu Drubchoe") | ||
| test_holidays._add_thimphu_tshechu_day("Thimphu Tshechu") | ||
| test_holidays._add_tibetan_winter_solstice("Winter Solstice Day") | ||
arkid15r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| self.assertEqual(0, len(test_holidays)) | ||
arkid15r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.