fix: logging KeyError with reserved 'filename' key, pytest return-not-none warnings

- api_server.py: rename 'filename' to 'file_name' in upload_file log extra
  dict to avoid collision with Python logging's reserved LogRecord attribute
- test_e2e_ocr.py: replace return statements with assert in test functions
  to fix PytestReturnNotNoneWarning
This commit is contained in:
2026-05-21 22:28:07 +08:00
parent 960312b088
commit aa1d8a6c52
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -85,7 +85,8 @@ def test_ocr_extraction_pipeline():
print(f" 值: {fields[0].get('field_value', 'N/A')}")
print(f" 坐标: {fields[0].get('bbox', 'N/A')}")
return all_ok
# OCR field extraction is informational; verify we got a valid response
assert extraction.get("ocr_available") is not None
def test_validation_service():
@@ -94,7 +95,7 @@ def test_validation_service():
result = validate_jrxml("<jasperReport/>")
print(f" 状态: {'OK' if result else 'FAIL'}")
print(f" 响应: {result}")
return True
assert result is not None
def test_ocr_fallback():