File size: 845 Bytes
a8baed5 fe4f734 a8baed5 fe4f734 a8baed5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
from datetime import date
from modules.get_rules_in_window import (
get_date_range,
get_rules,
)
def test_get_date_range(start_str: str = "2024-05-01", end_mmdd: str = "01-03"):
start_date = date.fromisoformat(start_str)
end_year = start_date.year + 1
dates_str = get_date_range(start_str)
assert isinstance(dates_str, dict)
assert (
dates_str.get("start") == start_str
and dates_str.get("end") == f"{end_year}-{end_mmdd}"
and dates_str.get("transition_year") == end_year
)
def test_get_rules(
date_range: dict = {
"start": "2024-05-01",
"end": "2024-05-10",
"transition_year": 2025,
}
):
results = get_rules(date_range)
assert isinstance(results, list)
assert all(isinstance(item, dict) for item in results)
|