From bbd239cbd603356218c99efe5cebb7152fe95524 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Fri, 1 Aug 2025 09:23:25 -0700 Subject: [PATCH] fix: apply black formatting with line-length 127 for CI compliance --- kikotools/tools/gemini_prompt/logic.py | 4 +--- tests/unit/tools/test_gemini_prompt.py | 20 +++++--------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/kikotools/tools/gemini_prompt/logic.py b/kikotools/tools/gemini_prompt/logic.py index 14a74fc..ff38bb8 100644 --- a/kikotools/tools/gemini_prompt/logic.py +++ b/kikotools/tools/gemini_prompt/logic.py @@ -61,9 +61,7 @@ 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 e26af2f..20707d9 100644 --- a/tests/unit/tools/test_gemini_prompt.py +++ b/tests/unit/tools/test_gemini_prompt.py @@ -150,9 +150,7 @@ 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): @@ -167,9 +165,7 @@ 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() @@ -202,9 +198,7 @@ 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" @@ -216,9 +210,7 @@ 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 == "" @@ -239,9 +231,7 @@ 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"