Spaces:
Sleeping
Sleeping
Download test_no_places.py from neurostack-in/talk2map-test: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/neurostack-in/talk2map-test/resolve/main/test_no_places.py
- Command line
-
hf download hf://spaces/neurostack-in/talk2map-test/test_no_places.py
-
curl -L -o test_no_places.py https://huggingface.co/spaces/neurostack-in/talk2map-test/resolve/main/test_no_places.py
1.28 kB
| #!/usr/bin/env python3 | |
| """ | |
| Test script to verify improved error messages when no places are found. | |
| """ | |
| import json | |
| from agent.agent_runner import run_agent | |
| def test_no_places_scenarios(): | |
| """Test different scenarios where no places are found.""" | |
| print("Testing improved error messages for no places found...\n") | |
| # Test 1: Query with bounding box but no places found | |
| print("Test 1: Query with bounding box (should say area doesn't have requested places)") | |
| bbox = { | |
| "north_east": {"lat": 0.001, "lon": 0.001}, # Very small area with no places | |
| "south_west": {"lat": 0.0, "lon": 0.0} | |
| } | |
| result1 = run_agent("restaurants", [], bbox=bbox) | |
| print(f"Result: {result1['final_text']}") | |
| print() | |
| # Test 2: Query without bounding box | |
| print("Test 2: Query without bounding box (should suggest nearby city)") | |
| result2 = run_agent("nonexistent_place_type_xyz", []) | |
| print(f"Result: {result2['final_text']}") | |
| print() | |
| # Test 3: Bounding box only (no query) | |
| print("Test 3: Bounding box only, no query") | |
| result3 = run_agent("", [], bbox=bbox) | |
| print(f"Result: {result3['final_text']}") | |
| print() | |
| print("All tests completed!") | |
| if __name__ == "__main__": | |
| test_no_places_scenarios() |