SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
CI: Fixing unittests for flake8 utils
Kilian Lieret8f32710a96ab
diff --git a/tests/tools/test_split_string.py b/tests/tools/test_split_string.pyindex 3fd07899..07f0fd2c 100644--- a/tests/tools/test_split_string.py+++ b/tests/tools/test_split_string.py@@ -46,7 +46,11 @@ def test_flake8_format_no_error_2():def test_flake8_format_no_error_3():assert (format_flake8_output(- "a:12:41: e", previous_errors_string="a:13:41: e", replacement_window=(1, 2), replacement_n_lines=1+ "a:12:41: e",+ previous_errors_string="a:13:41: e",+ replacement_window=(1, 2),+ replacement_n_lines=1,+ show_line_numbers=False,)== "")@@ -55,7 +59,11 @@ def test_flake8_format_no_error_3():def test_flake8_format_error_1():assert (format_flake8_output(- "a:12:41: e", previous_errors_string="a:13:41: e", replacement_window=(12, 13), replacement_n_lines=10+ "a:12:41: e",+ previous_errors_string="a:13:41: e",+ replacement_window=(12, 13),+ replacement_n_lines=10,+ show_line_numbers=False,)== "- e")@@ -70,5 +78,5 @@ def test_flake8_format_error_1_linenumbers():replacement_n_lines=10,show_line_numbers=True,)- == "- 12:41 e"+ == "- line 12 col 41: e")diff --git a/tools/defaults/lib/flake8_utils.py b/tools/defaults/lib/flake8_utils.pyindex 1ad05507..917c9f17 100644--- a/tools/defaults/lib/flake8_utils.py+++ b/tools/defaults/lib/flake8_utils.py@@ -8,6 +8,17 @@ import subprocessfrom pathlib import Pathfrom typing import List, Optional, Tuple+try:+ from sweagent import TOOLS_DIR+except ImportError:+ pass+else:+ import sys++ default_lib = TOOLS_DIR / "defaults" / "lib"+ assert default_lib.is_dir()+ sys.path.append(str(default_lib))+from default_utils import registry