Files
Ryan H. TranandGitHub 01bc89c34f Port linter and integrate linter into the file editor (#10)
* add extra tests from openhands

* refactor shell utils and add skeleton for linter

* setup logger and add python linter

* add default linter

* add diff utils and tests

* add linter into the editor and modify tests

* set linting disabled by default

* modify usage api a bit
2024-11-14 16:17:14 +07:00

76 lines
1.7 KiB
Python

import pytest
@pytest.fixture
def syntax_error_py_file(tmp_path):
file_content = """
def foo():
print("Hello, World!")
print("Wrong indent")
foo(
"""
file_path = tmp_path / 'test_file.py'
file_path.write_text(file_content)
return str(file_path)
@pytest.fixture
def wrongly_indented_py_file(tmp_path):
file_content = """
def foo():
print("Hello, World!")
"""
file_path = tmp_path / 'test_file.py'
file_path.write_text(file_content)
return str(file_path)
@pytest.fixture
def simple_correct_py_file(tmp_path):
file_content = 'print("Hello, World!")\n'
file_path = tmp_path / 'test_file.py'
file_path.write_text(file_content)
return str(file_path)
@pytest.fixture
def simple_correct_py_func_def(tmp_path):
file_content = """def foo():
print("Hello, World!")
foo()
"""
file_path = tmp_path / 'test_file.py'
file_path.write_text(file_content)
return str(file_path)
@pytest.fixture
def simple_correct_ruby_file(tmp_path):
file_content = """def foo
puts "Hello, World!"
end
foo
"""
file_path = tmp_path / 'test_file.rb'
file_path.write_text(file_content)
return str(file_path)
@pytest.fixture
def simple_incorrect_ruby_file(tmp_path):
file_content = """def foo():
print("Hello, World!")
foo()
"""
file_path = tmp_path / 'test_file.rb'
file_path.write_text(file_content)
return str(file_path)
@pytest.fixture
def parenthesis_incorrect_ruby_file(tmp_path):
file_content = """def print_hello_world()\n puts 'Hello World'\n"""
file_path = tmp_path / 'test_file.rb'
file_path.write_text(file_content)
return str(file_path)