From 8721352a035e52e5ac6f838a203f7a2df379e7f0 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Thu, 6 Nov 2025 10:50:05 -0800 Subject: [PATCH] Remove unused import --- fastapi/exceptions.py | 1 - tests/test_validation_error_context.py | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) 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()