refactor(tests): Add strict type hints to first batch of test files
This commit is contained in:
@@ -29,7 +29,7 @@ class TestGeminiCliAdapterParity(unittest.TestCase):
|
||||
self.session_logger_patcher.stop()
|
||||
|
||||
@patch('subprocess.Popen')
|
||||
def test_count_tokens_uses_estimation(self, mock_popen):
|
||||
def test_count_tokens_uses_estimation(self, mock_popen: MagicMock) -> None:
|
||||
"""
|
||||
Test that count_tokens uses character-based estimation.
|
||||
"""
|
||||
@@ -42,7 +42,7 @@ class TestGeminiCliAdapterParity(unittest.TestCase):
|
||||
mock_popen.assert_not_called()
|
||||
|
||||
@patch('subprocess.Popen')
|
||||
def test_send_with_safety_settings_no_flags_added(self, mock_popen):
|
||||
def test_send_with_safety_settings_no_flags_added(self, mock_popen: MagicMock) -> None:
|
||||
"""
|
||||
Test that the send method does NOT add --safety flags when safety_settings are provided,
|
||||
as this functionality is no longer supported via CLI flags.
|
||||
@@ -66,7 +66,7 @@ class TestGeminiCliAdapterParity(unittest.TestCase):
|
||||
process_mock.communicate.assert_called_once_with(input=message_content)
|
||||
|
||||
@patch('subprocess.Popen')
|
||||
def test_send_without_safety_settings_no_flags(self, mock_popen):
|
||||
def test_send_without_safety_settings_no_flags(self, mock_popen: MagicMock) -> None:
|
||||
"""
|
||||
Test that when safety_settings is None or an empty list, no --safety flags are added.
|
||||
"""
|
||||
@@ -85,7 +85,7 @@ class TestGeminiCliAdapterParity(unittest.TestCase):
|
||||
self.assertNotIn("--safety", args_empty[0])
|
||||
|
||||
@patch('subprocess.Popen')
|
||||
def test_send_with_system_instruction_prepended_to_stdin(self, mock_popen):
|
||||
def test_send_with_system_instruction_prepended_to_stdin(self, mock_popen: MagicMock) -> None:
|
||||
"""
|
||||
Test that the send method prepends the system instruction to the prompt
|
||||
sent via stdin, and does NOT add a --system flag to the command.
|
||||
@@ -107,7 +107,7 @@ class TestGeminiCliAdapterParity(unittest.TestCase):
|
||||
self.assertNotIn("--system", command)
|
||||
|
||||
@patch('subprocess.Popen')
|
||||
def test_send_with_model_parameter(self, mock_popen):
|
||||
def test_send_with_model_parameter(self, mock_popen: MagicMock) -> None:
|
||||
"""
|
||||
Test that the send method correctly adds the -m <model> flag when a model is specified.
|
||||
"""
|
||||
@@ -128,7 +128,7 @@ class TestGeminiCliAdapterParity(unittest.TestCase):
|
||||
process_mock.communicate.assert_called_once_with(input=message_content)
|
||||
|
||||
@patch('subprocess.Popen')
|
||||
def test_send_kills_process_on_communicate_exception(self, mock_popen):
|
||||
def test_send_kills_process_on_communicate_exception(self, mock_popen: MagicMock) -> None:
|
||||
"""
|
||||
Test that if subprocess.Popen().communicate() raises an exception,
|
||||
GeminiCliAdapter.send() kills the process and re-raises the exception.
|
||||
|
||||
Reference in New Issue
Block a user