← Back
Editing: testing.cpython-311.pyc
� "z�c/ � �H � d dl Z d dlZddlmZ ddlmZ G d� d� � ZdS )� N� )�guarantee_single_callable)�timeoutc �D � e Zd ZdZd� Zdd�Zdd�Zd� Zd� Zdd �Z dd�Z d S )�ApplicationCommunicatorz} Runs an ASGI application in a test mode, allowing sending of messages to it and retrieval of messages it sends. c � � t |� � | _ || _ t j � � | _ t j � � | _ t j | � || j j | j j � � � � | _ d S �N)r �application�scope�asyncio�Queue�input_queue�output_queue� ensure_future�get�put�future)�selfr r s �1/usr/lib/python3/dist-packages/asgiref/testing.py�__init__z ApplicationCommunicator.__init__ sn � �4�[�A�A����� �"�=�?�?���#�M�O�O����+����U�D�$4�$8�$�:K�:O�P�P� � ����� r c � �^ K � t |� � 4 �d{V �� | j � d{V �� | j � � � n# t j $ r Y nw xY wddd� � �d{V �� n# 1 �d{V ��swxY w Y | j � � � s?| j � � � | j � d{V �� dS # t j $ r Y dS w xY wdS # | j � � � s=| j � � � | j � d{V �� w # t j $ r Y w w xY ww xY w)zV Waits for the application to stop itself and returns any exceptions. N)� async_timeoutr �resultr �CancelledError�done�cancel)r r s r �waitzApplicationCommunicator.wait s � � � � �$�W�-�-� � � � � � � � ���+�%�%�%�%�%�%�%��K�&�&�(�(�(�(���-� � � ��D����� � � � � � � � � � � � � � � � � � � � � � � ���� � � � � �;�#�#�%�%� ���"�"�$�$�$���+�%�%�%�%�%�%�%�%�%���-� � � ��D�D����� � ��4�;�#�#�%�%� ���"�"�$�$�$���+�%�%�%�%�%�%�%�%���-� � � ��D����� ���s� �C �A)�&A�A)�A�A)�A�A)�C �) A3�3C �6A3�7C �- B<