33from __future__ import annotations
44
55import os
6- from typing import Any , cast
6+ from typing import Any , Optional , cast
77
88import pytest
99
1010from cloudflare import Cloudflare , AsyncCloudflare
1111from tests .utils import assert_matches_type
12+ from cloudflare .types .stream import (
13+ DownloadGetResponse ,
14+ DownloadCreateResponse ,
15+ )
1216
1317base_url = os .environ .get ("TEST_API_BASE_URL" , "http://127.0.0.1:4010" )
1418
@@ -23,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None:
2327 account_id = "023e105f4ecef8ad9ca31a8372d0c353" ,
2428 body = {},
2529 )
26- assert_matches_type (object , download , path = ["response" ])
30+ assert_matches_type (Optional [ DownloadCreateResponse ] , download , path = ["response" ])
2731
2832 @parametrize
2933 def test_raw_response_create (self , client : Cloudflare ) -> None :
@@ -36,7 +40,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
3640 assert response .is_closed is True
3741 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
3842 download = response .parse ()
39- assert_matches_type (object , download , path = ["response" ])
43+ assert_matches_type (Optional [ DownloadCreateResponse ] , download , path = ["response" ])
4044
4145 @parametrize
4246 def test_streaming_response_create (self , client : Cloudflare ) -> None :
@@ -49,7 +53,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
4953 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
5054
5155 download = response .parse ()
52- assert_matches_type (object , download , path = ["response" ])
56+ assert_matches_type (Optional [ DownloadCreateResponse ] , download , path = ["response" ])
5357
5458 assert cast (Any , response .is_closed ) is True
5559
@@ -123,7 +127,7 @@ def test_method_get(self, client: Cloudflare) -> None:
123127 identifier = "ea95132c15732412d22c1476fa83f27a" ,
124128 account_id = "023e105f4ecef8ad9ca31a8372d0c353" ,
125129 )
126- assert_matches_type (object , download , path = ["response" ])
130+ assert_matches_type (Optional [ DownloadGetResponse ] , download , path = ["response" ])
127131
128132 @parametrize
129133 def test_raw_response_get (self , client : Cloudflare ) -> None :
@@ -135,7 +139,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
135139 assert response .is_closed is True
136140 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
137141 download = response .parse ()
138- assert_matches_type (object , download , path = ["response" ])
142+ assert_matches_type (Optional [ DownloadGetResponse ] , download , path = ["response" ])
139143
140144 @parametrize
141145 def test_streaming_response_get (self , client : Cloudflare ) -> None :
@@ -147,7 +151,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
147151 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
148152
149153 download = response .parse ()
150- assert_matches_type (object , download , path = ["response" ])
154+ assert_matches_type (Optional [ DownloadGetResponse ] , download , path = ["response" ])
151155
152156 assert cast (Any , response .is_closed ) is True
153157
@@ -178,7 +182,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
178182 account_id = "023e105f4ecef8ad9ca31a8372d0c353" ,
179183 body = {},
180184 )
181- assert_matches_type (object , download , path = ["response" ])
185+ assert_matches_type (Optional [ DownloadCreateResponse ] , download , path = ["response" ])
182186
183187 @parametrize
184188 async def test_raw_response_create (self , async_client : AsyncCloudflare ) -> None :
@@ -191,7 +195,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
191195 assert response .is_closed is True
192196 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
193197 download = await response .parse ()
194- assert_matches_type (object , download , path = ["response" ])
198+ assert_matches_type (Optional [ DownloadCreateResponse ] , download , path = ["response" ])
195199
196200 @parametrize
197201 async def test_streaming_response_create (self , async_client : AsyncCloudflare ) -> None :
@@ -204,7 +208,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
204208 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
205209
206210 download = await response .parse ()
207- assert_matches_type (object , download , path = ["response" ])
211+ assert_matches_type (Optional [ DownloadCreateResponse ] , download , path = ["response" ])
208212
209213 assert cast (Any , response .is_closed ) is True
210214
@@ -278,7 +282,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
278282 identifier = "ea95132c15732412d22c1476fa83f27a" ,
279283 account_id = "023e105f4ecef8ad9ca31a8372d0c353" ,
280284 )
281- assert_matches_type (object , download , path = ["response" ])
285+ assert_matches_type (Optional [ DownloadGetResponse ] , download , path = ["response" ])
282286
283287 @parametrize
284288 async def test_raw_response_get (self , async_client : AsyncCloudflare ) -> None :
@@ -290,7 +294,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
290294 assert response .is_closed is True
291295 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
292296 download = await response .parse ()
293- assert_matches_type (object , download , path = ["response" ])
297+ assert_matches_type (Optional [ DownloadGetResponse ] , download , path = ["response" ])
294298
295299 @parametrize
296300 async def test_streaming_response_get (self , async_client : AsyncCloudflare ) -> None :
@@ -302,7 +306,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
302306 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
303307
304308 download = await response .parse ()
305- assert_matches_type (object , download , path = ["response" ])
309+ assert_matches_type (Optional [ DownloadGetResponse ] , download , path = ["response" ])
306310
307311 assert cast (Any , response .is_closed ) is True
308312
0 commit comments