Skip to content

Commit f7f512d

Browse files
committed
fix: test
1 parent 8f9242e commit f7f512d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

llama-index-core/tests/multi_modal_llms/test_generic_utils.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ def test_image_documents_to_base64_multiple_sources():
6161
]
6262
with patch("requests.get") as mock_get:
6363
mock_get.return_value.content = EXP_BINARY
64-
with patch("builtins.open", mock_open(read_data=EXP_BINARY)):
65-
result = image_documents_to_base64(documents)
64+
with patch("os.path.isfile", return_value=True):
65+
with patch("builtins.open", mock_open(read_data=EXP_BINARY)):
66+
result = image_documents_to_base64(documents)
6667

6768
assert len(result) == 4
6869
assert all(encoding == EXP_BASE64 for encoding in result)
@@ -144,8 +145,10 @@ def test_set_base64_and_mimetype_for_image_docs():
144145

145146
with patch("requests.get") as mock_get:
146147
mock_get.return_value.content = EXP_BINARY
147-
with patch("builtins.open", mock_open(read_data=EXP_BINARY)):
148-
results = set_base64_and_mimetype_for_image_docs(image_docs)
148+
# patch os.path.isfile
149+
with patch("os.path.isfile", return_value=True):
150+
with patch("builtins.open", mock_open(read_data=EXP_BINARY)):
151+
results = set_base64_and_mimetype_for_image_docs(image_docs)
149152

150153
assert len(results) == 2
151154
assert results[0].image == EXP_BASE64

0 commit comments

Comments
 (0)