finance-telegram-bot/tests/test_periods.py
2026-07-14 12:21:12 +07:00

19 lines
549 B
Python

from datetime import datetime
from zoneinfo import ZoneInfo
from app.periods import day_bounds, month_bounds
def test_month_bounds_in_december():
now = datetime(2026, 12, 15, 10, tzinfo=ZoneInfo("UTC"))
start, end = month_bounds(now)
assert start == datetime(2026, 12, 1, tzinfo=ZoneInfo("UTC"))
assert end == datetime(2027, 1, 1, tzinfo=ZoneInfo("UTC"))
def test_day_bounds():
now = datetime(2026, 7, 13, 22, 10, tzinfo=ZoneInfo("UTC"))
start, end = day_bounds(now)
assert start.day == 13
assert end.day == 14