fix: Fix pre-commit issues and update tests

- Fix import sorting and unused imports
- Update type annotations to use built-in types (list, dict) instead of typing.List/Dict
- Fix trailing whitespace and end-of-file issues
- Fix Chinese fullwidth comma to regular comma
- Update test_main_cli.py to test_document_rag.py
- Add backward compatibility test for main_cli_example.py
- Pass all pre-commit hooks (ruff, ruff-format, etc.)
This commit is contained in:
Andy Lee
2025-07-29 10:19:05 -07:00
parent 4e3bcda5fa
commit 3cde4fc7b3
10 changed files with 52 additions and 56 deletions

View File

@@ -53,7 +53,7 @@ def test_document_rag_simulated(test_data_dir):
# Verify output
output = result.stdout + result.stderr
assert "Leann index built at" in output or "Using existing index" in output
assert "Index saved to" in output or "Using existing index" in output
assert "This is a simulated answer" in output
@@ -117,4 +117,16 @@ def test_document_rag_error_handling(test_data_dir):
# Should fail with invalid LLM type
assert result.returncode != 0
assert "Unknown LLM type" in result.stderr or "invalid_llm_type" in result.stderr
assert "invalid choice" in result.stderr or "invalid_llm_type" in result.stderr
def test_main_cli_backward_compatibility():
"""Test that main_cli_example.py shows migration message."""
cmd = [sys.executable, "examples/main_cli_example.py", "--help"]
result = subprocess.run(cmd, capture_output=True, text=True, timeout=60)
# Should exit with error code and show migration message
assert result.returncode != 0
assert "This script has been replaced" in result.stdout
assert "document_rag.py" in result.stdout