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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user