generated from Grigo/AndroidTemplate
added subproxy
This commit is contained in:
Binary file not shown.
@@ -62,3 +62,34 @@ def test_build_profile_reports_unreachable(monkeypatch):
|
||||
|
||||
assert profile["points"] == []
|
||||
assert "unreachable" in profile["api_error"]
|
||||
|
||||
|
||||
def test_find_nearest_hill_unreachable(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
elev,
|
||||
"probe_elevation_api",
|
||||
lambda force=False: {"ok": False, "url": elev.ELEVATION_API_URL, "error": "down"},
|
||||
)
|
||||
result = elev.find_nearest_hill(55.75, 37.62)
|
||||
assert result["ok"] is False
|
||||
|
||||
|
||||
def test_find_nearest_hill_picks_nearest_peak(monkeypatch):
|
||||
monkeypatch.setattr(elev, "_probe_checked_at", 0.0)
|
||||
monkeypatch.setattr(elev, "probe_elevation_api", lambda force=False: {"ok": True, "error": None})
|
||||
|
||||
def fake_batch(lats, lons):
|
||||
out = []
|
||||
for la, lo in zip(lats, lons):
|
||||
if abs(la - 55.75) < 1e-4 and abs(lo - 37.62) < 1e-4:
|
||||
out.append(100.0)
|
||||
elif la > 55.75:
|
||||
out.append(130.0)
|
||||
else:
|
||||
out.append(95.0)
|
||||
return out
|
||||
|
||||
monkeypatch.setattr(elev, "fetch_elevations_batch", fake_batch)
|
||||
result = elev.find_nearest_hill(55.75, 37.62, radius_m=2000, step_m=300, min_prominence_m=8)
|
||||
assert result["ok"] is True
|
||||
assert result["hill"]["elevation_m"] >= 120.0
|
||||
|
||||
Reference in New Issue
Block a user