From 5039e016e90f279f4c63c2cf81dbe7c04c69ee2b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 01:18:00 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/cores/common/test_component.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/cores/common/test_component.py b/tests/cores/common/test_component.py index 5463d1873..4af06a0e5 100644 --- a/tests/cores/common/test_component.py +++ b/tests/cores/common/test_component.py @@ -6,6 +6,7 @@ from comps import OpeaComponent, OpeaComponentController + class TestOpeaComponent(unittest.TestCase): class MockOpeaComponent(OpeaComponent): def check_health(self) -> bool: @@ -16,27 +17,28 @@ def invoke(self, *args, **kwargs): def test_initialization(self): component = self.MockOpeaComponent("TestComponent", "embedding", "Test description") - + self.assertEqual(component.name, "TestComponent") self.assertEqual(component.type, "embedding") self.assertEqual(component.description, "Test description") self.assertEqual(component.config, {}) - + def test_get_meta(self): component = self.MockOpeaComponent("TestComponent", "embedding", "Test description", {"key": "value"}) meta = component.get_meta() - + self.assertEqual(meta["name"], "TestComponent") self.assertEqual(meta["type"], "embedding") self.assertEqual(meta["description"], "Test description") self.assertEqual(meta["config"], {"key": "value"}) - + def test_update_config(self): component = self.MockOpeaComponent("TestComponent", "embedding", "Test description") component.update_config("key", "new_value") - + self.assertEqual(component.config["key"], "new_value") + class TestOpeaComponentController(unittest.TestCase): def test_register_component(self): controller = OpeaComponentController() @@ -100,9 +102,7 @@ def test_invoke_with_active_component(self): component.invoke.assert_called_with("arg1", key="value") def test_discover_then_invoke(self): - """ - Ensures that `discover_and_activate` and `invoke` work correctly when called sequentially. - """ + """Ensures that `discover_and_activate` and `invoke` work correctly when called sequentially.""" controller = OpeaComponentController() # Mock a healthy component @@ -144,6 +144,5 @@ def test_list_components(self): self.assertIn("Component2", components_list) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() -