Skip to content

Commit be14a22

Browse files
committed
_get_test_png_image_bytes
1 parent 9bb2c01 commit be14a22

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/core/datasets/test_vision_language_dataset.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def mock_processor():
3737

3838

3939
@functools.lru_cache(maxsize=None) # same as @cache added in Python 3.9
40-
def _create_test_image(image_size: Optional[Tuple[int, int]] = None) -> bytes:
40+
def _get_test_png_image_bytes(image_size: Optional[Tuple[int, int]] = None) -> bytes:
4141
if image_size is None:
4242
image_size = (80, 40)
4343
image = Image.new(mode="RGBA", size=image_size)
@@ -67,7 +67,9 @@ def sample_conversation_using_image_binary():
6767
messages=[
6868
Message(role=Role.USER, content="Describe this image:", type=Type.TEXT),
6969
Message(
70-
role=Role.USER, binary=_create_test_image(), type=Type.IMAGE_BINARY
70+
role=Role.USER,
71+
binary=_get_test_png_image_bytes(),
72+
type=Type.IMAGE_BINARY,
7173
),
7274
Message(
7375
role=Role.ASSISTANT,
@@ -126,7 +128,7 @@ def test_transform_image_using_image_binary(test_dataset_using_image_binary):
126128
mock_image = Mock(spec=Image.Image)
127129
mock_open.return_value.convert.return_value = mock_image
128130

129-
test_image_bytes = _create_test_image()
131+
test_image_bytes = _get_test_png_image_bytes()
130132
test_dataset_using_image_binary.transform_image(
131133
Message(type=Type.IMAGE_BINARY, binary=test_image_bytes, role=Role.USER)
132134
)

0 commit comments

Comments
 (0)