From 41fe95fcb1f0a44e019ebd9e96256fce9597838c Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Wed, 28 May 2025 11:47:21 +1000 Subject: [PATCH] Refine test_tools_parsing --- tests/test_tools_parsing.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/test_tools_parsing.py b/tests/test_tools_parsing.py index 8b06f32..5840f12 100644 --- a/tests/test_tools_parsing.py +++ b/tests/test_tools_parsing.py @@ -1,7 +1,7 @@ import unittest import os import sys -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # Add project root to Python path +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from sources.tools.tools import Tools @@ -13,7 +13,6 @@ class TestToolsParsing(unittest.TestCase): def setUp(self): """Set up test fixtures before each test method.""" - # Create a concrete implementation of the abstract Tools class for testing class TestTool(Tools): def execute(self, blocks, safety=False): return "test execution" @@ -79,8 +78,6 @@ print("Hello with save path") self.assertIsNotNone(blocks) self.assertEqual(len(blocks), 1) - # The save path logic only works when the first line (after newline) contains a colon - # In this case, the first line is empty, so save_path parsing doesn't trigger self.assertEqual(blocks[0], '\nsave_path: test_file.py\nimport os\nprint("Hello with save path")\n') self.assertIsNone(save_path) @@ -132,7 +129,6 @@ x = 42""" blocks, save_path = self.tool.load_exec_block(llm_text) - # Function returns empty list and None for incomplete blocks self.assertEqual(blocks, []) self.assertIsNone(save_path) @@ -206,7 +202,6 @@ print("test") def test_found_executable_blocks_flag(self): """Test that the executable blocks found flag is set correctly.""" - # Initially should be False self.assertFalse(self.tool.found_executable_blocks()) llm_text = """```python @@ -215,10 +210,8 @@ print("test") blocks, save_path = self.tool.load_exec_block(llm_text) - # After finding blocks, should be True self.assertTrue(self.tool.found_executable_blocks()) - # After calling found_executable_blocks(), should reset to False self.assertFalse(self.tool.found_executable_blocks()) def test_get_parameter_value(self):