完成大量美化,zustand迁移,动态表格修复
This commit is contained in:
43
test_route_import.py
Normal file
43
test_route_import.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""
|
||||
测试路由导入是否正常
|
||||
"""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# 添加项目根目录到 Python 路径
|
||||
sys.path.insert(0, str(Path(__file__).parent / "backend"))
|
||||
|
||||
print("=" * 70)
|
||||
print("测试路由导入")
|
||||
print("=" * 70)
|
||||
|
||||
try:
|
||||
print("\n1. 尝试导入 presetsRoute...")
|
||||
from api.routes import presetsRoute
|
||||
print("✓ 成功导入 presetsRoute")
|
||||
|
||||
print("\n2. 检查 router 对象...")
|
||||
print(f" router 类型: {type(presetsRoute.router)}")
|
||||
print(f" router 前缀: {presetsRoute.router.prefix}")
|
||||
|
||||
print("\n3. 尝试调用 list_presets 函数...")
|
||||
# 注意:这是异步函数,不能直接调用
|
||||
print(f" list_presets 函数: {presetsRoute.list_presets}")
|
||||
print(f" 函数类型: {type(presetsRoute.list_presets)}")
|
||||
|
||||
print("\n4. 直接调用 PresetService.list_presets()...")
|
||||
result = presetsRoute.PresetService.list_presets()
|
||||
print(f" 返回结果: {result}")
|
||||
print(f" 结果长度: {len(result)}")
|
||||
|
||||
if len(result) > 0:
|
||||
print("\n✓ 路由导入和调用都正常!")
|
||||
else:
|
||||
print("\n✗ 警告:返回空列表")
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n✗ 导入失败: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
print("\n" + "=" * 70)
|
||||
Reference in New Issue
Block a user