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