Spaces:
Sleeping
Sleeping
File size: 2,044 Bytes
79df050 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | import pytest
from features.mcp.tools.location.geocoding_tool import ForwardGeocodeTool
@pytest.mark.asyncio
async def test_forward_geocode_prefers_poi_match_for_station_queries(monkeypatch):
async def fake_tdx(query):
return [
{
"lat": 25.0487,
"lon": 121.5143,
"display_name": "εΈζ°ε€§ιε°εε°δΈθ‘εΊε£Y12θ₯Ώι’",
"label": "ζ‘εζ©ε ΄ζ·ιε°εθ»η«_A1",
"importance": 1.0,
"name": "ζ‘εζ©ε ΄ζ·ιε°εθ»η«_A1",
"road": "",
"house_number": "",
"suburb": "",
"city_district": "",
"city": "",
"admin": "",
"postcode": "",
"amenity": "",
"shop": "",
"building": "",
"detailed_address": "εΈζ°ε€§ιε°εε°δΈθ‘εΊε£Y12θ₯Ώι’",
"_kind": "markname",
},
{
"lat": 25.1424,
"lon": 121.5066,
"display_name": "ε°εεΈεζειζιη ζ΅·θ·―θ¨125δΉ2θ",
"label": "ε°εεΈεζειζιη ζ΅·θ·―θ¨125δΉ2θ",
"importance": 1.0,
"name": "",
"road": "",
"house_number": "",
"suburb": "",
"city_district": "",
"city": "",
"admin": "",
"postcode": "",
"amenity": "",
"shop": "",
"building": "",
"detailed_address": "ε°εεΈεζειζιη ζ΅·θ·―θ¨125δΉ2θ",
"_kind": "address",
},
]
monkeypatch.setattr(ForwardGeocodeTool, "_forward_geocode_tdx", fake_tdx)
result = await ForwardGeocodeTool.execute({"query": "ε°εθ»η«", "limit": 1})
assert "ε°εθ»η«" in result["best_match"]["label"]
assert result["best_match"]["lat"] == 25.0487
|