messages content 为纯空格字符串,服务正常返回
()
| 182 | |
| 183 | |
| 184 | def test_prompt_only_spaces(): |
| 185 | """messages content 为纯空格字符串,服务正常返回""" |
| 186 | data = { |
| 187 | "messages": [ |
| 188 | { |
| 189 | "role": "user", |
| 190 | "content": " ", # 纯空格 |
| 191 | } |
| 192 | ], |
| 193 | "stream": False, |
| 194 | "max_tokens": 10, |
| 195 | } |
| 196 | payload = build_request_payload(TEMPLATE, data) |
| 197 | resp = send_request(URL, payload).json() |
| 198 | assert resp.get("object") == "chat.completion", "应返回 chat.completion 对象" |
| 199 | response_content = resp["choices"][0]["message"]["content"] |
| 200 | assert len(response_content) > 0, "messages content为空,未正常生成回复" |
| 201 | |
| 202 | |
| 203 | def test_illegal_characters(): |
nothing calls this directly
no test coverage detected