mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-22 00:31:44 +00:00
test(claude_code): reject empty stdin_input symmetric to prompt
run_claude validated empty prompt strings but silently accepted stdin_input="", letting an empty stdin reach the subprocess and surface as a confusing CLI failure instead of a clear ValueError.
This commit is contained in:
parent
0901890994
commit
9a4eb2dea5
2 changed files with 11 additions and 0 deletions
|
|
@ -301,6 +301,15 @@ def test_run_claude_validates_required_params():
|
|||
api_key="k",
|
||||
runner=runner,
|
||||
)
|
||||
with pytest.raises(ValueError, match="stdin_input"):
|
||||
run_claude(
|
||||
prompt=None,
|
||||
stdin_input="",
|
||||
model="m",
|
||||
base_url="http://x",
|
||||
api_key="k",
|
||||
runner=runner,
|
||||
)
|
||||
with pytest.raises(ValueError, match="model"):
|
||||
run_claude(
|
||||
prompt="hi",
|
||||
|
|
|
|||
|
|
@ -125,6 +125,8 @@ def run_claude(
|
|||
raise ValueError("must supply only one of `prompt` or `stdin_input`, not both")
|
||||
if prompt is not None and not prompt:
|
||||
raise ValueError("prompt must be a non-empty string when provided")
|
||||
if stdin_input is not None and not stdin_input:
|
||||
raise ValueError("stdin_input must be a non-empty string when provided")
|
||||
if not model:
|
||||
raise ValueError("model must be a non-empty string")
|
||||
if not base_url:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue