mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-15 09:12:18 +00:00
test(utils): trim redundant comments per review feedback
This commit is contained in:
parent
9a2ce10401
commit
32ae491b6d
1 changed files with 4 additions and 8 deletions
|
|
@ -1602,7 +1602,6 @@ def test_vertex_params_not_stripped_for_vertex_family(
|
|||
|
||||
class TestIsBase64Encoded:
|
||||
def test_valid_base64_data_uri_returns_true(self):
|
||||
# "aGVsbG8gd29ybGQ=" is the base64 encoding of "hello world"
|
||||
assert (
|
||||
litellm.utils.is_base64_encoded(
|
||||
"data:text/plain;base64,aGVsbG8gd29ybGQ="
|
||||
|
|
@ -1611,29 +1610,26 @@ class TestIsBase64Encoded:
|
|||
)
|
||||
|
||||
def test_plain_string_without_data_prefix_returns_false(self):
|
||||
# Guards against false positives on ordinary strings, e.g. "Dog"
|
||||
assert litellm.utils.is_base64_encoded("Dog") is False
|
||||
|
||||
def test_empty_string_returns_false(self):
|
||||
assert litellm.utils.is_base64_encoded("") is False
|
||||
|
||||
def test_data_prefix_without_comma_returns_false(self):
|
||||
# No comma means the split(",")[1] access fails internally,
|
||||
# which is caught by the except Exception clause
|
||||
assert litellm.utils.is_base64_encoded("data:text/plain;base64") is False
|
||||
|
||||
def test_data_prefix_with_invalid_base64_content_returns_false(self):
|
||||
# "!!!not-base64!!!" is not valid base64, decode should fail
|
||||
assert (
|
||||
litellm.utils.is_base64_encoded("data:text/plain;base64,!!!not-base64!!!")
|
||||
is False
|
||||
)
|
||||
|
||||
def test_data_prefix_with_empty_payload_returns_true(self):
|
||||
# Empty string after the comma decodes to empty bytes, which
|
||||
# trivially round-trips back to an empty string, so this is True
|
||||
# NOTE: this currently returns True because an empty string trivially
|
||||
# round-trips through base64 decode/encode. Callers that use this
|
||||
# result to route empty payloads into image/media fields should be
|
||||
# aware this is a false positive — see PR #38638 discussion.
|
||||
assert litellm.utils.is_base64_encoded("data:text/plain;base64,") is True
|
||||
|
||||
from litellm.utils import supports_function_calling
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue