Aggiorna script backup e bot meteo Telegram.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a7b867e83
commit
beb790ed7e
6 files changed
+350
-102
No files matched your search
@@ -109,6 +109,62 @@ def test_real_gelicidio_cold():
|
||||
print("OK real gelicidio at subzero")
|
||||
|
||||
|
||||
def test_monday_storm_event_mm_is_hourly_sum():
|
||||
"""15:00=17.4 + 16:00=5.0 → un evento 22.4 mm, non 5 mm né 22.4 ripetuto."""
|
||||
times = [f"2026-08-17T{h:02d}:00" for h in range(24)]
|
||||
precip = [0.0] * 24
|
||||
precip[15] = 17.4
|
||||
precip[16] = 5.0
|
||||
codes = [3] * 24
|
||||
codes[15] = 65
|
||||
codes[16] = 63
|
||||
temps = [26.0] * 24
|
||||
events = analyze_daily_events(
|
||||
times, codes, None, precip, [18.0] * 24, temps, [16.0] * 24,
|
||||
snowfalls=[0.0] * 24, rains=precip[:],
|
||||
)
|
||||
rain_ev = [e for e in events if "🕒" in e]
|
||||
assert len(rain_ev) == 1, rain_ev
|
||||
assert "15:00-17:00" in rain_ev[0]
|
||||
assert "22.4mm" in rain_ev[0]
|
||||
assert rain_ev[0].count("22.4mm") == 1
|
||||
print("OK lun 17 15-17h = 22.4mm")
|
||||
|
||||
|
||||
def test_three_pulses_keep_own_mm_not_daily_total():
|
||||
times = [f"2026-08-16T{h:02d}:00" for h in range(24)]
|
||||
precip = [0.0] * 24
|
||||
precip[10] = 18.0
|
||||
precip[14] = 19.0
|
||||
precip[18] = 20.0
|
||||
events = analyze_daily_events(
|
||||
times, [63] * 24, None, precip, [10.0] * 24, [24.0] * 24, [14.0] * 24,
|
||||
snowfalls=[0.0] * 24, rains=precip[:],
|
||||
)
|
||||
rain_ev = [e for e in events if "🕒" in e]
|
||||
assert len(rain_ev) == 3, rain_ev
|
||||
assert "18.0mm" in rain_ev[0]
|
||||
assert "19.0mm" in rain_ev[1]
|
||||
assert "20.0mm" in rain_ev[2]
|
||||
assert all("57.0mm" not in e for e in rain_ev)
|
||||
print("OK tre fasce con mm propri")
|
||||
|
||||
|
||||
def test_last_hour_rain_is_emitted():
|
||||
times = [f"2026-08-17T{h:02d}:00" for h in range(24)]
|
||||
precip = [0.0] * 24
|
||||
precip[23] = 4.2
|
||||
events = analyze_daily_events(
|
||||
times, [61] * 24, None, precip, [8.0] * 24, [20.0] * 24, [12.0] * 24,
|
||||
snowfalls=[0.0] * 24, rains=precip[:],
|
||||
)
|
||||
rain_ev = [e for e in events if "🕒" in e]
|
||||
assert rain_ev, events
|
||||
assert "23:00-00:00" in rain_ev[0]
|
||||
assert "4.2mm" in rain_ev[0]
|
||||
print("OK pioggia ultima ora del giorno")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_weathercode_mode_not_median()
|
||||
test_get_precip_type_temp_gate()
|
||||
@@ -116,4 +172,7 @@ if __name__ == "__main__":
|
||||
test_single_hour_event_range()
|
||||
test_trend_max_min_not_media()
|
||||
test_real_gelicidio_cold()
|
||||
test_monday_storm_event_mm_is_hourly_sum()
|
||||
test_three_pulses_keep_own_mm_not_daily_total()
|
||||
test_last_hour_rain_is_emitted()
|
||||
print("\nAll interpretation regression checks passed.")
|
||||
Reference in new issue
Block a user