From efc079a95be23f8d8391051deb5f2c87befb4fc0 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Fri, 1 Aug 2025 09:27:32 -0700 Subject: [PATCH] fix: reformat with black default settings (88 char) to match CI --- kikotools/tools/gemini_prompt/logic.py | 4 +++- tests/unit/tools/test_gemini_prompt.py | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/kikotools/tools/gemini_prompt/logic.py b/kikotools/tools/gemini_prompt/logic.py index ff38bb8..14a74fc 100644 --- a/kikotools/tools/gemini_prompt/logic.py +++ b/kikotools/tools/gemini_prompt/logic.py @@ -61,7 +61,9 @@ def get_api_key() -> Optional[str]: if not api_key: # Check for config file in ComfyUI directory try: - config_path = os.path.join(os.path.dirname(__file__), "..", "..", "..", "gemini_config.json") + config_path = os.path.join( + os.path.dirname(__file__), "..", "..", "..", "gemini_config.json" + ) if os.path.exists(config_path): with open(config_path, "r") as f: config = json.load(f) diff --git a/tests/unit/tools/test_gemini_prompt.py b/tests/unit/tools/test_gemini_prompt.py index 20707d9..e26af2f 100644 --- a/tests/unit/tools/test_gemini_prompt.py +++ b/tests/unit/tools/test_gemini_prompt.py @@ -150,7 +150,9 @@ class TestGeminiLogic: # Test JPEG format result_jpeg = image_to_base64(image, format="JPEG") assert isinstance(result_jpeg, str) - assert result != result_jpeg # Different formats should produce different results + assert ( + result != result_jpeg + ) # Different formats should produce different results @patch.dict("os.environ", {"GEMINI_API_KEY": "test_key_123"}) def test_get_api_key_from_env(self): @@ -165,7 +167,9 @@ class TestGeminiLogic: """Test getting API key from config file.""" # Setup mock_exists.return_value = True - mock_open.return_value.__enter__.return_value.read.return_value = '{"api_key": "config_key_456"}' + mock_open.return_value.__enter__.return_value.read.return_value = ( + '{"api_key": "config_key_456"}' + ) # Execute result = get_api_key() @@ -198,7 +202,9 @@ class TestGeminiLogic: test_image = np.random.rand(64, 64, 3) # Execute - result, error = analyze_image_with_gemini(test_image, "flux", api_key="test_key") + result, error = analyze_image_with_gemini( + test_image, "flux", api_key="test_key" + ) # Assert assert result == "A beautiful sunset over mountains" @@ -210,7 +216,9 @@ class TestGeminiLogic: """Test analysis without API key.""" test_image = np.random.rand(64, 64, 3) - with patch("kikotools.tools.gemini_prompt.logic.get_api_key", return_value=None): + with patch( + "kikotools.tools.gemini_prompt.logic.get_api_key", return_value=None + ): result, error = analyze_image_with_gemini(test_image, "flux") assert result == "" @@ -231,7 +239,9 @@ class TestGeminiLogic: custom_prompt = "Analyze this image and describe the colors" # Execute - result, error = analyze_image_with_gemini(test_image, "flux", api_key="test_key", custom_prompt=custom_prompt) + result, error = analyze_image_with_gemini( + test_image, "flux", api_key="test_key", custom_prompt=custom_prompt + ) # Assert assert result == "Custom analysis result"