fix(api): 修復 34 個 Ruff lint 錯誤
- 自動修復 import 排序、unused imports - 手動修復 raise from、isinstance union、unused variable - scripts/ 暫時保留 (非 CI 阻擋) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,6 @@ NVIDIA Provider Tests - ADR-036
|
||||
注意: 這些是單元測試,不需要真實的 NVIDIA API Key
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -407,7 +406,7 @@ class TestAIRouterNvidiaIntegration:
|
||||
|
||||
def test_tool_calling_route(self):
|
||||
"""測試 Tool Calling 路由"""
|
||||
from src.services.ai_router import get_ai_router, AIProvider, reset_ai_router
|
||||
from src.services.ai_router import AIProvider, get_ai_router, reset_ai_router
|
||||
|
||||
reset_ai_router()
|
||||
router = get_ai_router()
|
||||
@@ -425,7 +424,7 @@ class TestAIRouterNvidiaIntegration:
|
||||
|
||||
def test_existing_routing_not_affected(self):
|
||||
"""測試現有路由規則不受影響"""
|
||||
from src.services.ai_router import get_ai_router, AIProvider, reset_ai_router
|
||||
from src.services.ai_router import AIProvider, get_ai_router, reset_ai_router
|
||||
|
||||
reset_ai_router()
|
||||
router = get_ai_router()
|
||||
@@ -568,9 +567,9 @@ class TestPrometheusMetrics:
|
||||
def test_metrics_defined(self):
|
||||
"""測試 Prometheus Metrics 已定義"""
|
||||
from src.services.nvidia_provider import (
|
||||
NVIDIA_REQUESTS_TOTAL,
|
||||
NVIDIA_LATENCY_HISTOGRAM,
|
||||
NVIDIA_CIRCUIT_BREAKER_STATE,
|
||||
NVIDIA_LATENCY_HISTOGRAM,
|
||||
NVIDIA_REQUESTS_TOTAL,
|
||||
)
|
||||
|
||||
assert NVIDIA_REQUESTS_TOTAL is not None
|
||||
@@ -593,8 +592,8 @@ class TestExponentialBackoff:
|
||||
"""測試退避常數已定義"""
|
||||
from src.services.nvidia_provider import (
|
||||
RETRY_BASE_DELAY,
|
||||
RETRY_MAX_DELAY,
|
||||
RETRY_EXPONENTIAL_BASE,
|
||||
RETRY_MAX_DELAY,
|
||||
)
|
||||
|
||||
assert RETRY_BASE_DELAY == 1.0
|
||||
|
||||
Reference in New Issue
Block a user