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/internet/test/__pycache__/test_address.cpython-38.pyc
U


W[�!�@s8ddlmZmZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZddlm
Z
ddlmZe��srdZndZz
ejWnek
r�d	ZYnXdZGd
d�de�ZGdd
�d
e�ZGdd�deje�ZGdd�deje�ZGdd�deje�ZGdd�deje�ZGdd�dej�ZGdd�deje�ZdS)�)�division�absolute_importN)�unittest)�IPv4Address�UNIXAddress�IPv6Address��HostnameAddress)�nativeString)�platformz"Platform does not support symlinksz&Platform doesn't support UNIX sockets.c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�AddressTestCaseMixincCs0|�|��|��k�|�|��|��k�dS)a
        Two different address instances, sharing the same properties are
        considered equal by C{==} and not considered not equal by C{!=}.

        Note: When applied via UNIXAddress class, this uses the same
        filename for both objects being compared.
        N)�
assertTrue�buildAddress�assertFalse��self�r�D/usr/lib/python3/dist-packages/twisted/internet/test/test_address.py�test_addressComparisonsz+AddressTestCaseMixin.test_addressComparisoncCs&|��}|di}|�||���dS)z�
        C{__hash__} can be used to get a hash of an address, allowing
        addresses to be used as keys in dictionaries, for instance.
        TN�rr
�rZaddr�drrr�	test_hash)szAddressTestCaseMixin.test_hashcCs\|�|��|��k�|�|��|��k�|�|��|��k�|�|��|��k�dS)z~
        Check that comparison operators work correctly on address objects
        when a different name is passed in
        N)rr�buildDifferentAddressr
rrrr�test_differentNamesComparison3sz2AddressTestCaseMixin.test_differentNamesComparisoncCsH|�|g�}|�|ddt�|�|dd|�|�t|�d�dS)z{
        Assert that the a DeprecationWarning with the given message was
        emitted against the given method.
        r�category�message�N)Z
flushWarnings�assertEqual�DeprecationWarning�len)rZ
testMethodr�warningsrrr�assertDeprecations?sz'AddressTestCaseMixin.assertDeprecationsN)�__name__�
__module__�__qualname__rrrr"rrrrrs
rc@seZdZdZdS)�IPv4AddressTestCaseMixin�)�type�%s)Zhost�%r�Zportz%dN)r#r$r%�addressArgSpecrrrrr&Ksr&c@s$eZdZdZdZdd�Zdd�ZdS)�HostnameAddressTestsz+
    Test case for L{HostnameAddress}.
    ))Zhostnamer)r+cCs
tdd�S)zw
        Create an arbitrary new L{HostnameAddress} instance.

        @return: A L{HostnameAddress} instance.
        sexample.comrrrrrrrVsz!HostnameAddressTests.buildAddresscCs
tdd�S)zw
        Like L{buildAddress}, but with a different hostname.

        @return: A L{HostnameAddress} instance.
        sexample.netrrrrrrr_sz*HostnameAddressTests.buildDifferentAddressN)r#r$r%�__doc__r,rrrrrrr-Ps	r-c@seZdZdd�Zdd�ZdS)�IPv4AddressTCPTestscCstddd�S)z�
        Create an arbitrary new L{IPv4Address} instance with a C{"TCP"}
        type.  A new instance is created for each call, but always for the
        same address.
        �TCP�	127.0.0.1r�rrrrrrksz IPv4AddressTCPTests.buildAddresscCstddd�S)�K
        Like L{buildAddress}, but with a different fixed address.
        r0�	127.0.0.2rr2rrrrrtsz)IPv4AddressTCPTests.buildDifferentAddressN�r#r$r%rrrrrrr/is	r/c@seZdZdd�Zdd�ZdS)�IPv4AddressUDPTestscCstddd�S)z�
        Create an arbitrary new L{IPv4Address} instance with a C{"UDP"}
        type.  A new instance is created for each call, but always for the
        same address.
        �UDPr1rr2rrrrr~sz IPv4AddressUDPTests.buildAddresscCstddd�S)r3r7r4rr2rrrrr�sz)IPv4AddressUDPTests.buildDifferentAddressNr5rrrrr6|s	r6c@s eZdZdZdd�Zdd�ZdS)�IPv6AddressTestsr'cCstddd�S)z�
        Create an arbitrary new L{IPv6Address} instance with a C{"TCP"}
        type.  A new instance is created for each call, but always for the
        same address.
        r0z::1r�rrrrrr�szIPv6AddressTests.buildAddresscCstddd�S)r3r0z::2rr9rrrrr�sz&IPv6AddressTests.buildDifferentAddressN)r#r$r%r,rrrrrrr8�s	r8c@sXeZdZeZdZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
