HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/names/test/__pycache__/test_common.cpython-38.pyc
U


W[n�@s�dZddlmZmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZmZmZmZdd	lmZmZmZdd
lmZmZddlmZGdd
�d
e	�ZGdd�de	�ZdS)z$
Tests for L{twisted.names.common}.
�)�division�absolute_import)�verifyClass)�	IResolver)�SynchronousTestCase)�Failure)�ResolverBase)�EFORMAT�ESERVER�ENAME�ENOTIMP�EREFUSED�Query)�DNSFormatError�DNSServerError�DNSNameError)�DNSNotImplementedError�DNSQueryRefusedError)�DNSUnknownErrorc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�ExceptionForCodeTestsz5
    Tests for L{ResolverBase.exceptionForCode}.
    cCst�j|_dS�N)r�exceptionForCode��self�r�@/usr/lib/python3/dist-packages/twisted/names/test/test_common.py�setUpszExceptionForCodeTests.setUpcCs|�|�t�t�dS)zd
        L{ResolverBase.exceptionForCode} converts L{EFORMAT} to
        L{DNSFormatError}.
        N)�assertIsrr	rrrrr�test_eformatsz"ExceptionForCodeTests.test_eformatcCs|�|�t�t�dS)zd
        L{ResolverBase.exceptionForCode} converts L{ESERVER} to
        L{DNSServerError}.
        N)rrr
rrrrr�test_eserver&sz"ExceptionForCodeTests.test_eservercCs|�|�t�t�dS)zX
        L{ResolverBase.exceptionForCode} converts L{ENAME} to L{DNSNameError}.
        N)rrrrrrrr�
test_ename.sz ExceptionForCodeTests.test_enamecCs|�|�t�t�dS)zl
        L{ResolverBase.exceptionForCode} converts L{ENOTIMP} to
        L{DNSNotImplementedError}.
        N)rrrrrrrr�test_enotimp5sz"ExceptionForCodeTests.test_enotimpcCs|�|�t�t�dS)zk
        L{ResolverBase.exceptionForCode} converts L{EREFUSED} to
        L{DNSQueryRefusedError}.
        N)rrr
rrrrr�
test_erefused=sz#ExceptionForCodeTests.test_erefusedcCs|�|�t��t�dS)zr
        L{ResolverBase.exceptionForCode} converts any other response code to
        L{DNSUnknownError}.
        N)rr�objectrrrrr�
test_otherEsz ExceptionForCodeTests.test_otherN)�__name__�
__module__�__qualname__�__doc__rrrr r!r"r$rrrrrsrc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
QueryTestsz*
    Tests for L{ResolverBase.query}.
    cCsttt�dS)zF
        L{ResolverBase} provides the L{IResolver} interface.
        N)rrrrrrr�"test_resolverBaseProvidesIResolverSsz-QueryTests.test_resolverBaseProvidesIResolvercsFg�t�}d�fdd�i|_tddd�}|�|d�|�dg��dS)	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.
        �90cs��||f�Sr)�append��queryZtimeout�Zresultsrr�<lambda>b�z6QueryTests.test_typeToMethodDispatch.<locals>.<lambda>�example.com��name�type�{)r2r6N)r�typeToMethodrr.�assertEqual)r�resolverr.rr/r�test_typeToMethodDispatchZs
�z$QueryTests.test_typeToMethodDispatchcsZt��t�}d�fdd�i|_tddd�}|�|d�}g}|�|j�|��|d�dS)	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�cs�Srrr-�Zexpectedrrr0pr1z4QueryTests.test_typeToMethodResult.<locals>.<lambda>r2r3r6rN)r#rr7rr.�addBothr,r8�rr9r.Z
queryDeferred�resultrr;r�test_typeToMethodResulthsz"QueryTests.test_typeToMethodResultcCsVt�}i|_tddd�}|�|d�}g}|�|j�|�|dt�|d�t	�dS)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.
        r2r+r3r6rN)
rr7rr.r<r,ZassertIsInstancerZtrap�NotImplementedErrorr=rrr�test_unknownQueryTypexsz QueryTests.test_unknownQueryTypeN)r%r&r'r(r*r:r?rArrrrr)Ns
r)N)r(Z
__future__rrZzope.interface.verifyrZtwisted.internet.interfacesrZtwisted.trial.unittestrZtwisted.python.failurerZtwisted.names.commonrZtwisted.names.dnsr	r
rrr
rZtwisted.names.errorrrrrrrrr)rrrr�<module>s 8