From 08ba6ca0bce890f9e0fd6ca03100e0a102824dad Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sun, 24 May 2026 14:10:16 +0000 Subject: [PATCH] Studio: test that bool inputs yield the precise 'integer or null' error Regression guard for the validator switch to mode="before". Pre-fix, vision_image_size: True was rejected with "must be in [256, 2048] (got 1)" because Pydantic coerced before our check ran. New test asserts the message now reads "integer or null". --- studio/backend/tests/test_studio_train_validation.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/studio/backend/tests/test_studio_train_validation.py b/studio/backend/tests/test_studio_train_validation.py index 27ba89d8ad..56edefd23f 100644 --- a/studio/backend/tests/test_studio_train_validation.py +++ b/studio/backend/tests/test_studio_train_validation.py @@ -85,6 +85,14 @@ class TestVisionImageSizeCap: with pytest.raises(ValidationError): _check_field("vision_image_size", value) + @pytest.mark.parametrize("value", [True, False]) + def test_bool_error_says_integer_not_range(self, value): + # Regression guard: pre-fix the bool was coerced to 1/0 and the + # message read "must be in [256, 2048] (got 1)", which was confusing. + with pytest.raises(ValidationError) as exc: + _check_field("vision_image_size", value) + assert "integer or null" in str(exc.value) + class TestLoraRCap: def test_at_cap_accepts(self):