test_refactor.py•1.72 kB
#!/usr/bin/env python3
"""
Quick validation test to verify all _impl functions can be imported successfully.
This confirms the refactoring is complete.
"""
import sys
try:
print("Testing imports of refactored _impl functions...")
from server import (
get_city_weather_impl,
get_stock_quote_impl,
get_stock_daily_impl,
get_sma_impl,
get_rsi_impl,
get_fx_rate_impl,
get_crypto_rate_impl
)
print("[OK] All _impl functions imported successfully!")
# Verify they are callable
functions_to_test = [
("get_city_weather_impl", get_city_weather_impl),
("get_stock_quote_impl", get_stock_quote_impl),
("get_stock_daily_impl", get_stock_daily_impl),
("get_sma_impl", get_sma_impl),
("get_rsi_impl", get_rsi_impl),
("get_fx_rate_impl", get_fx_rate_impl),
("get_crypto_rate_impl", get_crypto_rate_impl)
]
print("\nVerifying all functions are callable...")
for name, func in functions_to_test:
if callable(func):
print(f" [OK] {name} is callable")
else:
print(f" [FAIL] {name} is NOT callable")
sys.exit(1)
print("\n[SUCCESS] All refactored functions are ready for use!")
print("\nRefactoring Summary:")
print(" - 6 financial tools refactored (stock, SMA, RSI, FX, crypto)")
print(" - 1 weather tool already refactored")
print(" - chat_test.py updated to use _impl functions")
print(" - All functions are directly callable for testing")
except ImportError as e:
print(f"[FAIL] Import error: {e}")
sys.exit(1)
except Exception as e:
print(f"[FAIL] Unexpected error: {e}")
sys.exit(1)