from room_cal.service_api._utils import month_bounds, months_in_range # ── month_bounds ────────────────────────────────────────────────────────────── def test_month_bounds_june(): assert month_bounds(6, 2025) == ('2025-06-01', '2025-06-30') def test_month_bounds_january(): assert month_bounds(1, 2025) == ('2025-01-01', '2025-01-31') def test_month_bounds_december_wraps_year(): assert month_bounds(12, 2025) == ('2025-12-01', '2025-12-31') def test_month_bounds_february_non_leap(): assert month_bounds(2, 2025) == ('2025-02-01', '2025-02-28') def test_month_bounds_february_leap(): assert month_bounds(2, 2024) == ('2024-02-01', '2024-02-29') # ── months_in_range ─────────────────────────────────────────────────────────── def test_months_in_range_single_month(): assert months_in_range('2025-06-01', '2025-06-30') == [(6, 2025)] def test_months_in_range_single_day(): assert months_in_range('2025-06-15', '2025-06-15') == [(6, 2025)] def test_months_in_range_two_consecutive(): assert months_in_range('2025-06-01', '2025-07-31') == [(6, 2025), (7, 2025)] def test_months_in_range_mid_month_boundaries(): assert months_in_range('2025-06-15', '2025-08-05') == [(6, 2025), (7, 2025), (8, 2025)] def test_months_in_range_cross_year(): assert months_in_range('2025-11-01', '2026-02-28') == [ (11, 2025), (12, 2025), (1, 2026), (2, 2026), ] def test_months_in_range_full_year(): result = months_in_range('2025-01-01', '2025-12-31') assert result == [(m, 2025) for m in range(1, 13)]