99
1010from asktable import Asktable , AsyncAsktable
1111from tests .utils import assert_matches_type
12- from asktable .types import Chat , ChatRetrieveResponse
12+ from asktable .types import (
13+ ChatListResponse ,
14+ ChatCreateResponse ,
15+ ChatRetrieveResponse ,
16+ )
1317from asktable .pagination import SyncPage , AsyncPage
1418
1519base_url = os .environ .get ("TEST_API_BASE_URL" , "http://127.0.0.1:4010" )
@@ -21,7 +25,7 @@ class TestChats:
2125 @parametrize
2226 def test_method_create (self , client : Asktable ) -> None :
2327 chat = client .chats .create ()
24- assert_matches_type (Chat , chat , path = ["response" ])
28+ assert_matches_type (ChatCreateResponse , chat , path = ["response" ])
2529
2630 @parametrize
2731 def test_method_create_with_all_params (self , client : Asktable ) -> None :
@@ -36,7 +40,7 @@ def test_method_create_with_all_params(self, client: Asktable) -> None:
3640 "name" : "张三" ,
3741 },
3842 )
39- assert_matches_type (Chat , chat , path = ["response" ])
43+ assert_matches_type (ChatCreateResponse , chat , path = ["response" ])
4044
4145 @parametrize
4246 def test_raw_response_create (self , client : Asktable ) -> None :
@@ -45,7 +49,7 @@ def test_raw_response_create(self, client: Asktable) -> None:
4549 assert response .is_closed is True
4650 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
4751 chat = response .parse ()
48- assert_matches_type (Chat , chat , path = ["response" ])
52+ assert_matches_type (ChatCreateResponse , chat , path = ["response" ])
4953
5054 @parametrize
5155 def test_streaming_response_create (self , client : Asktable ) -> None :
@@ -54,7 +58,7 @@ def test_streaming_response_create(self, client: Asktable) -> None:
5458 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
5559
5660 chat = response .parse ()
57- assert_matches_type (Chat , chat , path = ["response" ])
61+ assert_matches_type (ChatCreateResponse , chat , path = ["response" ])
5862
5963 assert cast (Any , response .is_closed ) is True
6064
@@ -99,15 +103,15 @@ def test_path_params_retrieve(self, client: Asktable) -> None:
99103 @parametrize
100104 def test_method_list (self , client : Asktable ) -> None :
101105 chat = client .chats .list ()
102- assert_matches_type (SyncPage [Chat ], chat , path = ["response" ])
106+ assert_matches_type (SyncPage [ChatListResponse ], chat , path = ["response" ])
103107
104108 @parametrize
105109 def test_method_list_with_all_params (self , client : Asktable ) -> None :
106110 chat = client .chats .list (
107111 page = 1 ,
108112 size = 1 ,
109113 )
110- assert_matches_type (SyncPage [Chat ], chat , path = ["response" ])
114+ assert_matches_type (SyncPage [ChatListResponse ], chat , path = ["response" ])
111115
112116 @parametrize
113117 def test_raw_response_list (self , client : Asktable ) -> None :
@@ -116,7 +120,7 @@ def test_raw_response_list(self, client: Asktable) -> None:
116120 assert response .is_closed is True
117121 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
118122 chat = response .parse ()
119- assert_matches_type (SyncPage [Chat ], chat , path = ["response" ])
123+ assert_matches_type (SyncPage [ChatListResponse ], chat , path = ["response" ])
120124
121125 @parametrize
122126 def test_streaming_response_list (self , client : Asktable ) -> None :
@@ -125,7 +129,7 @@ def test_streaming_response_list(self, client: Asktable) -> None:
125129 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
126130
127131 chat = response .parse ()
128- assert_matches_type (SyncPage [Chat ], chat , path = ["response" ])
132+ assert_matches_type (SyncPage [ChatListResponse ], chat , path = ["response" ])
129133
130134 assert cast (Any , response .is_closed ) is True
131135
@@ -176,7 +180,7 @@ class TestAsyncChats:
176180 @parametrize
177181 async def test_method_create (self , async_client : AsyncAsktable ) -> None :
178182 chat = await async_client .chats .create ()
179- assert_matches_type (Chat , chat , path = ["response" ])
183+ assert_matches_type (ChatCreateResponse , chat , path = ["response" ])
180184
181185 @parametrize
182186 async def test_method_create_with_all_params (self , async_client : AsyncAsktable ) -> None :
@@ -191,7 +195,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable)
191195 "name" : "张三" ,
192196 },
193197 )
194- assert_matches_type (Chat , chat , path = ["response" ])
198+ assert_matches_type (ChatCreateResponse , chat , path = ["response" ])
195199
196200 @parametrize
197201 async def test_raw_response_create (self , async_client : AsyncAsktable ) -> None :
@@ -200,7 +204,7 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
200204 assert response .is_closed is True
201205 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
202206 chat = await response .parse ()
203- assert_matches_type (Chat , chat , path = ["response" ])
207+ assert_matches_type (ChatCreateResponse , chat , path = ["response" ])
204208
205209 @parametrize
206210 async def test_streaming_response_create (self , async_client : AsyncAsktable ) -> None :
@@ -209,7 +213,7 @@ async def test_streaming_response_create(self, async_client: AsyncAsktable) -> N
209213 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
210214
211215 chat = await response .parse ()
212- assert_matches_type (Chat , chat , path = ["response" ])
216+ assert_matches_type (ChatCreateResponse , chat , path = ["response" ])
213217
214218 assert cast (Any , response .is_closed ) is True
215219
@@ -254,15 +258,15 @@ async def test_path_params_retrieve(self, async_client: AsyncAsktable) -> None:
254258 @parametrize
255259 async def test_method_list (self , async_client : AsyncAsktable ) -> None :
256260 chat = await async_client .chats .list ()
257- assert_matches_type (AsyncPage [Chat ], chat , path = ["response" ])
261+ assert_matches_type (AsyncPage [ChatListResponse ], chat , path = ["response" ])
258262
259263 @parametrize
260264 async def test_method_list_with_all_params (self , async_client : AsyncAsktable ) -> None :
261265 chat = await async_client .chats .list (
262266 page = 1 ,
263267 size = 1 ,
264268 )
265- assert_matches_type (AsyncPage [Chat ], chat , path = ["response" ])
269+ assert_matches_type (AsyncPage [ChatListResponse ], chat , path = ["response" ])
266270
267271 @parametrize
268272 async def test_raw_response_list (self , async_client : AsyncAsktable ) -> None :
@@ -271,7 +275,7 @@ async def test_raw_response_list(self, async_client: AsyncAsktable) -> None:
271275 assert response .is_closed is True
272276 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
273277 chat = await response .parse ()
274- assert_matches_type (AsyncPage [Chat ], chat , path = ["response" ])
278+ assert_matches_type (AsyncPage [ChatListResponse ], chat , path = ["response" ])
275279
276280 @parametrize
277281 async def test_streaming_response_list (self , async_client : AsyncAsktable ) -> None :
@@ -280,7 +284,7 @@ async def test_streaming_response_list(self, async_client: AsyncAsktable) -> Non
280284 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
281285
282286 chat = await response .parse ()
283- assert_matches_type (AsyncPage [Chat ], chat , path = ["response" ])
287+ assert_matches_type (AsyncPage [ChatListResponse ], chat , path = ["response" ])
284288
285289 assert cast (Any , response .is_closed ) is True
286290
0 commit comments