Files
Foundry/projects/khora/tests/test_model.py
T
2026-08-15 15:11:48 -03:00

39 lines
959 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import datetime as dt
from khora.model import Event, week_dates
def test_timed_event_label_uses_24_hour_time() -> None:
event = Event(
summary="Write a calendar",
calendar="Personal",
start=dt.datetime(2026, 8, 15, 13, 30),
end=dt.datetime(2026, 8, 15, 15, 0),
)
assert event.time_label == "13:3015:00"
def test_week_dates_runs_from_monday_through_sunday() -> None:
assert week_dates(dt.date(2026, 8, 15)) == (
dt.date(2026, 8, 10),
dt.date(2026, 8, 11),
dt.date(2026, 8, 12),
dt.date(2026, 8, 13),
dt.date(2026, 8, 14),
dt.date(2026, 8, 15),
dt.date(2026, 8, 16),
)
def test_all_day_event_label() -> None:
event = Event(
summary="Escape the calendar mines",
calendar="Personal",
start=dt.date(2026, 8, 15),
end=dt.date(2026, 8, 15),
all_day=True,
)
assert event.time_label == "All day"