
    jKj+                         d Z  G d d      Zy)z3Shared test helpers for the AI wrapper test suites.c                   (    e Zd ZdZd Zd Zd Zd Zy)RecordingAsyncStreamaV  Mock provider async stream that is iterable and records when closed.

    Mirrors the real ``openai.AsyncStream`` / ``anthropic.AsyncStream``: it
    supports ``async for`` and exposes an async ``close()`` plus a ``response``
    attribute, so tests can assert both iteration and that the underlying
    stream is closed on context exit.
    c                 @    t        |      | _        d| _        d| _        y )NFzprovider-response)list_itemsclosedresponse)selfitemss     f/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/posthog/test/ai/utils.py__init__zRecordingAsyncStream.__init__   s    5k+    c                     | S )N r	   s    r   	__aiter__zRecordingAsyncStream.__aiter__   s    r   c                 d   K   | j                   st        | j                   j                  d      S w)N    )r   StopAsyncIterationpopr   s    r   	__anext__zRecordingAsyncStream.__anext__   s&     {{$${{q!!s   .0c                    K   d| _         y w)NT)r   r   s    r   closezRecordingAsyncStream.close   s     s   	N)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r      s    ,
"
r   r   N)r   r   r   r   r   <module>r      s    9 r   