From ba07704c62ae60892181a5e61530c478ea8641f1 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Thu, 25 Sep 2025 23:57:08 +0100 Subject: [PATCH] Fix tests --- .../test_base/test_flow_parameter_specs.py | 30 +++++++++++-------- .../test_base/test_llm_service_parameters.py | 12 ++++---- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/tests/unit/test_base/test_flow_parameter_specs.py b/tests/unit/test_base/test_flow_parameter_specs.py index 7b28a60d..4419abe9 100644 --- a/tests/unit/test_base/test_flow_parameter_specs.py +++ b/tests/unit/test_base/test_flow_parameter_specs.py @@ -18,8 +18,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase): def test_parameter_spec_registration(self, mock_async_init): """Test that parameter specs can be registered with flow processors""" # Arrange - def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + def mock_init(*args, **kwargs): + # args[0] is 'self', initialize the required attribute + args[0].config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -52,8 +53,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase): def test_mixed_specification_types(self, mock_async_init): """Test registration of mixed specification types (parameters, consumers, producers)""" # Arrange - def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + def mock_init(*args, **kwargs): + # args[0] is 'self', initialize the required attribute + args[0].config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -89,8 +91,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase): def test_parameter_spec_metadata(self, mock_async_init): """Test parameter specification metadata handling""" # Arrange - def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + def mock_init(*args, **kwargs): + # args[0] is 'self', initialize the required attribute + args[0].config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -124,8 +127,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase): def test_duplicate_parameter_spec_handling(self, mock_async_init): """Test handling of duplicate parameter spec registration""" # Arrange - def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + def mock_init(*args, **kwargs): + # args[0] is 'self', initialize the required attribute + args[0].config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -155,8 +159,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase): async def test_parameter_specs_available_to_flows(self, mock_async_init, mock_flow_class): """Test that parameter specs are available when flows are created""" # Arrange - def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + def mock_init(*args, **kwargs): + # args[0] is 'self', initialize the required attribute + args[0].config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -197,8 +202,9 @@ class TestParameterSpecValidation(IsolatedAsyncioTestCase): def test_parameter_spec_name_validation(self, mock_async_init): """Test parameter spec name validation""" # Arrange - def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + def mock_init(*args, **kwargs): + # args[0] is 'self', initialize the required attribute + args[0].config_handlers = [] mock_async_init.side_effect = mock_init config = { diff --git a/tests/unit/test_base/test_llm_service_parameters.py b/tests/unit/test_base/test_llm_service_parameters.py index 78f079a5..6a088939 100644 --- a/tests/unit/test_base/test_llm_service_parameters.py +++ b/tests/unit/test_base/test_llm_service_parameters.py @@ -19,7 +19,7 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase): """Test that LLM service registers model and temperature parameter specs""" # Arrange def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + self.config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -43,7 +43,7 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase): """Test that model parameter spec has correct properties""" # Arrange def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + self.config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -69,7 +69,7 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase): """Test that temperature parameter spec has correct properties""" # Arrange def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + self.config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -95,7 +95,7 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase): """Test that on_request method extracts model and temperature from flow""" # Arrange def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + self.config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -156,7 +156,7 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase): """Test that on_request handles missing parameters gracefully""" # Arrange def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + self.config_handlers = [] mock_async_init.side_effect = mock_init config = { @@ -209,7 +209,7 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase): """Test that parameter extraction doesn't break existing error handling""" # Arrange def mock_init(self, **kwargs): - self.config_handlers = [] # Initialize required attribute + self.config_handlers = [] mock_async_init.side_effect = mock_init config = {