test(bedrock): limit legacy schema tests to the picked source changes

This commit is contained in:
Joshua Valluru 2026-10-20 19:22:57 -07:00
parent 1a55c10eac
commit ac293013dc

View file

@ -5,7 +5,6 @@ import os
import sys
from collections.abc import Mapping
from typing import Final
from unittest.mock import MagicMock, patch
import pytest
@ -22,7 +21,6 @@ from litellm.litellm_core_utils.prompt_templates.common_utils import (
hoist_images_from_tool_messages,
is_encrypted_reasoning_block,
responses_reasoning_items_from_thinking_blocks,
salvage_concatenated_tool_arguments,
schema_grammar_branch_count,
schema_has_open_object,
schema_has_unresolvable_ref,
@ -1882,66 +1880,23 @@ def _object_with(properties: Mapping[str, object], **defs: Mapping[str, object])
("schema", "unresolvable"),
[
(_object_with({"a": {"type": "string"}}), False),
(
_object_with(
{"a": {"$ref": "#/$defs/A"}, "b": {"$ref": "#/$defs/A"}}, **{"$defs": {"A": {"type": "string"}}}
),
False,
),
(
_object_with(
{"a": {"$ref": "#/definitions/A"}},
definitions={"A": {"$ref": "#/definitions/B"}, "B": {"type": "integer"}},
),
False,
),
(
_object_with(
{"a": {"$ref": "/$defs/A"}},
**{"$defs": {"A": {"items": {"$ref": "/$defs/B"}}, "B": {"type": "string"}}},
),
False,
),
(_object_with({"a": {"$ref": "#/$defs/A"}, "b": {"$ref": "#/$defs/A"}}, **{"$defs": {"A": {"type": "string"}}}), False),
(_object_with({"a": {"$ref": "#/definitions/A"}}, definitions={"A": {"$ref": "#/definitions/B"}, "B": {"type": "integer"}}), False),
(_object_with({"a": {"$ref": "/$defs/A"}}, **{"$defs": {"A": {"items": {"$ref": "/$defs/B"}}, "B": {"type": "string"}}}), False),
(_object_with({"a": {"$ref": "#/$defs/Missing"}}, **{"$defs": {"A": {"type": "string"}}}), True),
(_object_with({"a": {"$ref": "other.json#/A"}}), True),
(_object_with({"parent": {"$ref": "#"}}), True),
(
_object_with(
{"a": {"$ref": "#/$defs/A"}}, **{"$defs": {"A": {"type": "array", "items": {"$ref": "#/$defs/A"}}}}
),
True,
),
(
_object_with(
{"a": {"$ref": "/$defs/A"}}, **{"$defs": {"A": {"type": "array", "items": {"$ref": "/$defs/A"}}}}
),
True,
),
(_object_with({"a": {"$ref": "#/$defs/A"}}, **{"$defs": {"A": {"type": "array", "items": {"$ref": "#/$defs/A"}}}}), True),
(_object_with({"a": {"$ref": "/$defs/A"}}, **{"$defs": {"A": {"type": "array", "items": {"$ref": "/$defs/A"}}}}), True),
(
_object_with(
{"a": {"$ref": "#/$defs/A"}},
**{
"$defs": {
"A": {"properties": {"b": {"$ref": "#/$defs/B"}}},
"B": {"properties": {"a": {"$ref": "#/$defs/A"}}},
}
},
**{"$defs": {"A": {"properties": {"b": {"$ref": "#/$defs/B"}}}, "B": {"properties": {"a": {"$ref": "#/$defs/A"}}}}},
),
True,
),
],
ids=[
"no-refs",
"shared-def",
"chained-definitions",
"root-path-defs",
"missing-def",
"external",
"root",
"self-cycle",
"root-path-self-cycle",
"mutual-cycle",
],
ids=["no-refs", "shared-def", "chained-definitions", "root-path-defs", "missing-def", "external", "root", "self-cycle", "root-path-self-cycle", "mutual-cycle"],
)
def test_schema_has_unresolvable_ref_flags_refs_that_cannot_be_inlined(schema, unresolvable):
assert schema_has_unresolvable_ref(schema) is unresolvable
@ -1950,11 +1905,7 @@ def test_schema_has_unresolvable_ref_flags_refs_that_cannot_be_inlined(schema, u
@pytest.mark.parametrize(
("schema", "properties", "branches"),
[
(
_object_with({"a": {"type": "string"}, "b": {"type": "string"}, "c": {"type": "string"}}, required=["a"]),
3,
8,
),
(_object_with({"a": {"type": "string"}, "b": {"type": "string"}, "c": {"type": "string"}}, required=["a"]), 3, 8),
(
_object_with(
{"x": {"$ref": "#/$defs/Pair"}, "y": {"$ref": "#/$defs/Pair"}},