Skip to content

Commit a3caf80

Browse files
committed
update error message
1 parent 4ac8b38 commit a3caf80

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/errors/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ impl ErrorType {
577577
Self::DecimalWholeDigits {..} => "Decimal input should have no more than {whole_digits} digit{expected_plural} before the decimal point",
578578
Self::ComplexType {..} => "Input should be a valid python complex object, a number, or a valid complex string following the rules at https://docs.python.org/3/library/functions.html#complex",
579579
Self::ComplexStrParsing {..} => "Input should be a valid complex string following the rules at https://docs.python.org/3/library/functions.html#complex",
580-
Self::Never { .. } => "Unexpected input for a field that should never be filled"
580+
Self::Never { .. } => "No input is allowed for `typing.Never`"
581581
}
582582
}
583583

tests/test_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def f(input_value, info):
410410
'Input should be a valid complex string following the rules at https://docs.python.org/3/library/functions.html#complex',
411411
None,
412412
),
413-
('never', 'Unexpected input for a field that should never be filled', None),
413+
('never', 'No input is allowed for `typing.Never`', None),
414414
]
415415

416416

tests/validators/test_never.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def test_python_never():
1010
with pytest.raises(ValidationError) as exc_info:
1111
v.validate_python(1)
1212
assert exc_info.value.errors(include_url=False) == [
13-
{'type': 'never', 'loc': (), 'msg': 'Unexpected input for a field that should never be filled', 'input': 1}
13+
{'type': 'never', 'loc': (), 'msg': 'No input is allowed for `typing.Never`', 'input': 1}
1414
]
1515

1616
assert v.validate_python(PydanticUndefined) is PydanticUndefined
@@ -24,7 +24,7 @@ def test_json_never():
2424
with pytest.raises(ValidationError) as exc_info:
2525
v.validate_json('null')
2626
assert exc_info.value.errors(include_url=False) == [
27-
{'type': 'never', 'loc': (), 'msg': 'Unexpected input for a field that should never be filled', 'input': None}
27+
{'type': 'never', 'loc': (), 'msg': 'No input is allowed for `typing.Never`', 'input': None}
2828
]
2929

3030
class MyModel:

0 commit comments

Comments
 (0)