diff --git a/fastapi/exceptions.py b/fastapi/exceptions.py index 22c151a7b..17e3202b8 100644 --- a/fastapi/exceptions.py +++ b/fastapi/exceptions.py @@ -171,7 +171,6 @@ class ValidationException(Exception): return self._errors def _format_endpoint_context(self) -> str: - """Format endpoint context in native Python traceback format.""" if not (self.endpoint_file and self.endpoint_line and self.endpoint_function): if self.endpoint_path: return f"\n Endpoint: {self.endpoint_path}" diff --git a/tests/test_validation_error_context.py b/tests/test_validation_error_context.py index 47df6060d..a03286a9e 100644 --- a/tests/test_validation_error_context.py +++ b/tests/test_validation_error_context.py @@ -1,4 +1,3 @@ -import pytest from fastapi import FastAPI, Request, WebSocket from fastapi.exceptions import ( RequestValidationError, @@ -10,8 +9,8 @@ from pydantic import BaseModel class Item(BaseModel): + id: int name: str - id: int # Required field class ExceptionCapture: @@ -23,7 +22,6 @@ class ExceptionCapture: return exc -# App with custom exception handlers that capture exceptions for testing app = FastAPI() captured_exception = ExceptionCapture()