1111
1212from kernel import Kernel , AsyncKernel
1313from tests .utils import assert_matches_type
14- from kernel .types import Profile
14+ from kernel .types import (
15+ Profile ,
16+ )
1517from kernel ._response import (
1618 BinaryAPIResponse ,
1719 AsyncBinaryAPIResponse ,
@@ -236,7 +238,20 @@ def test_path_params_delete(self, client: Kernel) -> None:
236238 def test_method_download (self , client : Kernel , respx_mock : MockRouter ) -> None :
237239 respx_mock .get ("/profiles/id_or_name/download" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
238240 profile = client .profiles .download (
239- "id_or_name" ,
241+ id_or_name = "id_or_name" ,
242+ )
243+ assert profile .is_closed
244+ assert profile .json () == {"foo" : "bar" }
245+ assert cast (Any , profile .is_closed ) is True
246+ assert isinstance (profile , BinaryAPIResponse )
247+
248+ @parametrize
249+ @pytest .mark .respx (base_url = base_url )
250+ def test_method_download_with_all_params (self , client : Kernel , respx_mock : MockRouter ) -> None :
251+ respx_mock .get ("/profiles/id_or_name/download" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
252+ profile = client .profiles .download (
253+ id_or_name = "id_or_name" ,
254+ format = "tar.zst" ,
240255 )
241256 assert profile .is_closed
242257 assert profile .json () == {"foo" : "bar" }
@@ -249,7 +264,7 @@ def test_raw_response_download(self, client: Kernel, respx_mock: MockRouter) ->
249264 respx_mock .get ("/profiles/id_or_name/download" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
250265
251266 profile = client .profiles .with_raw_response .download (
252- "id_or_name" ,
267+ id_or_name = "id_or_name" ,
253268 )
254269
255270 assert profile .is_closed is True
@@ -262,7 +277,7 @@ def test_raw_response_download(self, client: Kernel, respx_mock: MockRouter) ->
262277 def test_streaming_response_download (self , client : Kernel , respx_mock : MockRouter ) -> None :
263278 respx_mock .get ("/profiles/id_or_name/download" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
264279 with client .profiles .with_streaming_response .download (
265- "id_or_name" ,
280+ id_or_name = "id_or_name" ,
266281 ) as profile :
267282 assert not profile .is_closed
268283 assert profile .http_request .headers .get ("X-Stainless-Lang" ) == "python"
@@ -278,7 +293,7 @@ def test_streaming_response_download(self, client: Kernel, respx_mock: MockRoute
278293 def test_path_params_download (self , client : Kernel ) -> None :
279294 with pytest .raises (ValueError , match = r"Expected a non-empty value for `id_or_name` but received ''" ):
280295 client .profiles .with_raw_response .download (
281- "" ,
296+ id_or_name = "" ,
282297 )
283298
284299
@@ -497,7 +512,20 @@ async def test_path_params_delete(self, async_client: AsyncKernel) -> None:
497512 async def test_method_download (self , async_client : AsyncKernel , respx_mock : MockRouter ) -> None :
498513 respx_mock .get ("/profiles/id_or_name/download" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
499514 profile = await async_client .profiles .download (
500- "id_or_name" ,
515+ id_or_name = "id_or_name" ,
516+ )
517+ assert profile .is_closed
518+ assert await profile .json () == {"foo" : "bar" }
519+ assert cast (Any , profile .is_closed ) is True
520+ assert isinstance (profile , AsyncBinaryAPIResponse )
521+
522+ @parametrize
523+ @pytest .mark .respx (base_url = base_url )
524+ async def test_method_download_with_all_params (self , async_client : AsyncKernel , respx_mock : MockRouter ) -> None :
525+ respx_mock .get ("/profiles/id_or_name/download" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
526+ profile = await async_client .profiles .download (
527+ id_or_name = "id_or_name" ,
528+ format = "tar.zst" ,
501529 )
502530 assert profile .is_closed
503531 assert await profile .json () == {"foo" : "bar" }
@@ -510,7 +538,7 @@ async def test_raw_response_download(self, async_client: AsyncKernel, respx_mock
510538 respx_mock .get ("/profiles/id_or_name/download" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
511539
512540 profile = await async_client .profiles .with_raw_response .download (
513- "id_or_name" ,
541+ id_or_name = "id_or_name" ,
514542 )
515543
516544 assert profile .is_closed is True
@@ -523,7 +551,7 @@ async def test_raw_response_download(self, async_client: AsyncKernel, respx_mock
523551 async def test_streaming_response_download (self , async_client : AsyncKernel , respx_mock : MockRouter ) -> None :
524552 respx_mock .get ("/profiles/id_or_name/download" ).mock (return_value = httpx .Response (200 , json = {"foo" : "bar" }))
525553 async with async_client .profiles .with_streaming_response .download (
526- "id_or_name" ,
554+ id_or_name = "id_or_name" ,
527555 ) as profile :
528556 assert not profile .is_closed
529557 assert profile .http_request .headers .get ("X-Stainless-Lang" ) == "python"
@@ -539,5 +567,5 @@ async def test_streaming_response_download(self, async_client: AsyncKernel, resp
539567 async def test_path_params_download (self , async_client : AsyncKernel ) -> None :
540568 with pytest .raises (ValueError , match = r"Expected a non-empty value for `id_or_name` but received ''" ):
541569 await async_client .profiles .with_raw_response .download (
542- "" ,
570+ id_or_name = "" ,
543571 )
0 commit comments