Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Commit 14eadf0

Browse files
committed
Fix linting issues in test files
1 parent 1699dc2 commit 14eadf0

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

test_dir/test_main_improved.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import os
77
import sys
8-
import unittest
9-
from unittest.mock import patch, MagicMock, call
8+
from unittest import TestCase, mock
9+
from unittest.mock import MagicMock, call, patch
1010

1111
# Import pytest only if available
1212
try:
@@ -35,8 +35,12 @@ def decorator(f):
3535
try:
3636
from cli_code.config import Config
3737
from cli_code.main import (
38-
cli, set_default_provider, set_default_model, list_models,
39-
setup_command, start_interactive_session
38+
cli,
39+
list_models,
40+
set_default_model,
41+
set_default_provider,
42+
setup_command,
43+
start_interactive_session,
4044
)
4145
# Import click testing if available
4246
try:
@@ -69,7 +73,7 @@ def start_interactive_session(): pass
6973
)
7074

7175
@skip_if_imports_unavailable
72-
class TestMainCLICommands(unittest.TestCase):
76+
class TestMainCLICommands(TestCase):
7377
"""Tests for main CLI commands that weren't well covered previously."""
7478

7579
@patch('cli_code.main.Config')
@@ -110,7 +114,7 @@ def test_list_models_invalid_provider(self, mock_get_models, mock_config):
110114
mock_get_models.assert_not_called()
111115

112116
@skip_if_imports_unavailable
113-
class TestInteractiveSession(unittest.TestCase):
117+
class TestInteractiveSession(TestCase):
114118
"""Tests for interactive session functionality."""
115119

116120
@patch('cli_code.main.get_agent_for_provider')

test_dir/test_model_basic.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
These tests focus on increasing coverage for the model classes.
44
"""
55

6-
import unittest
7-
from unittest.mock import patch, MagicMock
6+
from unittest import TestCase, skipIf
7+
from unittest.mock import MagicMock, patch
88

99
# Import necessary modules safely
1010
try:
@@ -19,9 +19,10 @@ class AbstractModelAgent: pass
1919
class GeminiModelAgent: pass
2020
class OllamaModelAgent: pass
2121

22+
2223
# Skip all tests if imports aren't available
23-
@unittest.skipIf(not IMPORTS_AVAILABLE, "Required model imports not available")
24-
class TestGeminiModelBasics(unittest.TestCase):
24+
@skipIf(not IMPORTS_AVAILABLE, "Required model imports not available")
25+
class TestGeminiModelBasics(TestCase):
2526
"""Test basic GeminiModelAgent functionality that doesn't require API calls."""
2627

2728
def test_gemini_init(self):
@@ -82,8 +83,9 @@ def test_gemini_append_history(self, mock_get_model, mock_configure):
8283
self.assertEqual(agent.history[1]["role"], "model")
8384
self.assertEqual(agent.history[1]["parts"][0]["text"], "Hi there!")
8485

85-
@unittest.skipIf(not IMPORTS_AVAILABLE, "Required model imports not available")
86-
class TestOllamaModelBasics(unittest.TestCase):
86+
87+
@skipIf(not IMPORTS_AVAILABLE, "Required model imports not available")
88+
class TestOllamaModelBasics(TestCase):
8789
"""Test basic OllamaModelAgent functionality that doesn't require API calls."""
8890

8991
def test_ollama_init(self):

0 commit comments

Comments
 (0)