- Add one-click research protocol generation with streaming output - Implement Word document export via Pandoc integration - Add dynamic dual-panel layout with resizable split pane - Implement collapsible content for StatePanel stages - Add conversation history management with title auto-update - Fix scroll behavior, markdown rendering, and UI layout issues - Simplify conversation creation logic for reliability
97 lines
921 B
Python
97 lines
921 B
Python
"""测试dc_executor模块"""
|
|
print("测试dc_executor模块导入...")
|
|
try:
|
|
from services.dc_executor import validate_code, execute_pandas_code
|
|
print("✅ 模块导入成功")
|
|
|
|
# 测试验证功能
|
|
print("\n测试validate_code...")
|
|
result = validate_code("df['x'] = 1")
|
|
print(f"✅ validate_code成功: {result}")
|
|
|
|
# 测试执行功能
|
|
print("\n测试execute_pandas_code...")
|
|
test_data = [{"age": 25}, {"age": 65}]
|
|
result = execute_pandas_code(test_data, "df['old'] = df['age'] > 60")
|
|
print(f"✅ execute_pandas_code成功: success={result['success']}")
|
|
if result['success']:
|
|
print(f" 结果: {result['result_data']}")
|
|
|
|
print("\n🎉 所有模块测试通过!")
|
|
|
|
except Exception as e:
|
|
print(f"❌ 测试失败: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|