From 3c009025240bbe2e99625713a438814ba23bf7bb Mon Sep 17 00:00:00 2001 From: ephmo <241746745+ephmo@users.noreply.github.com> Date: Sat, 6 Dec 2025 17:04:39 +0200 Subject: [PATCH] chore: add Fasting tests for Seasons 1-11 --- tests/core/test_fasting_season_01_new.py | 126 ++++++ tests/core/test_fasting_season_01_old.py | 126 ++++++ tests/core/test_fasting_season_02_new.py | 117 ++++++ tests/core/test_fasting_season_02_old.py | 117 ++++++ tests/core/test_fasting_season_03_new.py | 72 ++++ tests/core/test_fasting_season_03_old.py | 72 ++++ tests/core/test_fasting_season_04_new.py | 234 +++++++++++ tests/core/test_fasting_season_04_old.py | 216 ++++++++++ tests/core/test_fasting_season_05_new.py | 108 +++++ tests/core/test_fasting_season_05_old.py | 162 ++++++++ tests/core/test_fasting_season_06_new.py | 126 ++++++ tests/core/test_fasting_season_06_old.py | 126 ++++++ tests/core/test_fasting_season_07_new.py | 126 ++++++ tests/core/test_fasting_season_07_old.py | 126 ++++++ tests/core/test_fasting_season_08_new.py | 189 +++++++++ tests/core/test_fasting_season_08_old.py | 270 +++++++++++++ tests/core/test_fasting_season_09_new.py | 108 +++++ tests/core/test_fasting_season_09_old.py | 108 +++++ tests/core/test_fasting_season_10_new.py | 441 +++++++++++++++++++++ tests/core/test_fasting_season_10_old.py | 477 +++++++++++++++++++++++ tests/core/test_fasting_season_11_new.py | 72 ++++ tests/core/test_fasting_season_11_old.py | 72 ++++ 22 files changed, 3591 insertions(+) create mode 100644 tests/core/test_fasting_season_01_new.py create mode 100644 tests/core/test_fasting_season_01_old.py create mode 100644 tests/core/test_fasting_season_02_new.py create mode 100644 tests/core/test_fasting_season_02_old.py create mode 100644 tests/core/test_fasting_season_03_new.py create mode 100644 tests/core/test_fasting_season_03_old.py create mode 100644 tests/core/test_fasting_season_04_new.py create mode 100644 tests/core/test_fasting_season_04_old.py create mode 100644 tests/core/test_fasting_season_05_new.py create mode 100644 tests/core/test_fasting_season_05_old.py create mode 100644 tests/core/test_fasting_season_06_new.py create mode 100644 tests/core/test_fasting_season_06_old.py create mode 100644 tests/core/test_fasting_season_07_new.py create mode 100644 tests/core/test_fasting_season_07_old.py create mode 100644 tests/core/test_fasting_season_08_new.py create mode 100644 tests/core/test_fasting_season_08_old.py create mode 100644 tests/core/test_fasting_season_09_new.py create mode 100644 tests/core/test_fasting_season_09_old.py create mode 100644 tests/core/test_fasting_season_10_new.py create mode 100644 tests/core/test_fasting_season_10_old.py create mode 100644 tests/core/test_fasting_season_11_new.py create mode 100644 tests/core/test_fasting_season_11_old.py diff --git a/tests/core/test_fasting_season_01_new.py b/tests/core/test_fasting_season_01_new.py new file mode 100644 index 0000000..e30e579 --- /dev/null +++ b/tests/core/test_fasting_season_01_new.py @@ -0,0 +1,126 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 1: ["New Calendar", "1-24", "3-6"] + ( + "2010-1-24", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2010-1-25", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2010-1-26", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Tuesday + ( + "2010-1-31", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-2-10", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-2-13", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Wednesday + ( + "2041-2-14", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "2041-2-17", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-2-27", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-3-4", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Friday + ( + "2078-3-5", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Saturday + ( + "2078-3-6", + "new", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_01_old.py b/tests/core/test_fasting_season_01_old.py new file mode 100644 index 0000000..d52320e --- /dev/null +++ b/tests/core/test_fasting_season_01_old.py @@ -0,0 +1,126 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 1: ["Old Calendar", "1-11", "2-21"] + ( + "2010-1-11", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2010-1-12", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2010-1-13", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Tuesday + ( + "2010-1-18", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-1-28", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-1-31", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Wednesday + ( + "2041-2-1", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "2041-2-4", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-2-14", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-2-19", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Friday + ( + "2078-2-20", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Saturday + ( + "2078-2-21", + "old", + { + "fasting_season_index": "1", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_02_new.py b/tests/core/test_fasting_season_02_new.py new file mode 100644 index 0000000..c785114 --- /dev/null +++ b/tests/core/test_fasting_season_02_new.py @@ -0,0 +1,117 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 2: ["New Calendar", "2-8", "3-20"] + ( + "2010-2-8", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2010-2-9", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Tuesday + ( + "2010-2-14", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-2-25", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2041-2-27", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Wednesday + ( + "2041-2-28", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "2041-3-3", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-3-14", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2078-3-18", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Friday + ( + "2078-3-19", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Saturday + ( + "2078-3-20", + "new", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_02_old.py b/tests/core/test_fasting_season_02_old.py new file mode 100644 index 0000000..fcd8fc1 --- /dev/null +++ b/tests/core/test_fasting_season_02_old.py @@ -0,0 +1,117 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 2: ["Old Calendar", "1-26", "3-7"] + ( + "2010-1-26", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2010-1-27", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Tuesday + ( + "2010-2-1", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-2-12", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2041-2-14", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Wednesday + ( + "2041-2-15", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "2041-2-18", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-3-1", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2078-3-5", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Friday + ( + "2078-3-6", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Saturday + ( + "2078-3-7", + "old", + { + "fasting_season_index": "2", + "fasting_laymen_index": "2", + "fasting_monks_index": "2", + }, + ), # Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_03_new.py b/tests/core/test_fasting_season_03_new.py new file mode 100644 index 0000000..2679034 --- /dev/null +++ b/tests/core/test_fasting_season_03_new.py @@ -0,0 +1,72 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 3: ["New Calendar", "2-15", "3-22"] + ( + "2010-2-15", + "new", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Monday + ( + "2010-2-16", + "new", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Tuesday + ( + "2041-3-4", + "new", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Monday + ( + "2041-3-5", + "new", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Tuesday + ( + "2078-3-21", + "new", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Monday + ( + "2078-3-22", + "new", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Tuesday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_03_old.py b/tests/core/test_fasting_season_03_old.py new file mode 100644 index 0000000..67810dc --- /dev/null +++ b/tests/core/test_fasting_season_03_old.py @@ -0,0 +1,72 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 3: ["Old Calendar", "2-2", "3-9"] + ( + "2010-2-2", + "old", + { + "fasting_season_index": "3", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # FISH_ALLOWED, Monday + ( + "2010-2-3", + "old", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Tuesday + ( + "2041-2-19", + "old", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Monday + ( + "2041-2-20", + "old", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Tuesday + ( + "2078-3-8", + "old", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Monday + ( + "2078-3-9", + "old", + { + "fasting_season_index": "3", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Tuesday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_04_new.py b/tests/core/test_fasting_season_04_new.py new file mode 100644 index 0000000..901f28b --- /dev/null +++ b/tests/core/test_fasting_season_04_new.py @@ -0,0 +1,234 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 4: ["New Calendar", "2-17", "5-1"] + ( + "2040-3-25", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Sunday + ( + "2013-3-25", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Monday + ( + "2070-3-25", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Tuesday + ( + "2054-3-25", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Wednesday + ( + "2027-3-25", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Thursday + ( + "2016-3-25", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Friday + ( + "2062-3-25", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Saturday + ( + "2010-2-17", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Wednesday + ( + "2010-3-9", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Tuesday + ( + "2010-3-28", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # PALM_SUNDAY, Sunday + ( + "2041-3-6", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2041-3-9", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "2041-3-10", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "2041-3-11", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2041-3-12", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Tuesday + ( + "2041-3-13", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2041-3-14", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Thursday + ( + "2041-3-15", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Friday + ( + "2041-3-16", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "2041-4-14", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # PALM_SUNDAY, Sunday + ( + "2078-3-23", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2078-4-23", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "2078-4-30", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "2078-5-1", + "new", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # PALM_SUNDAY, Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_04_old.py b/tests/core/test_fasting_season_04_old.py new file mode 100644 index 0000000..c5f661b --- /dev/null +++ b/tests/core/test_fasting_season_04_old.py @@ -0,0 +1,216 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 4: ["Old Calendar", "2-4", "4-18"] + ( + "2024-3-25", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Sunday + ( + "2059-3-25", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Monday + ( + "2043-3-25", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Tuesday + ( + "2021-3-25", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Wednesday + ( + "2005-3-25", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Thursday + ( + "2000-3-25", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Friday + ( + "2035-3-25", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Saturday + ( + "2010-2-4", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2010-2-7", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "2010-2-8", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Sunday + ( + "2010-3-9", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "2010-3-15", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # PALM_SUNDAY, Sunday + ( + "2041-2-21", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2041-2-24", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "2041-2-25", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "2041-2-26", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2041-2-27", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Tuesday + ( + "2041-3-1", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Thursday + ( + "2041-3-2", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Friday + ( + "2041-4-1", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # PALM_SUNDAY, Sunday + ( + "2078-3-10", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2078-4-18", + "old", + { + "fasting_season_index": "4", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # PALM_SUNDAY, Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_05_new.py b/tests/core/test_fasting_season_05_new.py new file mode 100644 index 0000000..368cb19 --- /dev/null +++ b/tests/core/test_fasting_season_05_new.py @@ -0,0 +1,108 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 5: ["New Calendar", "3-29", "5-7"] + ( + "2010-3-29", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2010-3-30", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Tuesday + ( + "2010-3-31", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2010-4-1", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Thursday + ( + "2010-4-2", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Friday + ( + "2010-4-3", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Saturday + ( + "2041-4-15", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2041-4-20", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Saturday + ( + "2078-5-2", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2078-5-7", + "new", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Saturday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_05_old.py b/tests/core/test_fasting_season_05_old.py new file mode 100644 index 0000000..af76cea --- /dev/null +++ b/tests/core/test_fasting_season_05_old.py @@ -0,0 +1,162 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 5: ["Old Calendar", "3-16", "4-24"] + ( + "2031-3-25", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # FISH_ALLOWED, Monday + ( + "2015-3-25", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # FISH_ALLOWED, Tuesday + ( + "2004-3-25", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # FISH_ALLOWED, Wednesday + ( + "2061-3-25", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # FISH_ALLOWED, Thursday + ( + "2034-3-25", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # FISH_ALLOWED, Friday + ( + "2018-3-25", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # FISH_ALLOWED, Saturday + ( + "2010-3-16", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2010-3-17", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Tuesday + ( + "2010-3-18", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2010-3-19", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Thursday + ( + "2010-3-20", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "6", + "fasting_monks_index": "6", + }, + ), # Friday + ( + "2010-3-21", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Saturday + ( + "2041-4-2", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2041-4-7", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Saturday + ( + "2078-4-19", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2078-4-24", + "old", + { + "fasting_season_index": "5", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Saturday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_06_new.py b/tests/core/test_fasting_season_06_new.py new file mode 100644 index 0000000..c48136b --- /dev/null +++ b/tests/core/test_fasting_season_06_new.py @@ -0,0 +1,126 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 6: ["New Calendar", "4-4", "5-15"] + ( + "2010-4-4", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2010-4-5", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2010-4-6", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Tuesday + ( + "2010-4-11", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-4-21", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-4-24", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Wednesday + ( + "2041-4-25", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "2041-4-28", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-5-8", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-5-13", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Friday + ( + "2078-5-14", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Saturday + ( + "2078-5-15", + "new", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_06_old.py b/tests/core/test_fasting_season_06_old.py new file mode 100644 index 0000000..52e20ee --- /dev/null +++ b/tests/core/test_fasting_season_06_old.py @@ -0,0 +1,126 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 6: ["Old Calendar", "3-22", "5-2"] + ( + "2010-3-22", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2010-3-23", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2010-3-24", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Tuesday + ( + "2010-3-29", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-4-8", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-4-11", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Wednesday + ( + "2041-4-12", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "2041-4-15", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-4-25", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-4-30", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Friday + ( + "2078-5-1", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Saturday + ( + "2078-5-2", + "old", + { + "fasting_season_index": "6", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_07_new.py b/tests/core/test_fasting_season_07_new.py new file mode 100644 index 0000000..ad7a78e --- /dev/null +++ b/tests/core/test_fasting_season_07_new.py @@ -0,0 +1,126 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 7: ["New Calendar", "5-23", "7-3"] + ( + "2010-5-23", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2010-5-24", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2010-5-25", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Tuesday + ( + "2010-5-30", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-6-9", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-6-12", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Wednesday + ( + "2041-6-13", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "2041-6-16", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-6-26", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-7-1", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Friday + ( + "2078-7-2", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Saturday + ( + "2078-7-3", + "new", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_07_old.py b/tests/core/test_fasting_season_07_old.py new file mode 100644 index 0000000..abb6c98 --- /dev/null +++ b/tests/core/test_fasting_season_07_old.py @@ -0,0 +1,126 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 7: ["Old Calendar", "5-10", "6-20"] + ( + "2010-5-10", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2010-5-11", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Monday + ( + "2010-5-12", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Tuesday + ( + "2010-5-17", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-5-27", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2041-5-30", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Wednesday + ( + "2041-5-31", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "2041-6-3", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-6-13", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2078-6-18", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Friday + ( + "2078-6-19", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Saturday + ( + "2078-6-20", + "old", + { + "fasting_season_index": "7", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_08_new.py b/tests/core/test_fasting_season_08_new.py new file mode 100644 index 0000000..31c7941 --- /dev/null +++ b/tests/core/test_fasting_season_08_new.py @@ -0,0 +1,189 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 8: ["New Calendar", "5-31", "6-28"] + ( + "2010-5-31", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2010-6-5", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "2010-6-6", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "2010-6-8", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Tuesday + ( + "2010-6-11", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Friday + ( + "2010-6-19", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "2010-6-20", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "2010-6-24", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Thursday + ( + "2010-6-26", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "2010-6-27", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "2010-6-28", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2041-6-17", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2041-6-18", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Tuesday + ( + "2041-6-19", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2041-6-20", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Thursday + ( + "2041-6-22", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "2041-6-23", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "2041-6-24", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Monday + ( + "2041-6-28", + "new", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Friday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_08_old.py b/tests/core/test_fasting_season_08_old.py new file mode 100644 index 0000000..676d7b8 --- /dev/null +++ b/tests/core/test_fasting_season_08_old.py @@ -0,0 +1,270 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 8: ["Old Calendar", "5-18", "6-28"] + ( + "2010-5-18", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2010-5-19", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Tuesday + ( + "2010-5-20", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2010-5-21", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Thursday + ( + "2010-5-22", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Friday + ( + "2010-5-23", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "2010-5-24", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "2010-5-25", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "2010-6-8", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "2010-6-11", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Thursday + ( + "2010-6-20", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "2010-6-21", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "2010-6-24", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Wednesday + ( + "2010-6-27", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "2010-6-28", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "2041-6-4", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2041-6-8", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Friday + ( + "2041-6-9", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "2041-6-10", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "2041-6-11", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "2041-6-23", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "2041-6-24", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Sunday + ( + "2041-6-28", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Thursday + ( + "2078-6-21", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2078-6-24", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Thursday + ( + "2078-6-26", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "2078-6-27", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "2078-6-28", + "old", + { + "fasting_season_index": "8", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_09_new.py b/tests/core/test_fasting_season_09_new.py new file mode 100644 index 0000000..6cb3516 --- /dev/null +++ b/tests/core/test_fasting_season_09_new.py @@ -0,0 +1,108 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 9: ["New Calendar", "8-1", "8-14"] + ( + "1924-8-1", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Friday + ( + "1924-8-3", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "1924-8-6", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Wednesday + ( + "1924-8-14", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Thursday + ( + "2099-8-1", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "2099-8-3", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "2099-8-4", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Tuesday + ( + "2099-8-5", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2099-8-6", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Thursday + ( + "2099-8-14", + "new", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Friday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_09_old.py b/tests/core/test_fasting_season_09_old.py new file mode 100644 index 0000000..0f5705f --- /dev/null +++ b/tests/core/test_fasting_season_09_old.py @@ -0,0 +1,108 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 9: ["Old Calendar", "8-1", "8-14"] + ( + "1924-8-1", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Thursday + ( + "1924-8-6", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Tuesday + ( + "1924-8-10", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "1924-8-11", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "1924-8-12", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "1924-8-13", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Tuesday + ( + "1924-8-14", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "2099-8-1", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Friday + ( + "2099-8-6", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Wednesday + ( + "2099-8-14", + "old", + { + "fasting_season_index": "9", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Thursday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_10_new.py b/tests/core/test_fasting_season_10_new.py new file mode 100644 index 0000000..149aa5b --- /dev/null +++ b/tests/core/test_fasting_season_10_new.py @@ -0,0 +1,441 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 10: ["New Calendar", "11-15", "12-24"] + ( + "1924-11-15", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "1924-11-16", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Sunday + ( + "1924-11-17", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "1924-11-18", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Tuesday + ( + "1924-11-19", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "1924-11-20", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Thursday + ( + "1924-11-21", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Friday + ( + "1924-11-22", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "1924-11-23", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "1924-11-25", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Tuesday + ( + "1924-11-30", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Sunday + ( + "1924-12-4", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Thursday + ( + "1924-12-5", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Friday + ( + "1924-12-6", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "1924-12-7", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "1924-12-9", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Tuesday + ( + "1924-12-12", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Friday + ( + "1924-12-13", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "1924-12-14", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "1924-12-15", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "1924-12-17", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Wednesday + ( + "1924-12-20", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "1924-12-21", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "1924-12-24", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Wednesday + ( + "2099-11-15", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "2099-11-16", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "2099-11-21", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Saturday + ( + "2099-11-22", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "2099-11-25", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Wednesday + ( + "2099-11-30", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "2099-12-4", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Friday + ( + "2099-12-5", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "2099-12-6", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Sunday + ( + "2099-12-9", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Wednesday + ( + "2099-12-11", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Friday + ( + "2099-12-12", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "2099-12-13", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "2099-12-15", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Tuesday + ( + "2099-12-17", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Thursday + ( + "2099-12-19", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "2099-12-20", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Sunday + ( + "2018-12-24", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Monday + ( + "2019-12-24", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Tuesday + ( + "2099-12-24", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Thursday + ( + "2021-12-24", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Friday + ( + "2022-12-24", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # STRICT_FAST, Saturday + ( + "2023-12-24", + "new", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # STRICT_FAST, Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_10_old.py b/tests/core/test_fasting_season_10_old.py new file mode 100644 index 0000000..fd64382 --- /dev/null +++ b/tests/core/test_fasting_season_10_old.py @@ -0,0 +1,477 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 10: ["Old Calendar", "11-15", "12-24"] + ( + "1924-11-15", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Friday + ( + "1924-11-16", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "1924-11-17", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "1924-11-18", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Monday + ( + "1924-11-19", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Tuesday + ( + "1924-11-20", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # Wednesday + ( + "1924-11-21", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Thursday + ( + "1924-11-23", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "1924-11-24", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "1924-11-25", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "1924-11-30", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "1924-12-4", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Wednesday + ( + "1924-12-5", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Thursday + ( + "1924-12-6", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Friday + ( + "1924-12-7", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "1924-12-8", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "1924-12-9", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "1924-12-12", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Thursday + ( + "1924-12-14", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "1924-12-15", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Sunday + ( + "1924-12-17", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Tuesday + ( + "1924-12-20", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Friday + ( + "1924-12-21", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "1924-12-22", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "1924-12-24", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Tuesday + ( + "2099-11-15", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "2099-11-16", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Sunday + ( + "2099-11-20", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Thursday + ( + "2099-11-21", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # FISH_ALLOWED, Friday + ( + "2099-11-22", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Saturday + ( + "2099-11-23", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "2099-11-25", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Tuesday + ( + "2099-11-30", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Sunday + ( + "2099-12-4", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Thursday + ( + "2099-12-5", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Friday + ( + "2099-12-6", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "2099-12-7", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "3", + "fasting_monks_index": "3", + }, + ), # Sunday + ( + "2099-12-9", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Tuesday + ( + "2099-12-12", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Friday + ( + "2099-12-13", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Saturday + ( + "2099-12-14", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "2099-12-15", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Monday + ( + "2099-12-17", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Wednesday + ( + "2099-12-20", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # WINE_AND_OLIVE_OIL_ALLOWED, Saturday + ( + "2099-12-21", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # Sunday + ( + "2024-12-24", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Monday + ( + "2099-12-24", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Wednesday + ( + "2027-12-24", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Thursday + ( + "2033-12-24", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Friday + ( + "2028-12-24", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # STRICT_FAST, Saturday + ( + "2029-12-24", + "old", + { + "fasting_season_index": "10", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # STRICT_FAST, Sunday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_11_new.py b/tests/core/test_fasting_season_11_new.py new file mode 100644 index 0000000..1224e76 --- /dev/null +++ b/tests/core/test_fasting_season_11_new.py @@ -0,0 +1,72 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 11: ["New Calendar", "12-25", "1-6"] + ( + "1924-12-25", + "new", + { + "fasting_season_index": "11", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "1924-1-5", + "new", + { + "fasting_season_index": "11", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # STRICT_FAST, Saturday + ( + "1924-1-6", + "new", + { + "fasting_season_index": "11", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Sunday + ( + "2099-12-25", + "new", + { + "fasting_season_index": "11", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Friday + ( + "2099-1-5", + "new", + { + "fasting_season_index": "11", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Monday + ( + "2099-1-6", + "new", + { + "fasting_season_index": "11", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Tuesday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected diff --git a/tests/core/test_fasting_season_11_old.py b/tests/core/test_fasting_season_11_old.py new file mode 100644 index 0000000..68e0e37 --- /dev/null +++ b/tests/core/test_fasting_season_11_old.py @@ -0,0 +1,72 @@ +"""Test for fasting subpackage.""" + +import pytest + +from ocma_data.core.fasting.logic import get_fasting +from ocma_data.utils.date_utils import string_to_date + +test_cases = [ + # Maximum range for each fasting season + # Format: ["Calendar", "Start Month-Day", "End Month-Day"] + # Fasting season 11: ["Old Calendar", "12-25", "1-6"] + ( + "1924-12-25", + "old", + { + "fasting_season_index": "11", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Wednesday + ( + "1924-1-5", + "old", + { + "fasting_season_index": "11", + "fasting_laymen_index": "5", + "fasting_monks_index": "5", + }, + ), # STRICT_FAST, Friday + ( + "1924-1-6", + "old", + { + "fasting_season_index": "11", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Saturday + ( + "2099-12-25", + "old", + { + "fasting_season_index": "11", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Thursday + ( + "2099-1-5", + "old", + { + "fasting_season_index": "11", + "fasting_laymen_index": "4", + "fasting_monks_index": "4", + }, + ), # STRICT_FAST, Sunday + ( + "2099-1-6", + "old", + { + "fasting_season_index": "11", + "fasting_laymen_index": "1", + "fasting_monks_index": "2", + }, + ), # Monday +] + + +@pytest.mark.parametrize("current_date, calendar_style, expected", test_cases) +def test_get_fasting(current_date: str, calendar_style: str, expected: str) -> None: + """Test for get_fasting.""" + assert get_fasting(string_to_date(current_date), calendar_style) == expected