@@ -37,7 +37,7 @@ def mock_processor():
37
37
38
38
39
39
@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 :
41
41
if image_size is None :
42
42
image_size = (80 , 40 )
43
43
image = Image .new (mode = "RGBA" , size = image_size )
@@ -67,7 +67,9 @@ def sample_conversation_using_image_binary():
67
67
messages = [
68
68
Message (role = Role .USER , content = "Describe this image:" , type = Type .TEXT ),
69
69
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 ,
71
73
),
72
74
Message (
73
75
role = Role .ASSISTANT ,
@@ -126,7 +128,7 @@ def test_transform_image_using_image_binary(test_dataset_using_image_binary):
126
128
mock_image = Mock (spec = Image .Image )
127
129
mock_open .return_value .convert .return_value = mock_image
128
130
129
- test_image_bytes = _create_test_image ()
131
+ test_image_bytes = _get_test_png_image_bytes ()
130
132
test_dataset_using_image_binary .transform_image (
131
133
Message (type = Type .IMAGE_BINARY , binary = test_image_bytes , role = Role .USER )
132
134
)
0 commit comments