| 96 | |
| 97 | @pytest.fixture(scope="function") |
| 98 | def snapshot_client( |
| 99 | is_recording: bool, |
| 100 | http_snapshot_serializer_options: SnapshotSerializerOptions, |
| 101 | http_snapshot: inline_snapshot.Snapshot[Any], |
| 102 | ) -> Iterator[Anthropic]: |
| 103 | with HttpxSyncSnapshotClient( |
| 104 | http_snapshot, is_recording, serializer_options=http_snapshot_serializer_options |
| 105 | ) as snapshot_client: |
| 106 | with Anthropic(http_client=snapshot_client, api_key=None if is_recording else api_key) as client: |
| 107 | yield client |
| 108 | |
| 109 | |
| 110 | @pytest.fixture(scope="function") |