feat: bump packages, fix tests; fix: pydantic .dict() to .model_dump(); bump: 2.0.4
This commit is contained in:
parent
937c09e2b7
commit
a45101637c
@ -56,7 +56,7 @@ class MatchInfoGetter(AbstractInjector):
|
|||||||
self.model = type("PathModel", (BaseModel,), attrs)
|
self.model = type("PathModel", (BaseModel,), attrs)
|
||||||
|
|
||||||
def inject(self, request: BaseRequest, args_view: list, kwargs_view: dict):
|
def inject(self, request: BaseRequest, args_view: list, kwargs_view: dict):
|
||||||
args_view.extend(self.model(**request.match_info).dict().values())
|
args_view.extend(self.model(**request.match_info).model_dump().values())
|
||||||
|
|
||||||
|
|
||||||
class BodyGetter(AbstractInjector):
|
class BodyGetter(AbstractInjector):
|
||||||
@ -120,7 +120,7 @@ class QueryGetter(AbstractInjector):
|
|||||||
|
|
||||||
def inject(self, request: BaseRequest, args_view: list, kwargs_view: dict):
|
def inject(self, request: BaseRequest, args_view: list, kwargs_view: dict):
|
||||||
data = self._query_to_dict(request.query)
|
data = self._query_to_dict(request.query)
|
||||||
cleaned = self.model(**data).dict()
|
cleaned = self.model(**data).model_dump()
|
||||||
for group_name, (group_cls, group_attrs) in self._groups.items():
|
for group_name, (group_cls, group_attrs) in self._groups.items():
|
||||||
group = group_cls()
|
group = group_cls()
|
||||||
for attr_name in group_attrs:
|
for attr_name in group_attrs:
|
||||||
@ -166,7 +166,7 @@ class HeadersGetter(AbstractInjector):
|
|||||||
|
|
||||||
def inject(self, request: BaseRequest, args_view: list, kwargs_view: dict):
|
def inject(self, request: BaseRequest, args_view: list, kwargs_view: dict):
|
||||||
header = {k.lower().replace("-", "_"): v for k, v in request.headers.items()}
|
header = {k.lower().replace("-", "_"): v for k, v in request.headers.items()}
|
||||||
cleaned = self.model(**header).dict()
|
cleaned = self.model(**header).model_dump()
|
||||||
for group_name, (group_cls, group_attrs) in self._groups.items():
|
for group_name, (group_cls, group_attrs) in self._groups.items():
|
||||||
group = group_cls()
|
group = group_cls()
|
||||||
for attr_name in group_attrs:
|
for attr_name in group_attrs:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
aiohttp==3.8.6
|
aiohttp==3.8.6
|
||||||
pydantic==2.4.2
|
pydantic==2.5.1
|
||||||
jinja2==3.1.2
|
jinja2==3.1.2
|
||||||
swagger-4-ui-bundle==0.0.4
|
swagger-4-ui-bundle==0.0.4
|
||||||
pytest==7.4.3
|
pytest==7.4.3
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
aiohttp==3.8.6
|
aiohttp==3.8.6
|
||||||
pydantic==2.4.2
|
pydantic==2.5.1
|
||||||
jinja2==3.1.2
|
jinja2==3.1.2
|
||||||
swagger-4-ui-bundle==0.0.4
|
swagger-4-ui-bundle==0.0.4
|
||||||
pytest==7.4.3
|
pytest==7.4.3
|
||||||
|
@ -31,7 +31,7 @@ packages = find:
|
|||||||
python_requires = >=3.10
|
python_requires = >=3.10
|
||||||
install_requires =
|
install_requires =
|
||||||
aiohttp
|
aiohttp
|
||||||
pydantic>=2.4.2
|
pydantic>=2.5.0
|
||||||
swagger-4-ui-bundle
|
swagger-4-ui-bundle
|
||||||
|
|
||||||
[options.extras_require]
|
[options.extras_require]
|
||||||
|
@ -54,6 +54,6 @@ async def test_post_an_article_with_wrong_type_field_should_return_an_error_mess
|
|||||||
'loc': ['nb_page'],
|
'loc': ['nb_page'],
|
||||||
'msg': 'Input should be a valid integer, unable to parse string as an integer',
|
'msg': 'Input should be a valid integer, unable to parse string as an integer',
|
||||||
'type': 'int_parsing',
|
'type': 'int_parsing',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/int_parsing'
|
'url': 'https://errors.pydantic.dev/2.5/v/int_parsing'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -46,7 +46,7 @@ async def test_post_an_article_without_required_field_should_return_an_error_mes
|
|||||||
'loc_in': 'body',
|
'loc_in': 'body',
|
||||||
'msg': 'Field required',
|
'msg': 'Field required',
|
||||||
'type': 'missing',
|
'type': 'missing',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/missing'
|
'url': 'https://errors.pydantic.dev/2.5/v/missing'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ async def test_post_an_article_with_wrong_type_field_should_return_an_error_mess
|
|||||||
'loc_in': 'body',
|
'loc_in': 'body',
|
||||||
'msg': 'Input should be a valid integer, unable to parse string as an integer',
|
'msg': 'Input should be a valid integer, unable to parse string as an integer',
|
||||||
'type': 'int_parsing',
|
'type': 'int_parsing',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/int_parsing'
|
'url': 'https://errors.pydantic.dev/2.5/v/int_parsing'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ async def test_post_an_object_json_to_a_list_model_should_return_an_error(
|
|||||||
'loc_in': 'body',
|
'loc_in': 'body',
|
||||||
'msg': 'Input should be a valid list',
|
'msg': 'Input should be a valid list',
|
||||||
'type': 'list_type',
|
'type': 'list_type',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/list_type'
|
'url': 'https://errors.pydantic.dev/2.5/v/list_type'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ async def test_get_article_without_required_header_should_return_an_error_messag
|
|||||||
'type': 'missing',
|
'type': 'missing',
|
||||||
'loc': ['signature_expired'],
|
'loc': ['signature_expired'],
|
||||||
'msg': 'Field required',
|
'msg': 'Field required',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/missing',
|
'url': 'https://errors.pydantic.dev/2.5/v/missing',
|
||||||
'loc_in': 'headers'
|
'loc_in': 'headers'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -104,7 +104,7 @@ async def test_get_article_with_wrong_header_type_should_return_an_error_message
|
|||||||
'msg': 'Input should be a valid datetime, input is too short',
|
'msg': 'Input should be a valid datetime, input is too short',
|
||||||
'input': 'foo',
|
'input': 'foo',
|
||||||
'ctx': {'error': 'input is too short'},
|
'ctx': {'error': 'input is too short'},
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/datetime_parsing',
|
'url': 'https://errors.pydantic.dev/2.5/v/datetime_parsing',
|
||||||
'loc_in': 'headers'
|
'loc_in': 'headers'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -41,6 +41,6 @@ async def test_get_article_with_wrong_path_parameters_should_return_error(
|
|||||||
'loc_in': 'path',
|
'loc_in': 'path',
|
||||||
'msg': 'Input should be a valid integer, unable to parse string as an integer',
|
'msg': 'Input should be a valid integer, unable to parse string as an integer',
|
||||||
'type': 'int_parsing',
|
'type': 'int_parsing',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/int_parsing'
|
'url': 'https://errors.pydantic.dev/2.5/v/int_parsing'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -87,7 +87,7 @@ async def test_get_article_without_required_qs_should_return_an_error_message(
|
|||||||
'loc_in': 'query string',
|
'loc_in': 'query string',
|
||||||
'msg': 'Field required',
|
'msg': 'Field required',
|
||||||
'type': 'missing',
|
'type': 'missing',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/missing'
|
'url': 'https://errors.pydantic.dev/2.5/v/missing'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ async def test_get_article_with_wrong_qs_type_should_return_an_error_message(
|
|||||||
'loc_in': 'query string',
|
'loc_in': 'query string',
|
||||||
'msg': 'Input should be a valid boolean, unable to interpret input',
|
'msg': 'Input should be a valid boolean, unable to interpret input',
|
||||||
'type': 'bool_parsing',
|
'type': 'bool_parsing',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/bool_parsing'
|
'url': 'https://errors.pydantic.dev/2.5/v/bool_parsing'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ async def test_get_article_with_multiple_value_for_qs_age_must_failed(
|
|||||||
'loc_in': 'query string',
|
'loc_in': 'query string',
|
||||||
'msg': 'Input should be a valid integer',
|
'msg': 'Input should be a valid integer',
|
||||||
'type': 'int_type',
|
'type': 'int_type',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/int_type'
|
'url': 'https://errors.pydantic.dev/2.5/v/int_type'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
assert resp.status == 400
|
assert resp.status == 400
|
||||||
@ -227,7 +227,7 @@ async def test_get_article_without_required_field_page(aiohttp_client, event_loo
|
|||||||
'loc_in': 'query string',
|
'loc_in': 'query string',
|
||||||
'msg': 'Field required',
|
'msg': 'Field required',
|
||||||
'type': 'missing',
|
'type': 'missing',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/missing'
|
'url': 'https://errors.pydantic.dev/2.5/v/missing'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
assert resp.status == 400
|
assert resp.status == 400
|
||||||
@ -291,7 +291,7 @@ async def test_get_article_with_page_and_wrong_page_size(aiohttp_client, event_l
|
|||||||
'msg': 'Input should be a valid integer, unable to parse string as an '
|
'msg': 'Input should be a valid integer, unable to parse string as an '
|
||||||
'integer',
|
'integer',
|
||||||
'type': 'int_parsing',
|
'type': 'int_parsing',
|
||||||
'url': 'https://errors.pydantic.dev/2.4/v/int_parsing'
|
'url': 'https://errors.pydantic.dev/2.5/v/int_parsing'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
assert resp.status == 400
|
assert resp.status == 400
|
||||||
|
Loading…
x
Reference in New Issue
Block a user