fix: apply black formatting with line-length 127 for CI compliance

This commit is contained in:
Vito Sansevero
2025-08-01 09:41:21 -07:00
parent 589fbf3568
commit bbd239cbd6
2 changed files with 6 additions and 18 deletions
+1 -3
View File
@@ -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)
+5 -15
View File
@@ -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"