File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
pydantic_ai_slim/pydantic_ai Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1060,7 +1060,7 @@ class FilePart:
10601060
10611061 def has_content (self ) -> bool :
10621062 """Return `True` if the file content is non-empty."""
1063- return bool (self .content .data ) # pragma: no cover
1063+ return bool (self .content .data )
10641064
10651065 __repr__ = _utils .dataclasses_no_defaults_repr
10661066
Original file line number Diff line number Diff line change @@ -422,6 +422,14 @@ def test_pre_usage_refactor_messages_deserializable():
422422 )
423423
424424
425+ def test_file_part_has_content ():
426+ filepart = FilePart (content = BinaryContent (data = b'' , media_type = 'application/pdf' ))
427+ assert not filepart .has_content ()
428+
429+ filepart .content .data = b'not empty'
430+ assert filepart .has_content ()
431+
432+
425433def test_file_part_serialization_roundtrip ():
426434 # Verify that a serialized BinaryImage doesn't come back as a BinaryContent.
427435 messages : list [ModelMessage ] = [
You can’t perform that action at this time.
0 commit comments