esBee
_dd
�ZesTee_dS)�UNIXAddressTests�)�namer*cCs|��|_|��|_dS�N)�mktemp�_socketAddress�
_otherAddressrrrr�setUp�s
zUNIXAddressTests.setUpcCs
t|j�S)z�
        Create an arbitrary new L{UNIXAddress} instance.  A new instance is
        created for each call, but always for the same address.
        �rr?rrrrr�szUNIXAddressTests.buildAddresscCs
t|j�S)r3)rr@rrrrr�sz&UNIXAddressTests.buildDifferentAddresscCs"|�t|���dt|j��dS)zn
        The repr of L{UNIXAddress} returns with the filename that the
        L{UNIXAddress} is for.
        zUNIXAddress('%s')N)r�reprrr
r?rrrr�	test_repr�s�zUNIXAddressTests.test_reprc	Csh|��}t|jd��J|_t�tj�|j�|�|�t	|j�t	|��|�t	|�t	|j��W5QRXdS)zU
        UNIXAddress objects compare as equal if they link to the same file.
        �wN)
r>�openr?�fd�os�symlink�path�abspathrr�rZlinkNamerrr�test_comparisonOfLinkedFiles�s�
�z-UNIXAddressTests.test_comparisonOfLinkedFilesc	CsZ|��}t|jd��<|_t�tj�|j�|�|�t	t
|j��t	t
|���W5QRXdS)zU
        UNIXAddress Objects that compare as equal have the same hash value.
        rEN)r>rFr?rGrHrIrJrKr�hashrrLrrr�test_hashOfLinkedFiles�s
�z'UNIXAddressTests.test_hashOfLinkedFilesN)
r#r$r%�unixSkip�skipr,rArrrDrM�symlinkSkiprOrrrrr:�s		r:c@sJeZdZdZeZdZdd�Zdd�Zdd�Z	d	d
�Z
es>ee
_dd�Zd
S)�EmptyUNIXAddressTestszJ
    Tests for L{UNIXAddress} operations involving a L{None} address.
    r;cCs|��|_dSr=)r>r?rrrrrA�szEmptyUNIXAddressTests.setUpcCstd�S)z�
        Create an arbitrary new L{UNIXAddress} instance.  A new instance is
        created for each call, but always for the same address. This builds it
        with a fixed address of L{None}.
        N)rrrrrr�sz"EmptyUNIXAddressTests.buildAddresscCs
t|j�S)zN
        Like L{buildAddress}, but with a random temporary directory.
        rBrrrrr�sz+EmptyUNIXAddressTests.buildDifferentAddressc	Csh|��}t|jd��J|_t�tj�|j�|�|�t	|j�t	d��|�t	d�t	|j��W5QRXdS)z�
        A UNIXAddress referring to a L{None} address does not compare equal to a
        UNIXAddress referring to a symlink.
        rEN)
r>rFr?rGrHrIrJrKZassertNotEqualrrLrrrrM�s�
�z2EmptyUNIXAddressTests.test_comparisonOfLinkedFilescCs&|��}|di}|�||���dS)z�
        C{__hash__} can be used to get a hash of an address, even one referring
        to L{None} rather than a real path.
        TNrrrrr�test_emptyHash
sz$EmptyUNIXAddressTests.test_emptyHashN)
r#r$r%r.rPrQr,rArrrMrRrTrrrrrS�s	rS) Z
__future__rrrHZsocketZ
twisted.trialrZtwisted.internet.addressrrrr	Ztwisted.python.compatr
Ztwisted.python.runtimerZ_supportsSymlinksrRZAF_UNIX�AttributeErrorrP�objectrr&ZTestCaser-ZSynchronousTestCaser/r6r8r:rSrrrr�<module>s:

/��>