| 1 |
from typing import Any |
| 2 |
|
| 3 |
from fastapi.params import Body, Cookie, Header, Param, Path, Query |
| 4 |
|
| 5 |
test_data: list[Any] = ["teststr", None, ..., 1, []] |
| 6 |
|
| 7 |
|
| 8 |
def get_user(): |
| 9 |
return {} # pragma: no cover |
| 10 |
|
| 11 |
|
| 12 |
def test_param_repr_str(): |
| 13 |
assert repr(Param("teststr")) == "Param(teststr)" |
| 14 |
|
| 15 |
|
| 16 |
def test_param_repr_none(): |
| 17 |
assert repr(Param(None)) == "Param(None)" |
| 18 |
|
| 19 |
|
| 20 |
def test_param_repr_ellipsis(): |
| 21 |
assert repr(Param(...)) == "Param(PydanticUndefined)" |
| 22 |
|
| 23 |
|
| 24 |
def test_param_repr_number(): |
| 25 |
assert repr(Param(1)) == "Param(1)" |
| 26 |
|
| 27 |
|
| 28 |
def test_param_repr_list(): |
| 29 |
assert repr(Param([])) == "Param([])" |
| 30 |
|
| 31 |
|
| 32 |
def test_path_repr(): |
| 33 |
assert repr(Path()) == "Path(PydanticUndefined)" |
| 34 |
assert repr(Path(...)) == "Path(PydanticUndefined)" |
| 35 |
|
| 36 |
|
| 37 |
def test_query_repr_str(): |
| 38 |
assert repr(Query("teststr")) == "Query(teststr)" |
| 39 |
|
| 40 |
|
| 41 |
def test_query_repr_none(): |
| 42 |
assert repr(Query(None)) == "Query(None)" |
| 43 |
|
| 44 |
|
| 45 |
def test_query_repr_ellipsis(): |
| 46 |
assert repr(Query(...)) == "Query(PydanticUndefined)" |
| 47 |
|
| 48 |
|
| 49 |
def test_query_repr_number(): |
| 50 |
assert repr(Query(1)) == "Query(1)" |
| 51 |
|
| 52 |
|
| 53 |
def test_query_repr_list(): |
| 54 |
assert repr(Query([])) == "Query([])" |
| 55 |
|
| 56 |
|
| 57 |
def test_header_repr_str(): |
| 58 |
assert repr(Header("teststr")) == "Header(teststr)" |
| 59 |
|
| 60 |
|
| 61 |
def test_header_repr_none(): |
| 62 |
assert repr(Header(None)) == "Header(None)" |
| 63 |
|
| 64 |
|
| 65 |
def test_header_repr_ellipsis(): |
| 66 |
assert repr(Header(...)) == "Header(PydanticUndefined)" |
| 67 |
|
| 68 |
|
| 69 |
def test_header_repr_number(): |
| 70 |
assert repr(Header(1)) == "Header(1)" |
| 71 |
|
| 72 |
|
| 73 |
def test_header_repr_list(): |
| 74 |
assert repr(Header([])) == "Header([])" |
| 75 |
|
| 76 |
|
| 77 |
def test_cookie_repr_str(): |
| 78 |
assert repr(Cookie("teststr")) == "Cookie(teststr)" |
| 79 |
|
| 80 |
|
| 81 |
def test_cookie_repr_none(): |
| 82 |
assert repr(Cookie(None)) == "Cookie(None)" |
| 83 |
|
| 84 |
|
| 85 |
def test_cookie_repr_ellipsis(): |
| 86 |
assert repr(Cookie(...)) == "Cookie(PydanticUndefined)" |
| 87 |
|
| 88 |
|
| 89 |
def test_cookie_repr_number(): |
| 90 |
assert repr(Cookie(1)) == "Cookie(1)" |
| 91 |
|
| 92 |
|
| 93 |
def test_cookie_repr_list(): |
| 94 |
assert repr(Cookie([])) == "Cookie([])" |
| 95 |
|
| 96 |
|
| 97 |
def test_body_repr_str(): |
| 98 |
assert repr(Body("teststr")) == "Body(teststr)" |
| 99 |
|
| 100 |
|
| 101 |
def test_body_repr_none(): |
| 102 |
assert repr(Body(None)) == "Body(None)" |
| 103 |
|
| 104 |
|
| 105 |
def test_body_repr_ellipsis(): |
| 106 |
assert repr(Body(...)) == "Body(PydanticUndefined)" |
| 107 |
|
| 108 |
|
| 109 |
def test_body_repr_number(): |
| 110 |
assert repr(Body(1)) == "Body(1)" |
| 111 |
|
| 112 |
|
| 113 |
def test_body_repr_list(): |
| 114 |
assert repr(Body([])) == "Body([])" |