Current File : //proc/self/root/lib/python3/dist-packages/twisted/web/test/__pycache__/_util.cpython-312.pyc |
�
Ϫ�f
� � � d Z ddlmZ ddlmZ ddlmZmZ ddlm Z ddl
mZ ddlm
Z
ddlmZ dd lmZ dd
lmZ ddlmZ dd
lmZ dd�Z G d� de � Zd� Zg d�Zy)z0
General helpers for L{twisted.web} unit tests.
� )�annotations)�Type)�Deferred�succeed)�SynchronousTestCase)�server)�
flattenString)�FlattenerError)�Request)� IResource)�Flattenable� )�DummyRequestc �* � | j |� }t |t � r,|j |� |j � t d � S |t j u r'|j rt d � S |j � S t d|��� �)NzUnexpected return value: )�render�
isinstance�bytes�write�finishr r �NOT_DONE_YET�finished�notifyFinish�
ValueError)�resource�request�results �8/usr/lib/python3/dist-packages/twisted/web/test/_util.py�_renderr s} � �
�_�_�W�
%�F��&�%� ��
�
�f�������t�}�� �6�&�&� &�����4�=� ��'�'�)�)��4�V�J�?�@�@� c �( � e Zd ZdZdd�Zdd�Zdd�Zy) �FlattenTestCasezH
A test case that assists with testing L{twisted.web._flatten}.
c �R � �� d� �fd�}t d|� }|j |� |S )zS
Assert that a root element, when flattened, is equal to a string.
c �, �� �j | �� | S )N)�assertEqual)r �self�targets ��r �checkz/FlattenTestCase.assertFlattensTo.<locals>.check/ s �� ����V�V�,��Mr N)r r �returnr )r �addCallback)r% �rootr&