From da31f695a9e03fad10661b28eaeb9c6ce2df2e48 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 16 Jan 2026 15:56:07 -0800 Subject: [PATCH] test_image_size_limit_disabled --- .../litellm_core_utils/test_image_handling.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_litellm/litellm_core_utils/test_image_handling.py b/tests/test_litellm/litellm_core_utils/test_image_handling.py index 144ba2b7b6d..b15d75a4145 100644 --- a/tests/test_litellm/litellm_core_utils/test_image_handling.py +++ b/tests/test_litellm/litellm_core_utils/test_image_handling.py @@ -126,12 +126,15 @@ def test_image_within_size_limit(monkeypatch): def test_image_size_limit_disabled(monkeypatch): """ - Test that setting MAX_IMAGE_URL_DOWNLOAD_SIZE_MB to 0 disables size checking. + Test that setting MAX_IMAGE_URL_DOWNLOAD_SIZE_MB to 0 disables all image URL downloads. """ import litellm.litellm_core_utils.prompt_templates.image_handling as image_handling - monkeypatch.setattr(litellm, "module_level_client", LargeImageClient(size_mb=100)) + monkeypatch.setattr(litellm, "module_level_client", SmallImageClient()) monkeypatch.setattr(image_handling, "MAX_IMAGE_URL_DOWNLOAD_SIZE_MB", 0) - result = convert_url_to_base64("https://example.com/large-image.jpg") - assert result.startswith("data:image/jpeg;base64,") + with pytest.raises(litellm.ImageFetchError) as excinfo: + convert_url_to_base64("https://example.com/image.jpg") + + assert "Image URL download is disabled" in str(excinfo.value) + assert "MAX_IMAGE_URL_DOWNLOAD_SIZE_MB=0" in str(excinfo.value)