From e7b802c0d7a8be3f9d3093318da5e39f1326f04c Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Fri, 23 Aug 2024 15:00:38 -0700 Subject: [PATCH] format Change-Id: Ifb93c70f8ad48dce0fd0921de0e9e117819dc55c --- google/generativeai/types/content_types.py | 2 +- tests/test_content.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/google/generativeai/types/content_types.py b/google/generativeai/types/content_types.py index 9e9c04b2e..71d1e9907 100644 --- a/google/generativeai/types/content_types.py +++ b/google/generativeai/types/content_types.py @@ -100,7 +100,7 @@ def pil_to_blob(img): mime_type = "image/gif" else: if img.mode != "RGB": - img = img.convert('RGB') + img = img.convert("RGB") img.save(bytesio, format="JPEG") mime_type = "image/jpeg" bytesio.seek(0) diff --git a/tests/test_content.py b/tests/test_content.py index cb2879b5e..da763dc33 100644 --- a/tests/test_content.py +++ b/tests/test_content.py @@ -39,6 +39,7 @@ TEST_GIF_URL = "https://storage.googleapis.com/generativeai-downloads/data/test_img.gif" TEST_GIF_DATA = TEST_GIF_PATH.read_bytes() + # simple test function def datetime(): "Returns the current UTC date and time." @@ -93,7 +94,7 @@ def test_jpg_to_blob(self, image): @parameterized.named_parameters( ["PIL", PIL.Image.open(TEST_GIF_PATH)], - ["P", PIL.Image.fromarray(np.zeros([6, 6, 3], dtype=np.uint8)).convert('P')], + ["P", PIL.Image.fromarray(np.zeros([6, 6, 3], dtype=np.uint8)).convert("P")], ["IPython", IPython.display.Image(filename=TEST_GIF_PATH)], ) def test_gif_to_blob(self, image):