daylight-left / tests /test_cli.py
maddiebrooks208's picture
daylight-left: offline sunset + spot picker with local Gemma 3 1B nudge (HF26 Week 1: Touch Grass)
3e53af9
Raw History Blame Contribute Delete
764 Bytes
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