@@ -194,10 +194,10 @@ def test_http_client_async_abc_not_instantiable() -> None:
194194# -- ApifyClient with custom http_client via classmethod --
195195
196196
197- def test_apify_client_with_custom_client () -> None :
198- """Test that ApifyClient.with_custom_client accepts a custom http_client."""
197+ def test_apify_client_with_custom_http_client () -> None :
198+ """Test that ApifyClient.with_custom_http_client accepts a custom http_client."""
199199 fake_client = FakeHttpClient ()
200- client = ApifyClient .with_custom_client (token = 'test_token' , http_client = fake_client )
200+ client = ApifyClient .with_custom_http_client (token = 'test_token' , http_client = fake_client )
201201
202202 assert client .http_client is fake_client
203203
@@ -212,7 +212,7 @@ def test_apify_client_uses_default_http_client_when_none_provided() -> None:
212212def test_apify_client_custom_http_client_receives_requests () -> None :
213213 """Test that requests flow through the custom HTTP client."""
214214 fake_client = FakeHttpClient ()
215- client = ApifyClient .with_custom_client (token = 'test_token' , http_client = fake_client )
215+ client = ApifyClient .with_custom_http_client (token = 'test_token' , http_client = fake_client )
216216
217217 # Use _get() via the dataset client to avoid Pydantic model validation
218218 # (actor.get() would try to validate against ActorResponse model)
@@ -225,10 +225,10 @@ def test_apify_client_custom_http_client_receives_requests() -> None:
225225 assert result == {'data' : {'id' : 'test123' }}
226226
227227
228- def test_apify_client_with_custom_client_accepts_url_params () -> None :
229- """Test that with_custom_client can be combined with token, api_url, and api_public_url."""
228+ def test_apify_client_with_custom_http_client_accepts_url_params () -> None :
229+ """Test that with_custom_http_client can be combined with token, api_url, and api_public_url."""
230230 fake_client = FakeHttpClient ()
231- client = ApifyClient .with_custom_client (
231+ client = ApifyClient .with_custom_http_client (
232232 token = 'test_token' ,
233233 api_url = 'https://custom.api.example.com' ,
234234 api_public_url = 'https://public.api.example.com' ,
@@ -240,10 +240,10 @@ def test_apify_client_with_custom_client_accepts_url_params() -> None:
240240# -- ApifyClientAsync with custom http_client via classmethod --
241241
242242
243- async def test_apify_client_async_with_custom_client () -> None :
244- """Test that ApifyClientAsync.with_custom_client accepts a custom http_client."""
243+ async def test_apify_client_async_with_custom_http_client () -> None :
244+ """Test that ApifyClientAsync.with_custom_http_client accepts a custom http_client."""
245245 fake_client = FakeHttpClientAsync ()
246- client = ApifyClientAsync .with_custom_client (token = 'test_token' , http_client = fake_client )
246+ client = ApifyClientAsync .with_custom_http_client (token = 'test_token' , http_client = fake_client )
247247
248248 assert client .http_client is fake_client
249249
@@ -258,7 +258,7 @@ async def test_apify_client_async_uses_default_http_client_when_none_provided()
258258async def test_apify_client_async_custom_http_client_receives_requests () -> None :
259259 """Test that async requests flow through the custom HTTP client."""
260260 fake_client = FakeHttpClientAsync ()
261- client = ApifyClientAsync .with_custom_client (token = 'test_token' , http_client = fake_client )
261+ client = ApifyClientAsync .with_custom_http_client (token = 'test_token' , http_client = fake_client )
262262
263263 # Use _get() via the dataset client to avoid Pydantic model validation
264264 result = await client .dataset ('test-dataset' )._get ()
@@ -270,10 +270,10 @@ async def test_apify_client_async_custom_http_client_receives_requests() -> None
270270 assert result == {'data' : {'id' : 'test123' }}
271271
272272
273- async def test_apify_client_async_with_custom_client_accepts_url_params () -> None :
274- """Test that async with_custom_client can be combined with token, api_url, and api_public_url."""
273+ async def test_apify_client_async_with_custom_http_client_accepts_url_params () -> None :
274+ """Test that async with_custom_http_client can be combined with token, api_url, and api_public_url."""
275275 fake_client = FakeHttpClientAsync ()
276- client = ApifyClientAsync .with_custom_client (
276+ client = ApifyClientAsync .with_custom_http_client (
277277 token = 'test_token' ,
278278 api_url = 'https://custom.api.example.com' ,
279279 api_public_url = 'https://public.api.example.com' ,
@@ -305,7 +305,7 @@ def test_apify_client_http_client_property_returns_correct_type() -> None:
305305
306306 # With custom
307307 fake = FakeHttpClient ()
308- client2 = ApifyClient .with_custom_client (token = 'test' , http_client = fake )
308+ client2 = ApifyClient .with_custom_http_client (token = 'test' , http_client = fake )
309309 assert client2 .http_client is fake
310310
311311
@@ -317,7 +317,7 @@ async def test_apify_client_async_http_client_property_returns_correct_type() ->
317317
318318 # With custom
319319 fake = FakeHttpClientAsync ()
320- client2 = ApifyClientAsync .with_custom_client (token = 'test' , http_client = fake )
320+ client2 = ApifyClientAsync .with_custom_http_client (token = 'test' , http_client = fake )
321321 assert client2 .http_client is fake
322322
323323
@@ -339,7 +339,7 @@ def call(self, *, method: str, **_kwargs: Any) -> FakeResponse:
339339def test_custom_http_client_error_handling () -> None :
340340 """Test that ApifyApiError from custom client is handled correctly by resource clients."""
341341 error_client = ErrorRaisingHttpClient ()
342- client = ApifyClient .with_custom_client (token = 'test' , http_client = error_client )
342+ client = ApifyClient .with_custom_http_client (token = 'test' , http_client = error_client )
343343
344344 # _get() should catch 404 record-not-found and return None
345345 result = client .actor ('nonexistent' ).get ()
@@ -361,7 +361,7 @@ async def call(self, *, method: str, **_kwargs: Any) -> FakeResponse:
361361async def test_custom_http_client_async_error_handling () -> None :
362362 """Test that ApifyApiError from async custom client is handled correctly by resource clients."""
363363 error_client = ErrorRaisingHttpClientAsync ()
364- client = ApifyClientAsync .with_custom_client (token = 'test' , http_client = error_client )
364+ client = ApifyClientAsync .with_custom_http_client (token = 'test' , http_client = error_client )
365365
366366 # _get() should catch 404 record-not-found and return None
367367 result = await client .actor ('nonexistent' ).get ()
@@ -388,7 +388,7 @@ def call(self, *, method: str, url: str, **kwargs: Any) -> HttpResponse:
388388 return inner_client .call (method = method , url = url , ** kwargs )
389389
390390 api_url = httpserver .url_for ('/' ).removesuffix ('/' )
391- client = ApifyClient .with_custom_client (token = 'test_token' , api_url = api_url , http_client = WrappingHttpClient ())
391+ client = ApifyClient .with_custom_http_client (token = 'test_token' , api_url = api_url , http_client = WrappingHttpClient ())
392392
393393 # Use _get() to test the raw request flow without Pydantic validation
394394 result = client .dataset ('test-dataset' )._get ()
@@ -414,7 +414,7 @@ async def call(self, *, method: str, url: str, **kwargs: Any) -> HttpResponse:
414414 return await inner_client .call (method = method , url = url , ** kwargs )
415415
416416 api_url = httpserver .url_for ('/' ).removesuffix ('/' )
417- client = ApifyClientAsync .with_custom_client (
417+ client = ApifyClientAsync .with_custom_http_client (
418418 token = 'test_token' , api_url = api_url , http_client = WrappingHttpClientAsync ()
419419 )
420420
0 commit comments