Skip to content

Commit

Permalink
More python3.8+ compatiblity test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssefares committed Aug 21, 2024
1 parent 29ddee7 commit a7ab834
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_custom_errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any
from typing import Any, List
from unittest import TestCase
from unittest.mock import ANY

Expand Down Expand Up @@ -42,11 +42,11 @@ class CustomLocOverridesError(ValidationError):
@override
def errors(
self, *, include_url: bool = True, include_context: bool = True, include_input: bool = True
) -> list[ErrorDetails]:
) -> List[ErrorDetails]:
errors = super().errors(
include_url=include_url, include_context=include_context, include_input=include_input
)
return [error | {'loc': error['loc'][1:]} for error in errors]
return [{**error, 'loc': error['loc'][1:]} for error in errors]

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

with pytest.raises(CustomErrorWithCustomTemplate) as exception_info:
Expand Down

0 comments on commit a7ab834

Please sign in to comment.