- 新增 _calculate_lane_conflicts_v2() 分開返回標籤重疊和線穿框分數 - 修改泳道選擇算法,優先選擇無標籤重疊的泳道 - 兩階段搜尋:優先側別無可用泳道則嘗試另一側 - 增強日誌輸出,顯示標籤範圍和詳細衝突分數 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
816 B
Python
32 lines
816 B
Python
"""
|
|
整合測試配置
|
|
|
|
提供 FastAPI 測試客戶端和通用 fixtures
|
|
"""
|
|
|
|
import pytest
|
|
import pytest_asyncio
|
|
from httpx import AsyncClient, ASGITransport
|
|
from backend.main import app
|
|
|
|
@pytest_asyncio.fixture
|
|
async def client():
|
|
"""
|
|
AsyncClient fixture for testing FastAPI endpoints
|
|
|
|
使用 httpx.AsyncClient 來測試 async 端點
|
|
"""
|
|
transport = ASGITransport(app=app)
|
|
async with AsyncClient(transport=transport, base_url="http://test") as ac:
|
|
yield ac
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_csv_content():
|
|
"""範例 CSV 內容"""
|
|
return b"""id,title,start,end,group,description,color
|
|
evt-001,Event 1,2024-01-01,2024-01-02,Group A,Test event 1,#3B82F6
|
|
evt-002,Event 2,2024-01-05,2024-01-06,Group B,Test event 2,#10B981
|
|
evt-003,Event 3,2024-01-10,,Group A,Test event 3,#F59E0B
|
|
"""
|