From 03992e1757e68527a717832e9e47b91098ac1ba1 Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Wed, 22 May 2024 13:18:49 -0400 Subject: [PATCH] Delete obsolete tests --- test/test_coverup_openai_10.py | 35 ---------------------------------- test/test_coverup_openai_14.py | 26 ------------------------- test/test_coverup_openai_3.py | 16 ---------------- test/test_coverup_openai_5.py | 16 ---------------- test/test_coverup_openai_7.py | 26 ------------------------- test/test_coverup_openai_8.py | 30 ----------------------------- 6 files changed, 149 deletions(-) delete mode 100644 test/test_coverup_openai_10.py delete mode 100644 test/test_coverup_openai_14.py delete mode 100644 test/test_coverup_openai_3.py delete mode 100644 test/test_coverup_openai_5.py delete mode 100644 test/test_coverup_openai_7.py delete mode 100644 test/test_coverup_openai_8.py diff --git a/test/test_coverup_openai_10.py b/test/test_coverup_openai_10.py deleted file mode 100644 index 01b3447..0000000 --- a/test/test_coverup_openai_10.py +++ /dev/null @@ -1,35 +0,0 @@ -# file src/cwhy/conversation/diff_functions.py:48-79 -# lines [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 61, 63, 64, 65, 67, 68, 69, 72] -# branches [] - -import pytest -from cwhy.conversation.diff_functions import DiffFunctions - -class MockArgs: - pass - -def test_apply_modification_schema(): - mock_args = MockArgs() - diff_functions = DiffFunctions(mock_args) - schema = diff_functions.apply_modification_schema() - assert schema['name'] == 'apply_modification' - assert schema['description'] == 'Applies a single modification to the source file with the goal of fixing any existing compilation errors.' - assert 'parameters' in schema - params = schema['parameters'] - assert params['type'] == 'object' - assert 'properties' in params - properties = params['properties'] - assert 'filename' in properties - assert properties['filename']['type'] == 'string' - assert 'start-line-number' in properties - assert properties['start-line-number']['type'] == 'integer' - assert 'number-lines-remove' in properties - assert properties['number-lines-remove']['type'] == 'integer' - assert 'replacement' in properties - assert properties['replacement']['type'] == 'string' - assert 'required' in params - required_fields = params['required'] - assert 'filename' in required_fields - assert 'start-line-number' in required_fields - assert 'number-lines-remove' in required_fields - assert 'replacement' in required_fields diff --git a/test/test_coverup_openai_14.py b/test/test_coverup_openai_14.py deleted file mode 100644 index 2dc7f63..0000000 --- a/test/test_coverup_openai_14.py +++ /dev/null @@ -1,26 +0,0 @@ -# file src/cwhy/conversation/explain_functions.py:15-23 -# lines [15, 16, 17, 18, 19, 20, 21] -# branches [] - -import pytest -from unittest.mock import MagicMock -from cwhy.conversation.explain_functions import ExplainFunctions - -class TestExplainFunctions: - def test_as_tools(self, monkeypatch): - # Create a MagicMock to simulate the schema methods - monkeypatch.setattr(ExplainFunctions, 'get_compile_or_run_command_schema', MagicMock(return_value={'name': 'compile_or_run'})) - monkeypatch.setattr(ExplainFunctions, 'get_code_surrounding_schema', MagicMock(return_value={'name': 'code_surrounding'})) - monkeypatch.setattr(ExplainFunctions, 'list_directory_schema', MagicMock(return_value={'name': 'list_directory'})) - - # Mock the __init__ method to not require arguments - monkeypatch.setattr(ExplainFunctions, '__init__', lambda x, args: None) - - ef = ExplainFunctions(args=None) - tools = ef.as_tools() - - # Verify that the list contains all three schemas - assert len(tools) == 3 - assert tools[0]['function']['name'] == 'compile_or_run' - assert tools[1]['function']['name'] == 'code_surrounding' - assert tools[2]['function']['name'] == 'list_directory' diff --git a/test/test_coverup_openai_3.py b/test/test_coverup_openai_3.py deleted file mode 100644 index 685e1d3..0000000 --- a/test/test_coverup_openai_3.py +++ /dev/null @@ -1,16 +0,0 @@ -# file src/cwhy/conversation/diff_functions.py:121-125 -# lines [121, 122, 123, 124] -# branches [] - -import pytest -from unittest.mock import MagicMock -from cwhy.conversation.diff_functions import DiffFunctions - -def test_try_compiling_schema(): - mock_args = MagicMock() - diff_functions = DiffFunctions(mock_args) - schema = diff_functions.try_compiling_schema() - assert schema == { - "name": "try_compiling", - "description": "Attempts to compile the code again after the user has made changes. Returns the new error message if there is one.", - } diff --git a/test/test_coverup_openai_5.py b/test/test_coverup_openai_5.py deleted file mode 100644 index d49f83c..0000000 --- a/test/test_coverup_openai_5.py +++ /dev/null @@ -1,16 +0,0 @@ -# file src/cwhy/conversation/explain_functions.py:43-47 -# lines [43, 44, 45, 46] -# branches [] - -import pytest -from unittest.mock import MagicMock -from src.cwhy.conversation.explain_functions import ExplainFunctions - -def test_get_compile_or_run_command_schema(): - mock_args = MagicMock() - explain_functions = ExplainFunctions(mock_args) - schema = explain_functions.get_compile_or_run_command_schema() - assert schema == { - "name": "get_compile_or_run_command", - "description": "Returns the command used to compile or run the code. This will include any flags and options used.", - } diff --git a/test/test_coverup_openai_7.py b/test/test_coverup_openai_7.py deleted file mode 100644 index 2deea02..0000000 --- a/test/test_coverup_openai_7.py +++ /dev/null @@ -1,26 +0,0 @@ -# file src/cwhy/conversation/explain_functions.py:80-94 -# lines [80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 92] -# branches [] - -import pytest -from unittest.mock import MagicMock -from src.cwhy.conversation.explain_functions import ExplainFunctions - -def test_list_directory_schema(): - mock_args = MagicMock() - explain_functions = ExplainFunctions(mock_args) - schema = explain_functions.list_directory_schema() - assert schema == { - "name": "list_directory", - "description": "Returns a list of all files and directories in the given directory.", - "parameters": { - "type": "object", - "properties": { - "path": { - "type": "string", - "description": "The path of the directory of interest.", - }, - }, - "required": ["path"], - }, - } diff --git a/test/test_coverup_openai_8.py b/test/test_coverup_openai_8.py deleted file mode 100644 index d8c55f7..0000000 --- a/test/test_coverup_openai_8.py +++ /dev/null @@ -1,30 +0,0 @@ -# file src/cwhy/conversation/explain_functions.py:54-72 -# lines [54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 70] -# branches [] - -import pytest -from unittest.mock import MagicMock -from src.cwhy.conversation.explain_functions import ExplainFunctions - -def test_get_code_surrounding_schema(): - mock_args = MagicMock() - explain_functions = ExplainFunctions(mock_args) - schema = explain_functions.get_code_surrounding_schema() - assert schema == { - "name": "get_code_surrounding", - "description": "Returns the code in the given file surrounding and including the provided line number.", - "parameters": { - "type": "object", - "properties": { - "filename": { - "type": "string", - "description": "The filename to read from.", - }, - "lineno": { - "type": "integer", - "description": "The line number to focus on. Some context before and after that line will be provided.", - }, - }, - "required": ["filename", "lineno"], - }, - }