gemma4-dev-agent / tests /test_code_graph_exception.py
EzioDevio's picture
Upload folder using huggingface_hub
1afb40b verified
Raw
History Blame Contribute Delete
562 Bytes
import pytest
from pathlib import Path
from src.tools.code_graph import CodeGraphIndexer
def test_code_graph_unparseable_file(tmp_path):
# Create a broken/unparseable file that causes ast.parse to fail
broken_file = tmp_path / "broken.py"
broken_file.write_text("def invalid_syntax( :", encoding="utf-8")
indexer = CodeGraphIndexer(repo_root=str(tmp_path))
res = indexer.build_index()
# Should catch the exception, skip the file, and complete successfully
assert "indexed_files" in res
assert res["indexed_files"] == 1