MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / test_multilingual_input

Function test_multilingual_input

tests/ce/server/test_evil_cases.py:141–163  ·  view source on GitHub ↗

测试多语言混合输入是否能够被正确处理

()

Source from the content-addressed store, hash-verified

139
140
141def test_multilingual_input():
142 """测试多语言混合输入是否能够被正确处理"""
143 data = {
144 "messages": [
145 {
146 "role": "user",
147 "content": "这是一个包含多种语言的输入:Hello, 世界!Bonjour, le monde! Hola, el mundo! こんにちは、世界!",
148 }
149 ],
150 "stream": False,
151 }
152 payload = build_request_payload(TEMPLATE, data)
153 resp = send_request(URL, payload).json()
154
155 # 验证响应是否包含有效的回复
156 assert "choices" in resp, "未收到有效的回复"
157 assert len(resp["choices"]) > 0, "回复为空"
158 assert "message" in resp["choices"][0], "回复中未包含消息内容"
159 assert "content" in resp["choices"][0]["message"], "回复中未包含内容字段"
160 # 验证模型是否能够正确处理多语言输入
161 response_content = resp["choices"][0]["message"]["content"]
162 assert response_content.strip() != "", "模型未生成任何内容"
163 print("多语言混合输入测试通过!")
164
165
166def test_too_long_input():

Callers

nothing calls this directly

Calls 3

build_request_payloadFunction · 0.90
send_requestFunction · 0.90
printFunction · 0.85

Tested by

no test coverage detected