style: format tests/unit/test_cosyvoice_service.py with black 26.5.1
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 17s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 2m56s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 17s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 2m56s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
This commit is contained in:
@@ -197,7 +197,11 @@ class TestSubmitCloneTask:
|
||||
|
||||
payload = mock_client.request.call_args.kwargs["json"]
|
||||
# 中文和特殊字符被过滤,剩下字母数字
|
||||
assert payload["input"]["prefix"] == "2024" or payload["input"]["prefix"] == "clone" or len(payload["input"]["prefix"]) <= 10
|
||||
assert (
|
||||
payload["input"]["prefix"] == "2024"
|
||||
or payload["input"]["prefix"] == "clone"
|
||||
or len(payload["input"]["prefix"]) <= 10
|
||||
)
|
||||
|
||||
def test_submit_auth_401_raises(self) -> None:
|
||||
mock_client = MagicMock()
|
||||
@@ -305,9 +309,7 @@ class TestPollCloneTask:
|
||||
|
||||
def test_poll_undeployed_raises_error(self) -> None:
|
||||
mock_client = MagicMock()
|
||||
mock_client.request.return_value = _mock_response(
|
||||
200, {"output": {"status": "UNDEPLOYED"}}
|
||||
)
|
||||
mock_client.request.return_value = _mock_response(200, {"output": {"status": "UNDEPLOYED"}})
|
||||
|
||||
service = _make_service(http_client=mock_client)
|
||||
service.CLONE_POLL_INTERVAL = 0.01
|
||||
@@ -317,9 +319,7 @@ class TestPollCloneTask:
|
||||
|
||||
def test_poll_timeout_raises(self) -> None:
|
||||
mock_client = MagicMock()
|
||||
mock_client.request.return_value = _mock_response(
|
||||
200, {"output": {"status": "DEPLOYING"}}
|
||||
)
|
||||
mock_client.request.return_value = _mock_response(200, {"output": {"status": "DEPLOYING"}})
|
||||
|
||||
service = _make_service(http_client=mock_client)
|
||||
service.CLONE_POLL_INTERVAL = 0.01
|
||||
@@ -396,9 +396,7 @@ class TestSynthesizeSpeech:
|
||||
)
|
||||
|
||||
service = _make_service(http_client=mock_client)
|
||||
result = service.synthesize_speech(
|
||||
text="你好世界", voice_id="longxiaochun_v3"
|
||||
)
|
||||
result = service.synthesize_speech(text="你好世界", voice_id="longxiaochun_v3")
|
||||
|
||||
assert isinstance(result, SynthesizeResult)
|
||||
assert result.audio_url == "https://dashscope-result.oss.com/output.mp3"
|
||||
@@ -426,8 +424,12 @@ class TestSynthesizeSpeech:
|
||||
|
||||
service = _make_service(http_client=mock_client)
|
||||
service.synthesize_speech(
|
||||
text="test", voice_id="v1", sample_rate=44100,
|
||||
format="wav", speed=1.5, volume=80,
|
||||
text="test",
|
||||
voice_id="v1",
|
||||
sample_rate=44100,
|
||||
format="wav",
|
||||
speed=1.5,
|
||||
volume=80,
|
||||
)
|
||||
|
||||
payload = mock_client.request.call_args.kwargs["json"]
|
||||
@@ -463,7 +465,8 @@ class TestSynthesizeSpeech:
|
||||
"""同步接口的 submit_synthesize_task 返回空 task_id 字段(兼容旧接口)."""
|
||||
mock_client = MagicMock()
|
||||
mock_client.request.return_value = _mock_response(
|
||||
200, {"output": {"audio": {"url": "https://e.com/a.mp3"}}},
|
||||
200,
|
||||
{"output": {"audio": {"url": "https://e.com/a.mp3"}}},
|
||||
)
|
||||
|
||||
service = _make_service(http_client=mock_client)
|
||||
@@ -490,9 +493,7 @@ class TestRetryLogic:
|
||||
mock_client.request.side_effect = [
|
||||
_mock_response(500, text="Server Error"),
|
||||
_mock_response(502, text="Bad Gateway"),
|
||||
_mock_response(
|
||||
200, {"output": {"audio": {"url": "https://e.com/a.mp3"}}}
|
||||
),
|
||||
_mock_response(200, {"output": {"audio": {"url": "https://e.com/a.mp3"}}}),
|
||||
]
|
||||
|
||||
service = _make_service(http_client=mock_client)
|
||||
@@ -547,9 +548,7 @@ class TestSanitizePrefix:
|
||||
class TestCheckTaskStatus:
|
||||
def test_check_task_status_uses_query_voice(self) -> None:
|
||||
mock_client = MagicMock()
|
||||
mock_client.request.return_value = _mock_response(
|
||||
200, {"output": {"status": "OK"}}
|
||||
)
|
||||
mock_client.request.return_value = _mock_response(200, {"output": {"status": "OK"}})
|
||||
|
||||
service = _make_service(http_client=mock_client)
|
||||
result = service.check_task_status("voice-123")
|
||||
|
||||
Reference in New Issue
Block a user