Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ features = ["pyo3/extension-module"]
[tool.ruff]
line-length = 120
extend-select = ['Q', 'RUF100', 'C90', 'I']
extend-ignore = ['E501']
flake8-quotes = {inline-quotes = 'single', multiline-quotes = 'double'}
mccabe = { max-complexity = 13 }
isort = { known-first-party = ['pydantic_core', 'tests'] }
Expand Down
2 changes: 1 addition & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_unicode_error_input_repr() -> None:
validator = SchemaValidator(schema)

danger_str = 'ÿ' * 1000
expected = "1 validation error for int\n Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='ÿÿÿÿÿÿÿÿÿÿÿÿ...ÿÿÿÿÿÿÿÿÿÿÿ', input_type=str]" # noqa: E501
expected = "1 validation error for int\n Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='ÿÿÿÿÿÿÿÿÿÿÿÿ...ÿÿÿÿÿÿÿÿÿÿÿ', input_type=str]"
with pytest.raises(ValidationError) as exc_info:
validator.validate_python(danger_str)
actual = repr(exc_info.value).split('For further information visit ')[0].strip()
Expand Down
4 changes: 2 additions & 2 deletions tests/validators/test_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ def test_float_repr():
v = SchemaValidator({'type': 'float'})
assert (
plain_repr(v)
== 'SchemaValidator(title="float",validator=Float(FloatValidator{strict:false,allow_inf_nan:true}),definitions=[])' # noqa: E501
== 'SchemaValidator(title="float",validator=Float(FloatValidator{strict:false,allow_inf_nan:true}),definitions=[])'
)
v = SchemaValidator({'type': 'float', 'strict': True})
assert (
plain_repr(v)
== 'SchemaValidator(title="float",validator=Float(FloatValidator{strict:true,allow_inf_nan:true}),definitions=[])' # noqa: E501
== 'SchemaValidator(title="float",validator=Float(FloatValidator{strict:true,allow_inf_nan:true}),definitions=[])'
)
v = SchemaValidator({'type': 'float', 'multiple_of': 7})
assert plain_repr(v).startswith('SchemaValidator(title="constrained-float",validator=ConstrainedFloat(')
Expand Down
4 changes: 2 additions & 2 deletions tests/validators/test_timedelta.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_timedelta_strict_json(input_value, expected):
{'le': timedelta(seconds=-86400.123)},
'-PT86400.122S',
Err(
'Input should be less than or equal to datetime.timedelta(days=-2, seconds=86399, microseconds=877000) [type=less_than_equal' # noqa: E501
'Input should be less than or equal to datetime.timedelta(days=-2, seconds=86399, microseconds=877000) [type=less_than_equal'
),
),
({'gt': timedelta(seconds=-86400.123)}, timedelta(seconds=-86400.122), timedelta(seconds=-86400.122)),
Expand All @@ -158,7 +158,7 @@ def test_timedelta_strict_json(input_value, expected):
{'gt': timedelta(seconds=-86400.123)},
'-PT86400.124S',
Err(
'Input should be greater than datetime.timedelta(days=-2, seconds=86399, microseconds=877000) [type=greater_than' # noqa: E501
'Input should be greater than datetime.timedelta(days=-2, seconds=86399, microseconds=877000) [type=greater_than'
),
),
],
Expand Down