mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
Rebasing 2
This commit is contained in:
parent
23b5f306da
commit
b584991328
1 changed files with 22 additions and 0 deletions
|
@ -221,3 +221,25 @@ def test_nested_anyof_conversion():
|
|||
}
|
||||
}
|
||||
assert schema == expected
|
||||
|
||||
def test_anyof_with_excessive_nesting():
|
||||
"""Test conversion with excessive nesting > max levels +1 deep."""
|
||||
# generate a schema with excessive nesting
|
||||
schema = {"type": "object", "properties": {}}
|
||||
current = schema
|
||||
for _ in range(DEFAULT_MAX_RECURSE_DEPTH + 1):
|
||||
current["properties"] = {
|
||||
"nested": {
|
||||
"anyOf": [
|
||||
{"type": "string"},
|
||||
{"type": "null"}
|
||||
],
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
current = current["properties"]["nested"]
|
||||
|
||||
|
||||
# running the conversion will raise an error
|
||||
with pytest.raises(ValueError, match=f"Max depth of {DEFAULT_MAX_RECURSE_DEPTH} exceeded while processing schema. Please check the schema for excessive nesting."):
|
||||
convert_anyof_null_to_nullable(schema)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue