Spaces:
Sleeping
Sleeping
#!/usr/bin/env python3 | |
""" | |
Quick test for ChartDataTool cleanup functionality | |
""" | |
import asyncio | |
import sys | |
import os | |
# Add src to path | |
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')) | |
from src.tools.chart_data_tool import ChartDataTool | |
async def test_chart_tool_cleanup(): | |
"""Test that ChartDataTool works and cleanup doesn't throw errors""" | |
print("π§ͺ Testing ChartDataTool...") | |
tool = ChartDataTool() | |
try: | |
# Test basic functionality | |
print("π Testing price chart data...") | |
result = await tool._arun("price_chart", "bitcoin", "7d") | |
print(f"β Chart data result: {len(result)} characters") | |
# Test cleanup method exists and works | |
print("π§Ή Testing cleanup method...") | |
await tool.cleanup() | |
print("β Cleanup method executed successfully") | |
return True | |
except Exception as e: | |
print(f"β Test failed: {e}") | |
return False | |
async def main(): | |
success = await test_chart_tool_cleanup() | |
if success: | |
print("\nπ All tests passed!") | |
return 0 | |
else: | |
print("\nβ Tests failed!") | |
return 1 | |
if __name__ == "__main__": | |
exit_code = asyncio.run(main()) | |
sys.exit(exit_code) | |