@@ -327,6 +327,18 @@ def test_http_client_timeout_option(self) -> None:
327
327
timeout = httpx .Timeout (** request .extensions ["timeout" ]) # type: ignore
328
328
assert timeout == DEFAULT_TIMEOUT # our default
329
329
330
+ async def test_invalid_http_client (self ) -> None :
331
+ with pytest .raises (TypeError , match = "Invalid `http_client` arg" ):
332
+ async with httpx .AsyncClient () as http_client :
333
+ Finch (
334
+ base_url = base_url ,
335
+ access_token = access_token ,
336
+ client_id = client_id ,
337
+ client_secret = client_secret ,
338
+ _strict_response_validation = True ,
339
+ http_client = cast (Any , http_client ),
340
+ )
341
+
330
342
def test_default_headers_option (self ) -> None :
331
343
client = Finch (
332
344
base_url = base_url ,
@@ -1220,6 +1232,18 @@ async def test_http_client_timeout_option(self) -> None:
1220
1232
timeout = httpx .Timeout (** request .extensions ["timeout" ]) # type: ignore
1221
1233
assert timeout == DEFAULT_TIMEOUT # our default
1222
1234
1235
+ def test_invalid_http_client (self ) -> None :
1236
+ with pytest .raises (TypeError , match = "Invalid `http_client` arg" ):
1237
+ with httpx .Client () as http_client :
1238
+ AsyncFinch (
1239
+ base_url = base_url ,
1240
+ access_token = access_token ,
1241
+ client_id = client_id ,
1242
+ client_secret = client_secret ,
1243
+ _strict_response_validation = True ,
1244
+ http_client = cast (Any , http_client ),
1245
+ )
1246
+
1223
1247
def test_default_headers_option (self ) -> None :
1224
1248
client = AsyncFinch (
1225
1249
base_url = base_url ,
0 commit comments