# For Pydantic v1
and getattr(field, "shape", 1) == 1
)
- )
+ ), f"Query parameter {param_name!r} must be one of the supported types"
return ParamDetails(type_annotation=type_annotation, depends=depends, field=field)
def test_invalid_sequence():
- with pytest.raises(AssertionError):
+ with pytest.raises(
+ AssertionError,
+ match="Query parameter 'q' must be one of the supported types",
+ ):
app = FastAPI()
class Item(BaseModel):
def test_invalid_tuple():
- with pytest.raises(AssertionError):
+ with pytest.raises(
+ AssertionError,
+ match="Query parameter 'q' must be one of the supported types",
+ ):
app = FastAPI()
class Item(BaseModel):
def test_invalid_dict():
- with pytest.raises(AssertionError):
+ with pytest.raises(
+ AssertionError,
+ match="Query parameter 'q' must be one of the supported types",
+ ):
app = FastAPI()
class Item(BaseModel):
def test_invalid_simple_dict():
- with pytest.raises(AssertionError):
+ with pytest.raises(
+ AssertionError,
+ match="Query parameter 'q' must be one of the supported types",
+ ):
app = FastAPI()
class Item(BaseModel):