99
1010from replicate import ReplicateClient , AsyncReplicateClient
1111from tests .utils import assert_matches_type
12- from replicate .types import PredictionResponse , PredictionListResponse
12+ from replicate .types import PredictionResponse
1313from replicate ._utils import parse_datetime
14+ from replicate .pagination import SyncCursorURLPage , AsyncCursorURLPage
1415
1516base_url = os .environ .get ("TEST_API_BASE_URL" , "http://127.0.0.1:4010" )
1617
@@ -72,7 +73,7 @@ def test_streaming_response_create(self, client: ReplicateClient) -> None:
7273 @parametrize
7374 def test_method_list (self , client : ReplicateClient ) -> None :
7475 prediction = client .predictions .list ()
75- assert_matches_type (PredictionListResponse , prediction , path = ["response" ])
76+ assert_matches_type (SyncCursorURLPage [ PredictionResponse ] , prediction , path = ["response" ])
7677
7778 @pytest .mark .skip ()
7879 @parametrize
@@ -81,7 +82,7 @@ def test_method_list_with_all_params(self, client: ReplicateClient) -> None:
8182 created_after = parse_datetime ("2025-01-01T00:00:00Z" ),
8283 created_before = parse_datetime ("2025-02-01T00:00:00Z" ),
8384 )
84- assert_matches_type (PredictionListResponse , prediction , path = ["response" ])
85+ assert_matches_type (SyncCursorURLPage [ PredictionResponse ] , prediction , path = ["response" ])
8586
8687 @pytest .mark .skip ()
8788 @parametrize
@@ -91,7 +92,7 @@ def test_raw_response_list(self, client: ReplicateClient) -> None:
9192 assert response .is_closed is True
9293 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
9394 prediction = response .parse ()
94- assert_matches_type (PredictionListResponse , prediction , path = ["response" ])
95+ assert_matches_type (SyncCursorURLPage [ PredictionResponse ] , prediction , path = ["response" ])
9596
9697 @pytest .mark .skip ()
9798 @parametrize
@@ -101,7 +102,7 @@ def test_streaming_response_list(self, client: ReplicateClient) -> None:
101102 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
102103
103104 prediction = response .parse ()
104- assert_matches_type (PredictionListResponse , prediction , path = ["response" ])
105+ assert_matches_type (SyncCursorURLPage [ PredictionResponse ] , prediction , path = ["response" ])
105106
106107 assert cast (Any , response .is_closed ) is True
107108
@@ -247,7 +248,7 @@ async def test_streaming_response_create(self, async_client: AsyncReplicateClien
247248 @parametrize
248249 async def test_method_list (self , async_client : AsyncReplicateClient ) -> None :
249250 prediction = await async_client .predictions .list ()
250- assert_matches_type (PredictionListResponse , prediction , path = ["response" ])
251+ assert_matches_type (AsyncCursorURLPage [ PredictionResponse ] , prediction , path = ["response" ])
251252
252253 @pytest .mark .skip ()
253254 @parametrize
@@ -256,7 +257,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncReplicateCli
256257 created_after = parse_datetime ("2025-01-01T00:00:00Z" ),
257258 created_before = parse_datetime ("2025-02-01T00:00:00Z" ),
258259 )
259- assert_matches_type (PredictionListResponse , prediction , path = ["response" ])
260+ assert_matches_type (AsyncCursorURLPage [ PredictionResponse ] , prediction , path = ["response" ])
260261
261262 @pytest .mark .skip ()
262263 @parametrize
@@ -266,7 +267,7 @@ async def test_raw_response_list(self, async_client: AsyncReplicateClient) -> No
266267 assert response .is_closed is True
267268 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
268269 prediction = await response .parse ()
269- assert_matches_type (PredictionListResponse , prediction , path = ["response" ])
270+ assert_matches_type (AsyncCursorURLPage [ PredictionResponse ] , prediction , path = ["response" ])
270271
271272 @pytest .mark .skip ()
272273 @parametrize
@@ -276,7 +277,7 @@ async def test_streaming_response_list(self, async_client: AsyncReplicateClient)
276277 assert response .http_request .headers .get ("X-Stainless-Lang" ) == "python"
277278
278279 prediction = await response .parse ()
279- assert_matches_type (PredictionListResponse , prediction , path = ["response" ])
280+ assert_matches_type (AsyncCursorURLPage [ PredictionResponse ] , prediction , path = ["response" ])
280281
281282 assert cast (Any , response .is_closed ) is True
282283
0 commit comments