%PDF- %PDF-
Direktori : /usr/lib/python3/dist-packages/twisted/web/test/__pycache__/ |
Current File : //usr/lib/python3/dist-packages/twisted/web/test/__pycache__/test_newclient.cpython-312.pyc |
� Ϫ�f4� � � � d Z ddlmZ ddlmZ ddlmZ ddlmZm Z m Z mZ ddlm Z mZ ddlmZmZ ddlmZ dd lmZmZmZmZ dd lmZ ddlmZ ddlmZ dd lm Z ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z= ddl>m?Z? ddl@mAZA ddlBmCZCmDZD ddlEmFZFmGZG G d� deH� ZI G d� deH� ZJ eAddgi� ZKd� ZLd� ZMd� ZNd� ZOd� ZP G d� d e � ZQ G d!� d"� ZR G d#� d$eRe � ZS G d%� d&eRe � ZT G d'� d(e � ZU G d)� d*� ZV G d+� d,� ZW G d-� d.e � ZX eeC� G d/� d0� � ZY G d1� d2e � ZZ G d3� d4e � Z[ G d5� d6e � Z\ G d7� d8e � Z] G d9� d:e � Z^y;)<z& Tests for L{twisted.web._newclient}. � )�Optional)�implementer)�verifyObject)�CancelledError�Deferred�fail�succeed)�ConnectionDone�ConnectionLost)� IConsumer� IPushProducer)�Protocol)�AccumulatingProtocol�EventLoggingObserver�StringTransport� StringTransportWithDisconnection)�globalLogPublisher)�LineReceiver)�Failure)�TestCase)�BODY�DONE�HEADER�STATUS�UNKNOWN_LENGTH� BadHeaders�BadResponseVersion�ChunkedEncoder�ConnectionAborted�ExcessWrite�HTTPClientParser� HTTPParser�LengthEnforcingConsumer� ParseError�RequestNotSent�TransportProxyProducer�WrongBodyLength�makeStatefulDispatcher) �HTTP11ClientProtocol�PotentialDataLoss�Request�RequestGenerationFailed�RequestTransmissionFailed�Response�ResponseDone�ResponseFailed�ResponseNeverReceived)� _DataLoss)�Headers)� IBodyProducer� IResponse)�bytesLinearWhitespaceComponents�sanitizedBytesc � � e Zd ZdZy)�ArbitraryExceptionze A unique, arbitrary exception type which L{twisted.web._newclient} knows nothing about. N��__name__� __module__�__qualname__�__doc__� � �A/usr/lib/python3/dist-packages/twisted/web/test/test_newclient.pyr9 r9 C s � �r@ r9 c � � e Zd ZdZy)�AnotherArbitraryExceptionzI Similar to L{ArbitraryException} but with a different identity. Nr: r? r@ rA rC rC J s � �r@ rC � host� example.comc �\ � �� �� fd�}� j ||� }|j |� |S )a� Assert that the given L{Deferred} fails with the exception given by C{mainType} and that the exceptions wrapped by the instance of C{mainType} it fails with match the list of exception types given by C{reasonTypes}. This is a helper for testing failures of exceptions which subclass L{_newclient._WrapperException}. @param self: A L{TestCase} instance which will be used to make the assertions. @param deferred: The L{Deferred} which is expected to fail with C{mainType}. @param mainType: A L{_newclient._WrapperException} subclass which will be trapped on C{deferred}. @param reasonTypes: A sequence of exception types which will be trapped on the resulting C{mainType} exception instance's C{reasons} sequence. @return: A L{Deferred} which fires with the C{mainType} instance C{deferred} fails with, or which fails somehow. c �� �� t | j �� D ] \ }}|j |� � �j t | j � t �� d| j � d�� d�� | S )Nzlen(z ) != len(�))�zip�reasons�trap�assertEqual�len)�err�reason�type�reasonTypes�selfs ��rA �cbFailedz-assertWrapperExceptionTypes.<locals>.cbFailedn sl �� �����[�9� �L�F�D��K�K��� �������������3�;�;�-�y�� �Q�7� � � r@ )� assertFailure�addCallback)rR �deferred�mainTyperQ rS �ds ` ` rA �assertWrapperExceptionTypesrY U s- �� �2� ���8�X�.�A��M�M�(���Hr@ c �&