mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-09 08:18:12 +00:00
test(utils): add edge-case coverage for is_base64_encoded
Adds parametrized cases for malformed input (empty string, missing comma, non-base64 payload) and a valid text data URI. Test-only change; the existing PNG and "Dog" cases are already covered by test_is_base64_encoded_2. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UqediyVH1ZRdT3eJqoz2bY
This commit is contained in:
parent
60fc121ce8
commit
c8b0c2d0e1
1 changed files with 20 additions and 0 deletions
|
|
@ -9872,6 +9872,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",
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue