From 5e540434928cad695285f11c191f347442709d13 Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Sat, 3 Oct 2026 15:52:41 +0800 Subject: [PATCH] test(tools): verify nullable enum with multiple union types --- tests/tools/test_tool_validation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/tools/test_tool_validation.py b/tests/tools/test_tool_validation.py index 0c2da1653..0f8fac296 100644 --- a/tests/tools/test_tool_validation.py +++ b/tests/tools/test_tool_validation.py @@ -934,6 +934,7 @@ def test_null_only_schema_rejects_non_null_values(raw_type, value) -> None: {"type": ["string", "null"], "enum": ["fast"]}, {"type": "string", "nullable": True, "enum": ["fast"]}, {"type": ["integer", "null"], "enum": [1]}, + {"type": ["string", "integer", "null"], "enum": ["fast", 1]}, ], ) def test_nullable_schema_still_enforces_enum(schema) -> None: @@ -941,6 +942,8 @@ def test_nullable_schema_still_enforces_enum(schema) -> None: f"mode must be one of {schema['enum']}" ] assert Schema.validate_json_schema_value(None, {**schema, "enum": [None]}) == [] + for value in schema["enum"]: + assert Schema.validate_json_schema_value(value, schema) == [] def test_nullable_string_schema_enforces_enum() -> None: