31 行
971 B
Python
31 行
971 B
Python
|
|
from core.generation_errors import provider_failure_user_message
|
||
|
|
|
||
|
|
|
||
|
|
def test_ssl_unexpected_eof_has_actionable_chinese_message() -> None:
|
||
|
|
message = provider_failure_user_message(
|
||
|
|
{
|
||
|
|
"category": "network_error",
|
||
|
|
"route_name": "wy-gpt-image-2",
|
||
|
|
"details": {
|
||
|
|
"reason": "[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1010)"
|
||
|
|
},
|
||
|
|
}
|
||
|
|
)
|
||
|
|
|
||
|
|
assert "提前关闭了 TLS 连接" in message
|
||
|
|
assert "队列中重试" in message
|
||
|
|
assert "wy-gpt-image-2" in message
|
||
|
|
|
||
|
|
|
||
|
|
def test_read_timeout_has_actionable_chinese_message() -> None:
|
||
|
|
message = provider_failure_user_message(
|
||
|
|
{
|
||
|
|
"category": "network_error",
|
||
|
|
"route_name": "wy-gpt-image-2",
|
||
|
|
"details": {"reason": "The read operation timed out"},
|
||
|
|
}
|
||
|
|
)
|
||
|
|
|
||
|
|
assert "长时间未返回结果" in message
|
||
|
|
assert "提高适配器超时时间" in message
|