Browse Source

Remove unused import

pull/14306/head
Savannah Ostrowski 9 months ago
parent
commit
8721352a03
  1. 1
      fastapi/exceptions.py
  2. 4
      tests/test_validation_error_context.py

1
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}"

4
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()

Loading…
Cancel
Save