mirror of https://github.com/tiangolo/fastapi.git
no cover pydantic lower than 2.6
This commit is contained in:
parent
c543be18f0
commit
b53a31040e
|
|
@ -571,9 +571,6 @@ def get_flat_models_from_fields(
|
|||
return known_models
|
||||
|
||||
|
||||
def get_long_model_name(model: TypeModelOrEnum) -> str:
|
||||
return f"{model.__module__}__{model.__qualname__}".replace(".", "__")
|
||||
|
||||
|
||||
if shared.PYDANTIC_VERSION_MINOR_TUPLE >= (2, 6):
|
||||
# Omit by default for scalar mapping and scalar sequence mapping annotations
|
||||
|
|
@ -601,7 +598,7 @@ if shared.PYDANTIC_VERSION_MINOR_TUPLE >= (2, 6):
|
|||
)
|
||||
return new_field_info, {}
|
||||
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
|
||||
def ignore_invalid(v: Any, handler: Callable[[Any], Any]) -> Any:
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -289,6 +289,19 @@ def test_sequence_mapping_query():
|
|||
assert response.json() == {"queries": {"foo": [1, 2]}}
|
||||
|
||||
|
||||
def test_mixed_sequence_mapping_query():
|
||||
response = client.get("/query/mixed-type-params?query=2&foo=1&bar=3&foo=2&foo=baz")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"queries": {
|
||||
"mapping_query_int": {"bar": 3},
|
||||
"mapping_query_str": {"bar": "3", "foo": "baz"},
|
||||
"query": 2,
|
||||
"sequence_mapping_queries": {"bar": [3], "foo": [1, 2]},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def test_mapping_with_non_mapping_query():
|
||||
response = client.get("/query/mixed-params/?foo=1&foo=2&bar=3&query=fizz")
|
||||
assert response.status_code == 200
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ def test_foo_needy_very(client: TestClient):
|
|||
|
||||
@needs_py310
|
||||
def test_just_string_not_scalar_mapping(client: TestClient):
|
||||
response = client.get("/query/mixed-type-params?&query=2&foo=1&bar=3&foo=2&foo=baz")
|
||||
response = client.get("/query/mixed-type-params?query=2&foo=1&bar=3&foo=2&foo=baz")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"query": 2,
|
||||
|
|
|
|||
Loading…
Reference in New Issue