-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_altitude.py
More file actions
26 lines (20 loc) · 898 Bytes
/
Copy pathtest_altitude.py
File metadata and controls
26 lines (20 loc) · 898 Bytes
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
import pytest
from config.constants import TOOL_ALTITUDE
from helpers import extract_numbers
USER_INPUT = (
"Quelle est l'altitude au point de coordonnées longitude 6.87, latitude 45.92?"
)
@pytest.mark.asyncio
async def test_altitude(mcp_agent, tracker):
result = await mcp_agent.ainvoke(
{"messages": [{"role": "user", "content": USER_INPUT}]},
config={"callbacks": [tracker], "thread_id": __name__},
)
altitude_calls = [c for c in tracker.tool_calls if c.get("name") == TOOL_ALTITUDE]
assert len(altitude_calls) > 0, f"{TOOL_ALTITUDE} tool was not called"
last_message = result["messages"][-1]
message_text = str(last_message)
# Chamonix area → altitude ~900-1200m
numbers = extract_numbers(message_text)
assert any(900 <= n <= 1200 for n in numbers), \
f"Expected altitude around 1000m in response: {message_text[:200]}"