Browse Source

🎨 Auto format

pull/14414/head
pre-commit-ci-lite[bot] 8 months ago
committed by GitHub
parent
commit
6eaeb27be0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 36
      tests/test_validation_error_str.py

36
tests/test_validation_error_str.py

@ -9,7 +9,13 @@ from fastapi.exceptions import (
def test_request_validation_error_str_single_error(): def test_request_validation_error_str_single_error():
"""Test string representation of RequestValidationError with single error.""" """Test string representation of RequestValidationError with single error."""
errors = [{"type": "int_parsing", "loc": ["query", "id"], "msg": "Input should be a valid integer"}] errors = [
{
"type": "int_parsing",
"loc": ["query", "id"],
"msg": "Input should be a valid integer",
}
]
exc = RequestValidationError(errors) exc = RequestValidationError(errors)
result = str(exc) result = str(exc)
@ -20,7 +26,11 @@ def test_request_validation_error_str_single_error():
def test_request_validation_error_str_multiple_errors(): def test_request_validation_error_str_multiple_errors():
"""Test string representation of RequestValidationError with multiple errors.""" """Test string representation of RequestValidationError with multiple errors."""
errors = [ errors = [
{"type": "int_parsing", "loc": ["query", "id"], "msg": "Input should be a valid integer"}, {
"type": "int_parsing",
"loc": ["query", "id"],
"msg": "Input should be a valid integer",
},
{"type": "missing", "loc": ["query", "name"], "msg": "Field required"}, {"type": "missing", "loc": ["query", "name"], "msg": "Field required"},
] ]
exc = RequestValidationError(errors) exc = RequestValidationError(errors)
@ -33,7 +43,13 @@ def test_request_validation_error_str_multiple_errors():
def test_websocket_request_validation_error_str_single_error(): def test_websocket_request_validation_error_str_single_error():
"""Test string representation of WebSocketRequestValidationError with single error.""" """Test string representation of WebSocketRequestValidationError with single error."""
errors = [{"type": "int_parsing", "loc": ["query", "id"], "msg": "Input should be a valid integer"}] errors = [
{
"type": "int_parsing",
"loc": ["query", "id"],
"msg": "Input should be a valid integer",
}
]
exc = WebSocketRequestValidationError(errors) exc = WebSocketRequestValidationError(errors)
result = str(exc) result = str(exc)
@ -44,7 +60,11 @@ def test_websocket_request_validation_error_str_single_error():
def test_websocket_request_validation_error_str_multiple_errors(): def test_websocket_request_validation_error_str_multiple_errors():
"""Test string representation of WebSocketRequestValidationError with multiple errors.""" """Test string representation of WebSocketRequestValidationError with multiple errors."""
errors = [ errors = [
{"type": "int_parsing", "loc": ["query", "id"], "msg": "Input should be a valid integer"}, {
"type": "int_parsing",
"loc": ["query", "id"],
"msg": "Input should be a valid integer",
},
{"type": "missing", "loc": ["query", "name"], "msg": "Field required"}, {"type": "missing", "loc": ["query", "name"], "msg": "Field required"},
] ]
exc = WebSocketRequestValidationError(errors) exc = WebSocketRequestValidationError(errors)
@ -57,7 +77,13 @@ def test_websocket_request_validation_error_str_multiple_errors():
def test_response_validation_error_str_consistency(): def test_response_validation_error_str_consistency():
"""Test that ResponseValidationError has similar __str__ behavior.""" """Test that ResponseValidationError has similar __str__ behavior."""
errors = [{"type": "int_parsing", "loc": ["response", "id"], "msg": "Input should be a valid integer"}] errors = [
{
"type": "int_parsing",
"loc": ["response", "id"],
"msg": "Input should be a valid integer",
}
]
exc = ResponseValidationError(errors) exc = ResponseValidationError(errors)
result = str(exc) result = str(exc)

Loading…
Cancel
Save