@@ -368,9 +368,10 @@ def test_path_params_update_status(self, client: Gradient) -> None:
368368 def test_method_wait_until_ready (self , client : Gradient , respx_mock : Any ) -> None :
369369 """Test successful wait_until_ready when agent becomes ready."""
370370 agent_uuid = "test-agent-id"
371-
371+
372372 # Create side effect that returns different responses
373373 call_count = [0 ]
374+
374375 def get_response (_ : httpx .Request ) -> httpx .Response :
375376 call_count [0 ] += 1
376377 if call_count [0 ] == 1 :
@@ -395,9 +396,9 @@ def get_response(_: httpx.Request) -> httpx.Response:
395396 }
396397 },
397398 )
398-
399+
399400 respx_mock .get (f"/v2/gen-ai/agents/{ agent_uuid } " ).mock (side_effect = get_response )
400-
401+
401402 agent = client .agents .wait_until_ready (agent_uuid , poll_interval = 0.1 , timeout = 10.0 )
402403 assert_matches_type (AgentRetrieveResponse , agent , path = ["response" ])
403404 assert agent .agent is not None
@@ -408,9 +409,9 @@ def get_response(_: httpx.Request) -> httpx.Response:
408409 def test_wait_until_ready_timeout (self , client : Gradient , respx_mock : Any ) -> None :
409410 """Test that wait_until_ready raises timeout error."""
410411 from gradient ._exceptions import AgentDeploymentTimeoutError
411-
412+
412413 agent_uuid = "test-agent-id"
413-
414+
414415 # Mock always returns deploying
415416 respx_mock .get (f"/v2/gen-ai/agents/{ agent_uuid } " ).mock (
416417 return_value = httpx .Response (
@@ -423,20 +424,20 @@ def test_wait_until_ready_timeout(self, client: Gradient, respx_mock: Any) -> No
423424 },
424425 )
425426 )
426-
427+
427428 with pytest .raises (AgentDeploymentTimeoutError ) as exc_info :
428429 client .agents .wait_until_ready (agent_uuid , poll_interval = 0.1 , timeout = 0.5 )
429-
430+
430431 assert "did not reach STATUS_RUNNING within" in str (exc_info .value )
431432 assert exc_info .value .agent_id == agent_uuid
432433
433434 @parametrize
434435 def test_wait_until_ready_deployment_failed (self , client : Gradient , respx_mock : Any ) -> None :
435436 """Test that wait_until_ready raises error on deployment failure."""
436437 from gradient ._exceptions import AgentDeploymentError
437-
438+
438439 agent_uuid = "test-agent-id"
439-
440+
440441 # Mock returns failed status
441442 respx_mock .get (f"/v2/gen-ai/agents/{ agent_uuid } " ).mock (
442443 return_value = httpx .Response (
@@ -449,10 +450,10 @@ def test_wait_until_ready_deployment_failed(self, client: Gradient, respx_mock:
449450 },
450451 )
451452 )
452-
453+
453454 with pytest .raises (AgentDeploymentError ) as exc_info :
454455 client .agents .wait_until_ready (agent_uuid , poll_interval = 0.1 , timeout = 10.0 )
455-
456+
456457 assert "deployment failed with status: STATUS_FAILED" in str (exc_info .value )
457458 assert exc_info .value .status == "STATUS_FAILED"
458459
@@ -810,9 +811,10 @@ async def test_path_params_update_status(self, async_client: AsyncGradient) -> N
810811 async def test_method_wait_until_ready (self , async_client : AsyncGradient , respx_mock : Any ) -> None :
811812 """Test successful async wait_until_ready when agent becomes ready."""
812813 agent_uuid = "test-agent-id"
813-
814+
814815 # Create side effect that returns different responses
815816 call_count = [0 ]
817+
816818 def get_response (_ : httpx .Request ) -> httpx .Response :
817819 call_count [0 ] += 1
818820 if call_count [0 ] == 1 :
@@ -837,9 +839,9 @@ def get_response(_: httpx.Request) -> httpx.Response:
837839 }
838840 },
839841 )
840-
842+
841843 respx_mock .get (f"/v2/gen-ai/agents/{ agent_uuid } " ).mock (side_effect = get_response )
842-
844+
843845 agent = await async_client .agents .wait_until_ready (agent_uuid , poll_interval = 0.1 , timeout = 10.0 )
844846 assert_matches_type (AgentRetrieveResponse , agent , path = ["response" ])
845847 assert agent .agent is not None
@@ -850,9 +852,9 @@ def get_response(_: httpx.Request) -> httpx.Response:
850852 async def test_wait_until_ready_timeout (self , async_client : AsyncGradient , respx_mock : Any ) -> None :
851853 """Test that async wait_until_ready raises timeout error."""
852854 from gradient ._exceptions import AgentDeploymentTimeoutError
853-
855+
854856 agent_uuid = "test-agent-id"
855-
857+
856858 # Mock always returns deploying
857859 respx_mock .get (f"/v2/gen-ai/agents/{ agent_uuid } " ).mock (
858860 return_value = httpx .Response (
@@ -865,20 +867,20 @@ async def test_wait_until_ready_timeout(self, async_client: AsyncGradient, respx
865867 },
866868 )
867869 )
868-
870+
869871 with pytest .raises (AgentDeploymentTimeoutError ) as exc_info :
870872 await async_client .agents .wait_until_ready (agent_uuid , poll_interval = 0.1 , timeout = 0.5 )
871-
873+
872874 assert "did not reach STATUS_RUNNING within" in str (exc_info .value )
873875 assert exc_info .value .agent_id == agent_uuid
874876
875877 @parametrize
876878 async def test_wait_until_ready_deployment_failed (self , async_client : AsyncGradient , respx_mock : Any ) -> None :
877879 """Test that async wait_until_ready raises error on deployment failure."""
878880 from gradient ._exceptions import AgentDeploymentError
879-
881+
880882 agent_uuid = "test-agent-id"
881-
883+
882884 # Mock returns failed status
883885 respx_mock .get (f"/v2/gen-ai/agents/{ agent_uuid } " ).mock (
884886 return_value = httpx .Response (
@@ -891,9 +893,9 @@ async def test_wait_until_ready_deployment_failed(self, async_client: AsyncGradi
891893 },
892894 )
893895 )
894-
896+
895897 with pytest .raises (AgentDeploymentError ) as exc_info :
896898 await async_client .agents .wait_until_ready (agent_uuid , poll_interval = 0.1 , timeout = 10.0 )
897-
899+
898900 assert "deployment failed with status: STATUS_FAILED" in str (exc_info .value )
899901 assert exc_info .value .status == "STATUS_FAILED"
0 commit comments