Skip to content

Commit b6ea790

Browse files
committed
Manually fix a bunch of tests after merging main and feature/unset into this branch.
1 parent eb1c52e commit b6ea790

File tree

24 files changed

+218
-294
lines changed

24 files changed

+218
-294
lines changed

end_to_end_tests/golden-record-custom/my_test_api_client/api/default/__init__.py

Whitespace-only changes.

end_to_end_tests/golden-record-custom/my_test_api_client/api/tests/defaults_tests_defaults_post.py

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
Client = httpx.Client
66

77
import datetime
8-
from typing import Dict, List, Optional, Union, cast
8+
from typing import Dict, List, Union, cast
99

1010
from dateutil.parser import isoparse
1111

1212
from ...models.an_enum import AnEnum
13+
from ...models.dict_prop import DictProp
1314
from ...models.http_validation_error import HTTPValidationError
15+
from ...types import UNSET, Unset
1416

1517

1618
def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPValidationError]]:
@@ -33,61 +35,65 @@ def _build_response(*, response: httpx.Response) -> httpx.Response[Union[None, H
3335
def httpx_request(
3436
*,
3537
client: Client,
36-
json_body: Dict[Any, Any],
37-
string_prop: Optional[str] = "the default string",
38-
datetime_prop: Optional[datetime.datetime] = isoparse("1010-10-10T00:00:00"),
39-
date_prop: Optional[datetime.date] = isoparse("1010-10-10").date(),
40-
float_prop: Optional[float] = 3.14,
41-
int_prop: Optional[int] = 7,
42-
boolean_prop: Optional[bool] = False,
43-
list_prop: Optional[List[AnEnum]] = None,
44-
union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float",
45-
enum_prop: Optional[AnEnum] = None,
38+
json_body: DictProp,
39+
string_prop: Union[Unset, str] = "the default string",
40+
datetime_prop: Union[Unset, datetime.datetime] = isoparse("1010-10-10T00:00:00"),
41+
date_prop: Union[Unset, datetime.date] = isoparse("1010-10-10").date(),
42+
float_prop: Union[Unset, float] = 3.14,
43+
int_prop: Union[Unset, int] = 7,
44+
boolean_prop: Union[Unset, bool] = UNSET,
45+
list_prop: Union[Unset, List[AnEnum]] = UNSET,
46+
union_prop: Union[Unset, Union[float, str]] = "not a float",
47+
an_enum: AnEnum,
4648
) -> httpx.Response[Union[None, HTTPValidationError]]:
4749

48-
json_datetime_prop = datetime_prop.isoformat() if datetime_prop else None
50+
json_datetime_prop: Union[Unset, str] = UNSET
51+
if not isinstance(datetime_prop, Unset):
52+
json_datetime_prop = datetime_prop.isoformat()
4953

50-
json_date_prop = date_prop.isoformat() if date_prop else None
54+
json_date_prop: Union[Unset, str] = UNSET
55+
if not isinstance(date_prop, Unset):
56+
json_date_prop = date_prop.isoformat()
5157

52-
if list_prop is None:
53-
json_list_prop = None
54-
else:
58+
json_list_prop: Union[Unset, List[Any]] = UNSET
59+
if not isinstance(list_prop, Unset):
5560
json_list_prop = []
56-
for list_prop_item_data in list_prop:
57-
list_prop_item = list_prop_item_data.value
61+
for an_enum_data in list_prop:
62+
an_enum = an_enum_data.value
5863

59-
json_list_prop.append(list_prop_item)
64+
json_list_prop.append(an_enum)
6065

61-
if union_prop is None:
62-
json_union_prop: Optional[Union[Optional[float], Optional[str]]] = None
66+
json_union_prop: Union[Unset, Union[float, str]]
67+
if isinstance(union_prop, Unset):
68+
json_union_prop = UNSET
6369
elif isinstance(union_prop, float):
6470
json_union_prop = union_prop
6571
else:
6672
json_union_prop = union_prop
6773

68-
json_enum_prop = enum_prop.value if enum_prop else None
74+
json_an_enum = an_enum.value
6975

70-
params: Dict[str, Any] = {}
71-
if string_prop is not None:
76+
params: Dict[str, Any] = {
77+
"AnEnum": json_an_enum,
78+
}
79+
if string_prop is not UNSET:
7280
params["string_prop"] = string_prop
73-
if datetime_prop is not None:
81+
if datetime_prop is not UNSET:
7482
params["datetime_prop"] = json_datetime_prop
75-
if date_prop is not None:
83+
if date_prop is not UNSET:
7684
params["date_prop"] = json_date_prop
77-
if float_prop is not None:
85+
if float_prop is not UNSET:
7886
params["float_prop"] = float_prop
79-
if int_prop is not None:
87+
if int_prop is not UNSET:
8088
params["int_prop"] = int_prop
81-
if boolean_prop is not None:
89+
if boolean_prop is not UNSET:
8290
params["boolean_prop"] = boolean_prop
83-
if list_prop is not None:
91+
if list_prop is not UNSET:
8492
params["list_prop"] = json_list_prop
85-
if union_prop is not None:
93+
if union_prop is not UNSET:
8694
params["union_prop"] = json_union_prop
87-
if enum_prop is not None:
88-
params["enum_prop"] = json_enum_prop
8995

90-
json_json_body = json_body
96+
json_json_body = json_body.to_dict()
9197

9298
response = client.request(
9399
"post",

end_to_end_tests/golden-record-custom/my_test_api_client/api/tests/get_user_list.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Client = httpx.Client
66

77
import datetime
8-
from typing import Dict, List, Union, cast
8+
from typing import List, Union, cast
99

1010
from ...models.a_model import AModel
1111
from ...models.an_enum import AnEnum
@@ -37,10 +37,10 @@ def httpx_request(
3737
) -> httpx.Response[Union[List[AModel], HTTPValidationError]]:
3838

3939
json_an_enum_value = []
40-
for an_enum_value_item_data in an_enum_value:
41-
an_enum_value_item = an_enum_value_item_data.value
40+
for an_enum_data in an_enum_value:
41+
an_enum = an_enum_data.value
4242

43-
json_an_enum_value.append(an_enum_value_item)
43+
json_an_enum_value.append(an_enum)
4444

4545
if isinstance(some_date, datetime.date):
4646
json_some_date = some_date.isoformat()

end_to_end_tests/golden-record-custom/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
Client = httpx.Client
66

7-
from typing import Dict, cast
8-
97
from ...models.an_int_enum import AnIntEnum
108
from ...models.http_validation_error import HTTPValidationError
119

@@ -30,13 +28,13 @@ def _build_response(*, response: httpx.Response) -> httpx.Response[Union[None, H
3028
def httpx_request(
3129
*,
3230
client: Client,
33-
int_enum: AnIntEnum,
31+
an_int_enum: AnIntEnum,
3432
) -> httpx.Response[Union[None, HTTPValidationError]]:
3533

36-
json_int_enum = int_enum.value
34+
json_an_int_enum = an_int_enum.value
3735

3836
params: Dict[str, Any] = {
39-
"int_enum": json_int_enum,
37+
"AnIntEnum": json_an_int_enum,
4038
}
4139

4240
response = client.request(

end_to_end_tests/golden-record-custom/my_test_api_client/api/tests/json_body_tests_json_body_post.py renamed to end_to_end_tests/golden-record-custom/my_test_api_client/api/tests/optional_value_tests_optional_query_param.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
Client = httpx.Client
66

7-
from typing import Dict, cast
7+
from typing import List, Union
88

9-
from ...models.a_model import AModel
109
from ...models.http_validation_error import HTTPValidationError
10+
from ...types import UNSET, Unset
1111

1212

1313
def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPValidationError]]:
@@ -30,15 +30,21 @@ def _build_response(*, response: httpx.Response) -> httpx.Response[Union[None, H
3030
def httpx_request(
3131
*,
3232
client: Client,
33-
json_body: AModel,
33+
query_param: Union[Unset, List[str]] = UNSET,
3434
) -> httpx.Response[Union[None, HTTPValidationError]]:
3535

36-
json_json_body = json_body.to_dict()
36+
json_query_param: Union[Unset, List[Any]] = UNSET
37+
if not isinstance(query_param, Unset):
38+
json_query_param = query_param
39+
40+
params: Dict[str, Any] = {}
41+
if query_param is not UNSET:
42+
params["query_param"] = json_query_param
3743

3844
response = client.request(
39-
"post",
40-
"/tests/json_body",
41-
json=json_json_body,
45+
"get",
46+
"/tests/optional_query_param/",
47+
params=params,
4248
)
4349

4450
return _build_response(response=response)

end_to_end_tests/golden-record-custom/my_test_api_client/api/default/ping_ping_get.py renamed to end_to_end_tests/golden-record-custom/my_test_api_client/api/tests/test_inline_objects.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,33 @@
44

55
Client = httpx.Client
66

7+
from ...models.json_body import JsonBody
8+
from ...types import UNSET, Unset
79

8-
def _parse_response(*, response: httpx.Response) -> Optional[bool]:
9-
if response.status_code == 200:
10-
return bool(response.text)
11-
return None
1210

13-
14-
def _build_response(*, response: httpx.Response) -> httpx.Response[bool]:
11+
def _build_response(*, response: httpx.Response) -> httpx.Response[None]:
1512
return httpx.Response(
1613
status_code=response.status_code,
1714
content=response.content,
1815
headers=response.headers,
19-
parsed=_parse_response(response=response),
16+
parsed=None,
2017
)
2118

2219

2320
def httpx_request(
2421
*,
2522
client: Client,
26-
) -> httpx.Response[bool]:
23+
json_body: Optional[JsonBody],
24+
) -> httpx.Response[None]:
25+
26+
json_json_body: Optional[JsonBody] = UNSET
27+
if not isinstance(json_body, Unset):
28+
json_json_body = json_body.to_dict()
2729

2830
response = client.request(
29-
"get",
30-
"/ping",
31+
"post",
32+
"/tests/inline_objects",
33+
json=json_json_body,
3134
)
3235

3336
return _build_response(response=response)

end_to_end_tests/golden-record-custom/my_test_api_client/api/tests/upload_file_tests_upload_post.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
Client = httpx.Client
66

7-
from typing import Optional
7+
from typing import Union
88

99
from ...models.body_upload_file_tests_upload_post import BodyUploadFileTestsUploadPost
1010
from ...models.http_validation_error import HTTPValidationError
11+
from ...types import UNSET, Unset
1112

1213

1314
def _parse_response(*, response: httpx.Response) -> Optional[Union[
@@ -37,12 +38,12 @@ def _build_response(*, response: httpx.Response) -> httpx.Response[Union[
3738
def httpx_request(*,
3839
client: Client,
3940
multipart_data: BodyUploadFileTestsUploadPost,
40-
keep_alive: Optional[bool] = None,
41+
keep_alive: Union[Unset, bool] = UNSET,
4142
) -> httpx.Response[Union[
4243
None,
4344
HTTPValidationError
4445
]]:
45-
if keep_alive is not None:
46+
if keep_alive is not UNSET:
4647
headers["keep-alive"] = keep_alive
4748

4849

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""" Contains all the data models used in inputs/outputs """
22

3-
from .a_model import AModel
43
from .an_enum import AnEnum
54
from .an_int_enum import AnIntEnum
65
from .body_upload_file_tests_upload_post import BodyUploadFileTestsUploadPost
6+
from .dict_prop import DictProp
77
from .different_enum import DifferentEnum
8-
from .http_validation_error import HTTPValidationError
8+
from .json_body import JsonBody
99
from .validation_error import ValidationError

0 commit comments

Comments
 (0)