Skip to content

Commit a7ab834

Browse files
committed
More python3.8+ compatiblity test fixes
1 parent 29ddee7 commit a7ab834

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_custom_errors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any
1+
from typing import Any, List
22
from unittest import TestCase
33
from unittest.mock import ANY
44

@@ -42,11 +42,11 @@ class CustomLocOverridesError(ValidationError):
4242
@override
4343
def errors(
4444
self, *, include_url: bool = True, include_context: bool = True, include_input: bool = True
45-
) -> list[ErrorDetails]:
45+
) -> List[ErrorDetails]:
4646
errors = super().errors(
4747
include_url=include_url, include_context=include_context, include_input=include_input
4848
)
49-
return [error | {'loc': error['loc'][1:]} for error in errors]
49+
return [{**error, 'loc': error['loc'][1:]} for error in errors]
5050

5151
with pytest.raises(CustomLocOverridesError) as exception_info:
5252
raise CustomLocOverridesError.from_exception_data(
@@ -136,7 +136,7 @@ def __new__(
136136
message_template = (
137137
"'{my_custom_value}' setting requires a specific my custom field value, got '{wrong_value}'"
138138
)
139-
context = context | {'my_custom_value': my_custom_setting}
139+
context = {**context, 'my_custom_value': my_custom_setting}
140140
return super().__new__(cls, error_type, message_template, context)
141141

142142
with pytest.raises(CustomErrorWithCustomTemplate) as exception_info:

0 commit comments

Comments
 (0)