mirror of https://github.com/tiangolo/fastapi.git
Format proposed code
This commit is contained in:
parent
e8c83f100e
commit
ec624a27be
|
|
@ -34,6 +34,7 @@ from pydantic.error_wrappers import ErrorWrapper
|
|||
from pydantic.errors import MissingError
|
||||
from pydantic.fields import (
|
||||
SHAPE_LIST,
|
||||
SHAPE_MAPPING,
|
||||
SHAPE_SEQUENCE,
|
||||
SHAPE_SET,
|
||||
SHAPE_SINGLETON,
|
||||
|
|
@ -41,7 +42,7 @@ from pydantic.fields import (
|
|||
SHAPE_TUPLE_ELLIPSIS,
|
||||
FieldInfo,
|
||||
ModelField,
|
||||
Required, SHAPE_MAPPING,
|
||||
Required,
|
||||
)
|
||||
from pydantic.schema import get_annotation_from_field_info
|
||||
from pydantic.typing import ForwardRef, evaluate_forwardref
|
||||
|
|
@ -69,13 +70,9 @@ sequence_shape_to_type = {
|
|||
SHAPE_TUPLE_ELLIPSIS: list,
|
||||
}
|
||||
|
||||
mapping_shapes = {
|
||||
SHAPE_MAPPING
|
||||
}
|
||||
mapping_types = (dict)
|
||||
mapping_shapes_to_type = {
|
||||
SHAPE_MAPPING: dict
|
||||
}
|
||||
mapping_shapes = {SHAPE_MAPPING}
|
||||
mapping_types = dict
|
||||
mapping_shapes_to_type = {SHAPE_MAPPING: dict}
|
||||
|
||||
multipart_not_installed_error = (
|
||||
'Form data requires "python-multipart" to be installed. \n'
|
||||
|
|
@ -343,10 +340,10 @@ def get_dependant(
|
|||
add_param_to_fields(field=param_field, dependant=dependant)
|
||||
elif is_scalar_field(field=param_field):
|
||||
add_param_to_fields(field=param_field, dependant=dependant)
|
||||
elif isinstance(
|
||||
param.default, (params.Query, params.Header)
|
||||
) and (is_scalar_sequence_field(param_field)
|
||||
or is_scalar_mapping_field(param_field)):
|
||||
elif isinstance(param.default, (params.Query, params.Header)) and (
|
||||
is_scalar_sequence_field(param_field)
|
||||
or is_scalar_mapping_field(param_field)
|
||||
):
|
||||
add_param_to_fields(field=param_field, dependant=dependant)
|
||||
else:
|
||||
field_info = param_field.field_info
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import http
|
||||
from typing import Optional, Dict
|
||||
from typing import Dict, Optional
|
||||
|
||||
from fastapi import FastAPI, Path, Query
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,11 @@ response_not_valid_int = {
|
|||
("/query/param-required/int", 422, response_missing),
|
||||
("/query/param-required/int?query=50", 200, "foo bar 50"),
|
||||
("/query/param-required/int?query=foo", 422, response_not_valid_int),
|
||||
("/query/params?first-query=1&second-query=2", 200, "foo bar {'first-query': 1, "
|
||||
"'second-query': 2}")
|
||||
(
|
||||
"/query/params?first-query=1&second-query=2",
|
||||
200,
|
||||
"foo bar {'first-query': 1, " "'second-query': 2}",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_get_path(path, expected_status, expected_response):
|
||||
|
|
|
|||
Loading…
Reference in New Issue