(request: FixtureRequest)
| 108 | |
| 109 | @pytest.fixture(scope="session") |
| 110 | async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncAnthropic]: |
| 111 | param = getattr(request, "param", True) |
| 112 | |
| 113 | # defaults |
| 114 | strict = True |
| 115 | http_client: None | httpx2.AsyncClient = None |
| 116 | |
| 117 | if isinstance(param, bool): |
| 118 | strict = param |
| 119 | elif is_dict(param): |
| 120 | strict = param.get("strict", True) |
| 121 | assert isinstance(strict, bool) |
| 122 | |
| 123 | http_client_type = param.get("http_client", "httpx") |
| 124 | if http_client_type == "aiohttp": |
| 125 | http_client = DefaultAioHttpClient() |
| 126 | else: |
| 127 | raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict") |
| 128 | |
| 129 | async with AsyncAnthropic( |
| 130 | base_url=base_url, api_key=api_key, _strict_response_validation=strict, http_client=http_client |
| 131 | ) as client: |
| 132 | yield client |
nothing calls this directly
no test coverage detected