MCPcopy Create free account
hub / github.com/Tong89/smartNode / TestCheckGeoVisibility

Class TestCheckGeoVisibility

tests/test_visibility.py:235–301  ·  view source on GitHub ↗

LEO-GEO 中继可见性:angle < 80° 阈值的各边界场景。

Source from the content-addressed store, hash-verified

233# check_geo_visibility #
234# --------------------------------------------------------------------------- #
235class TestCheckGeoVisibility:
236 """LEO-GEO 中继可见性:angle < 80° 阈值的各边界场景。"""
237
238 def test_same_position_visible(self):
239 """LEO 与 GEO 在同一经纬度,角度 = 0°,应可见。"""
240 leo = {"lat": 0.0, "lon": 0.0, "alt": 500000}
241 geo = {"lat": 0.0, "lon": 0.0, "alt": 35786000}
242 assert check_geo_visibility(leo, geo) is True
243
244 def test_angle_79_visible(self):
245 """赤道上地心角 = 79° < 80°,应可见。"""
246 leo = {"lat": 0.0, "lon": 0.0, "alt": 500000}
247 geo = {"lat": 0.0, "lon": 79.0, "alt": 35786000}
248 assert check_geo_visibility(leo, geo) is True
249
250 def test_angle_81_not_visible(self):
251 """赤道上地心角 = 81° > 80°,不应可见。"""
252 leo = {"lat": 0.0, "lon": 0.0, "alt": 500000}
253 geo = {"lat": 0.0, "lon": 81.0, "alt": 35786000}
254 assert check_geo_visibility(leo, geo) is False
255
256 def test_angle_90_not_visible(self):
257 """赤道上地心角 = 90° 远超 80°,不可见。"""
258 leo = {"lat": 0.0, "lon": 0.0, "alt": 500000}
259 geo = {"lat": 0.0, "lon": 90.0, "alt": 35786000}
260 assert check_geo_visibility(leo, geo) is False
261
262 def test_antipodal_not_visible(self):
263 """对跖点(角度 = 180°),不可见。"""
264 leo = {"lat": 0.0, "lon": 0.0, "alt": 500000}
265 geo = {"lat": 0.0, "lon": 180.0, "alt": 35786000}
266 assert check_geo_visibility(leo, geo) is False
267
268 def test_altitude_does_not_affect_result(self):
269 """check_geo_visibility 仅依赖地心角(纬经度),高度字段不影响结果。"""
270 leo_low = {"lat": 0.0, "lon": 0.0, "alt": 300000}
271 leo_high = {"lat": 0.0, "lon": 0.0, "alt": 1200000}
272 geo = {"lat": 0.0, "lon": 50.0, "alt": 35786000}
273 assert check_geo_visibility(leo_low, geo) == check_geo_visibility(leo_high, geo)
274
275 def test_polar_leo_equatorial_geo(self):
276 """极地 LEO(±60°)与赤道 GEO 的可见性。"""
277 geo = {"lat": 0.0, "lon": 0.0, "alt": 35786000}
278 leo_60 = {"lat": 60.0, "lon": 0.0, "alt": 500000}
279 # 角度 = 60° < 80°,应可见
280 assert check_geo_visibility(leo_60, geo) is True
281 leo_85 = {"lat": 85.0, "lon": 0.0, "alt": 500000}
282 # 角度 = 85° > 80°,不可见
283 assert check_geo_visibility(leo_85, geo) is False
284
285 # --- 黄金基准交叉验证 ---
286
287 @pytest.mark.parametrize("case_key", [
288 "same_position",
289 "angle_79_visible",
290 "angle_81_not_visible",
291 "angle_90_not_visible",
292 ])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected