|
|
""" |
|
|
test_weather_tools.py |
|
|
Quick test for weather and flood tools only (no sessions required) |
|
|
""" |
|
|
import sys |
|
|
import os |
|
|
import io |
|
|
|
|
|
|
|
|
if sys.platform == 'win32': |
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') |
|
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) |
|
|
|
|
|
print("="*60) |
|
|
print("[TEST] WEATHER & FLOOD TOOLS") |
|
|
print("="*60) |
|
|
|
|
|
|
|
|
print("\n[1] Testing tool_dmc_alerts...") |
|
|
try: |
|
|
from src.utils.utils import tool_dmc_alerts |
|
|
result = tool_dmc_alerts() |
|
|
print(f"[OK] DMC Alerts: {str(result)[:300]}...") |
|
|
except Exception as e: |
|
|
print(f"[FAIL] DMC Alerts: {e}") |
|
|
|
|
|
|
|
|
print("\n[2] Testing tool_weather_nowcast...") |
|
|
try: |
|
|
from src.utils.utils import tool_weather_nowcast |
|
|
result = tool_weather_nowcast() |
|
|
print(f"[OK] Weather Nowcast: {str(result)[:300]}...") |
|
|
except Exception as e: |
|
|
print(f"[FAIL] Weather Nowcast: {e}") |
|
|
|
|
|
|
|
|
print("\n[3] Testing tool_district_weather...") |
|
|
try: |
|
|
from src.utils.utils import tool_district_weather |
|
|
result = tool_district_weather("colombo") |
|
|
print(f"[OK] District Weather: {str(result)[:300]}...") |
|
|
except Exception as e: |
|
|
print(f"[FAIL] District Weather: {e}") |
|
|
|
|
|
|
|
|
print("\n[4] Testing tool_rivernet_status (may take 30-60 seconds)...") |
|
|
try: |
|
|
from src.utils.utils import tool_rivernet_status |
|
|
result = tool_rivernet_status() |
|
|
print(f"[OK] RiverNet: {str(result)[:300]}...") |
|
|
except Exception as e: |
|
|
print(f"[FAIL] RiverNet: {e}") |
|
|
|
|
|
print("\n" + "="*60) |
|
|
print("[DONE] Weather tools test complete") |
|
|
print("="*60) |
|
|
|