diff --git a/projects/fal/tests/toolkit/file_test.py b/projects/fal/tests/toolkit/file_test.py index 310f65bf..5d2619e9 100644 --- a/projects/fal/tests/toolkit/file_test.py +++ b/projects/fal/tests/toolkit/file_test.py @@ -19,6 +19,7 @@ def test_binary_content_matches(): def test_default_content_type(): file = File.from_bytes(b"Hello World", repository="in_memory") assert file.content_type == "application/octet-stream" + assert file.file_name assert file.file_name.endswith(".bin") @@ -27,6 +28,7 @@ def test_file_name_from_content_type(): b"Hello World", content_type="text/plain", repository="in_memory" ) assert file.content_type == "text/plain" + assert file.file_name assert file.file_name.endswith(".txt") diff --git a/projects/fal/tests/toolkit/image_test.py b/projects/fal/tests/toolkit/image_test.py index 742368b0..87eca217 100644 --- a/projects/fal/tests/toolkit/image_test.py +++ b/projects/fal/tests/toolkit/image_test.py @@ -2,6 +2,7 @@ from base64 import b64encode from io import BytesIO +from typing import Literal, overload import pytest from PIL import Image as PILImage @@ -10,6 +11,14 @@ from fal.toolkit import Image +@overload +def get_image(as_bytes: Literal[False] = False) -> PILImage.Image: ... + + +@overload +def get_image(as_bytes: Literal[True]) -> bytes: ... + + def get_image(as_bytes: bool = False): from PIL import Image @@ -123,7 +132,7 @@ def init_image_on_fal(input: TestInput) -> bytes: pil_image = input_image.to_pil() return pil_image_to_bytes(pil_image) - test_input = TestInput(image=image_to_data_uri(get_image())) + test_input = TestInput(image=Image.from_pil(get_image())) image_bytes = init_image_on_fal(test_input) assert image_bytes == get_image(as_bytes=True)