fix: resolve CI/CD issues - remove unused imports and fix type mismatches
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import pytest
|
||||
import tempfile
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -27,7 +26,7 @@ class Greeter:
|
||||
def greet(self, name):
|
||||
if self.prefix and name:
|
||||
return f"{self.prefix} {name}"
|
||||
return "Hello
|
||||
return "Hello"
|
||||
""")
|
||||
|
||||
parser = PythonParser()
|
||||
@@ -187,7 +186,23 @@ def func_b():
|
||||
|
||||
file_nodes = [n for n in nodes if n.node_type.value == "file"]
|
||||
func_nodes = [n for n in nodes if n.node_type.value == "function"]
|
||||
class_nodes = [n for n in nodes if n.node_type.value == "class"]
|
||||
|
||||
assert len(file_nodes) == 3
|
||||
assert len(func_nodes) >= 3
|
||||
|
||||
def test_error_handling_invalid_file(self):
|
||||
parser = PythonParser()
|
||||
result = parser.parse(Path("/nonexistent/file.py"), "")
|
||||
|
||||
assert result.errors is not None
|
||||
|
||||
def test_empty_code_handling(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
test_file = Path(tmpdir) / "empty.py"
|
||||
test_file.write_text("# Just a comment\n")
|
||||
|
||||
parser = PythonParser()
|
||||
content = test_file.read_text()
|
||||
result = parser.parse(test_file, content)
|
||||
|
||||
assert result.language == "python"
|
||||
|
||||
Reference in New Issue
Block a user