This commit is contained in:
ShalmanKursheeth 2026-11-02 22:35:35 +00:00 • committed by GitHub
commit 3187df25da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9904,6 +9904,26 @@ def test_is_base64_encoded_2():
assert is_base64_encoded(s="Dog") is False
@pytest.mark.parametrize(
"value",
[
"",
"data:text/plain;base64",
"data:text/plain;base64,!!!not-base64!!!",
],
)
def test_is_base64_encoded_rejects_malformed_input(value):
from litellm.utils import is_base64_encoded
assert is_base64_encoded(s=value) is False
def test_is_base64_encoded_accepts_text_data_uri():
from litellm.utils import is_base64_encoded
assert is_base64_encoded(s="data:text/plain;base64,aGVsbG8gd29ybGQ=") is True
@pytest.mark.parametrize(
"messages, expected_bool",
[