fix: use settlement runway endpoint temperatures
This commit is contained in:
@@ -46,8 +46,11 @@ def test_parse_wind_plate_payload_normalizes_runway_point_temperatures():
|
||||
assert parsed["source_label"] == "AMSC AWOS Beijing Capital (ZBAA)"
|
||||
assert parsed["observation_source_zh"] == "AMSC AWOS 跑道观测气温"
|
||||
assert parsed["icao"] == "ZBAA"
|
||||
assert parsed["temp_c"] == 21.0
|
||||
assert parsed["temp_source"] == "runway_max"
|
||||
assert parsed["temp_c"] == 20.2
|
||||
assert parsed["temp_source"] == "settlement_runway_endpoint"
|
||||
assert parsed["settlement_runway"] == "01"
|
||||
assert parsed["settlement_runway_pair"] == "19/01"
|
||||
assert parsed["settlement_runway_position"] == "end"
|
||||
assert parsed["runway_temp_range"] == (20.2, 21.0)
|
||||
assert parsed["observation_time"] == "2026-05-14T17:19:00+00:00"
|
||||
assert parsed["observation_time_local"] == "2026-05-15 01:19:00"
|
||||
@@ -67,6 +70,10 @@ def test_parse_wind_plate_payload_normalizes_runway_point_temperatures():
|
||||
assert pt0["rvr"] is None
|
||||
assert pt0["mor"] is None
|
||||
assert pt0["humidity"] == 67.0
|
||||
settlement_pt = runway_obs["point_temperatures"][2]
|
||||
assert settlement_pt["runway"] == "19/01"
|
||||
assert settlement_pt["is_settlement"] is True
|
||||
assert settlement_pt["target_runway_max"] == 20.2
|
||||
|
||||
|
||||
def test_parse_wind_plate_payload_uses_settlement_runway_endpoint_temperature():
|
||||
@@ -154,5 +161,6 @@ def test_fetch_amsc_official_current_uses_domestic_city_whitelist(monkeypatch):
|
||||
|
||||
assert data is not None
|
||||
assert data["icao"] == "ZBAA"
|
||||
assert data["temp_c"] == 20.2
|
||||
assert data["runway_temp_range"] == (20.2, 21.0)
|
||||
assert FakeCollector().fetch_amsc_awos_current("new york") is None
|
||||
|
||||
@@ -41,7 +41,7 @@ def test_airport_status_message_defaults_to_bilingual_runway_copy(monkeypatch):
|
||||
assert first_line == "#RunwayObs #跑道观测 #Qingdao"
|
||||
assert "Qingdao / Jiaodong" in text
|
||||
assert "TDZ:23.0" in text
|
||||
assert "Runway now / 跑道当前:" in text
|
||||
assert "Settlement runway now / 结算跑道当前:" in text
|
||||
assert "Today's runway high / 今日跑道高点:" in text
|
||||
assert "DEB: 24.0°C" in text
|
||||
|
||||
@@ -55,10 +55,10 @@ def test_airport_status_hides_non_focus_runways_for_key_airports():
|
||||
"amos": {
|
||||
"source": "amsc_awos",
|
||||
"runway_obs": {
|
||||
"runway_pairs": [("02L", "20R"), ("02R", "20L")],
|
||||
"runway_pairs": [("20R", "02L"), ("02R", "20L")],
|
||||
"temperatures": [(31.1, None), (34.9, None)],
|
||||
"point_temperatures": [
|
||||
{"runway": "02L/20R", "tdz_temp": 31.0, "mid_temp": 31.1, "end_temp": 31.2, "target_runway_max": 31.2, "wind_dir": None, "wind_speed": None, "rvr": None, "mor": None, "humidity": None},
|
||||
{"runway": "20R/02L", "tdz_temp": 33.8, "mid_temp": 34.5, "end_temp": 31.2, "target_runway_max": 34.5, "wind_dir": None, "wind_speed": None, "rvr": None, "mor": None, "humidity": None},
|
||||
{"runway": "02R/20L", "tdz_temp": 34.8, "mid_temp": 34.9, "end_temp": 35.0, "target_runway_max": 35.0, "wind_dir": None, "wind_speed": None, "rvr": None, "mor": None, "humidity": None},
|
||||
],
|
||||
},
|
||||
@@ -68,9 +68,36 @@ def test_airport_status_hides_non_focus_runways_for_key_airports():
|
||||
"13:00",
|
||||
)
|
||||
|
||||
assert "02L/20R" in text
|
||||
assert "20R/02L" in text
|
||||
assert "02R/20L" in text
|
||||
assert "Settlement runway now / 结算跑道当前: 31.2°C" in text
|
||||
assert "max:34.5" not in text
|
||||
|
||||
|
||||
def test_airport_status_uses_tdz_when_settlement_target_is_first_runway():
|
||||
text = _build_airport_status_message(
|
||||
"chengdu",
|
||||
{
|
||||
"current": {"temp": 28.0},
|
||||
"airport_current": {"max_so_far": 30.0, "max_temp_time": "13:00"},
|
||||
"amos": {
|
||||
"source": "amsc_awos",
|
||||
"runway_obs": {
|
||||
"runway_pairs": [("02L", "20R")],
|
||||
"temperatures": [(27.9, None)],
|
||||
"point_temperatures": [
|
||||
{"runway": "02L/20R", "tdz_temp": 24.4, "mid_temp": 26.1, "end_temp": 27.9, "target_runway_max": 27.9, "wind_dir": None, "wind_speed": None, "rvr": None, "mor": None, "humidity": None},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
32.0,
|
||||
"13:00",
|
||||
)
|
||||
|
||||
assert "02L/20R ★Settlement / ★结算 TDZ:24.4 MID:26.1 END:27.9 settle:24.4" in text
|
||||
assert "Settlement runway now / 结算跑道当前: 24.4°C" in text
|
||||
assert "Settlement runway now / 结算跑道当前: 27.9°C" not in text
|
||||
|
||||
|
||||
def test_singapore_is_in_telegram_push_city_lists():
|
||||
|
||||
Reference in New Issue
Block a user