File size: 764 Bytes
3e53af9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | from daylight_left.cli import main
from daylight_left.spots import Spot, spots_that_fit
ARGS = ["--lat", "42.50", "--lon", "-90.66", "--tz", "America/Chicago", "--spots", "examples/spots.txt", "--no-llm"]
def test_spots_that_fit_orders_longest_stay_first():
spots = [Spot("a", 5, 15, "x"), Spot("b", 10, 45, "y"), Spot("c", 30, 60, "z")]
assert [s.name for s in spots_that_fit(spots, 70)] == ["b", "a"]
def test_afternoon_card_picks_a_spot(capsys):
main(ARGS + ["--now", "2026-10-05T16:30"])
out = capsys.readouterr().out
assert "GO: Riverside trail loop" in out
assert "leave by" in out
def test_after_sunset_says_tomorrow(capsys):
main(ARGS + ["--now", "2026-10-05T19:30"])
assert "light's gone" in capsys.readouterr().out
|