%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�fJ ���ddlZddlZddlmZddlmZmZmZmZddl	m
Z
ddlmZddl
mZmZej �Z	ej$dZGd	�d
�ZGd�de�ZGd
�dee�ZGd�dee�ZGd�dee�ZGd�dee�Zeed�Gd�de��Zeed�Gd�dee��Zy#e$rdZY�~wxYw)�N)�skipIf)�HostnameAddress�IPv4Address�IPv6Address�UNIXAddress)�nativeString)�platform)�SynchronousTestCase�TestCaseFTc�$�eZdZd�Zd�Zd�Zd�Zy)�AddressTestCaseMixinc���|j|j�|j�k(�|j|j�|j�k7�y)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��selfs �D/usr/lib/python3/dist-packages/twisted/internet/test/test_address.py�test_addressComparisonz+AddressTestCaseMixin.test_addressComparisonsL��	
����)�)�+�t�/@�/@�/B�B�C�����*�*�,��0A�0A�0C�C�D�c�p�|j�}|di}|j||j��y)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�r�addr�ds   r�	test_hashzAddressTestCaseMixin.test_hash)�5��
� � �"��
�4�L������$�+�+�-�.�/rc��|j|j�|j�k(�|j|j�|j�k(�|j|j�|j�k7�|j|j�|j�k7�y)z~
        Check that comparison operators work correctly on address objects
        when a different name is passed in
        N)rr�buildDifferentAddressrrs r�test_differentNamesComparisonz2AddressTestCaseMixin.test_differentNamesComparison2s���
	
����*�*�,��0J�0J�0L�L�M�����3�3�5��9J�9J�9L�L�M�����)�)�+�t�/I�/I�/K�K�L�����2�2�4��8I�8I�8K�K�Lrc���|j|g�}|j|ddt�|j|dd|�|jt|�d�y)z{
        Assert that the a DeprecationWarning with the given message was
        emitted against the given method.
        r�category�message�N)�
flushWarnings�assertEqual�DeprecationWarning�len)r�
testMethodr#�warningss    r�assertDeprecationsz'AddressTestCaseMixin.assertDeprecations=s]��
�%�%�z�l�3������!��Z�0�2D�E�����!��Y�/��9�����X���*rN)�__name__�
__module__�__qualname__rrr r+�rrr
r
s��	E�0�	M�+rr
c��eZdZdZy)�IPv4AddressTestCaseMixin�)�type�%s)�host�%r��portz%dN)r,r-r.�addressArgSpecr/rrr1r1Hs��E�Nrr1c� �eZdZdZdZd�Zd�Zy)�HostnameAddressTestsz+
    Test case for L{HostnameAddress}.
    ))�hostnamer4r7c��tdd�S)zw
        Create an arbitrary new L{HostnameAddress} instance.

        @return: A L{HostnameAddress} instance.
        sexample.comr�rrs rrz!HostnameAddressTests.buildAddressS����~�q�1�1rc��tdd�S)zw
        Like L{buildAddress}, but with a different hostname.

        @return: A L{HostnameAddress} instance.
        sexample.netrr>rs rrz*HostnameAddressTests.buildDifferentAddress[r?rN)r,r-r.�__doc__r9rrr/rrr;r;Ls���:�N�2�2rr;c��eZdZd�Zd�Zy)�IPv4AddressTCPTestsc��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�rrs rrz IPv4AddressTCPTests.buildAddresse����5�+�q�1�1rc��tddd�S)�K
        Like L{buildAddress}, but with a different fixed address.
        rE�	127.0.0.2rrGrs rrz)IPv4AddressTCPTests.buildDifferentAddressm����5�+�q�1�1rN�r,r-r.rrr/rrrCrCd���2�2rrCc��eZdZd�Zd�Zy)�IPv4AddressUDPTestsc��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.
        �UDPrFrrGrs rrz IPv4AddressUDPTests.buildAddressurHrc��tddd�S)rJrRrKrrGrs rrz)IPv4AddressUDPTests.buildDifferentAddress}rLrNrMr/rrrPrPtrNrrPc��eZdZdZd�Zd�Zy)�IPv6AddressTestsr2c��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.
        rEz::1r�rrs rrzIPv6AddressTests.buildAddress�s���5�%��+�+rc��tddd�S)rJrEz::2rrWrs rrz&IPv6AddressTests.buildDifferentAddress�s���5�%��+�+rN)r,r-r.r9rrr/rrrUrU�s��E�N�,�,rrUz&Platform doesn't support UNIX sockets.c�d�eZdZdZd�Zd�Zd�Zd�Zee	d�d��Z
ee	d�d��Zy	)
�UNIXAddressTests�)�namer6c�X�|j�|_|j�|_y�N)�mktemp�_socketAddress�
_otherAddressrs r�setUpzUNIXAddressTests.setUp�s��"�k�k�m���!�[�[�]��rc�,�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`rs rrzUNIXAddressTests.buildAddress�s��
�4�.�.�/�/rc�,�t|j�S)rJ)rrars rrz&UNIXAddressTests.buildDifferentAddress�s���4�-�-�.�.rc��|jt|j��dt|j�z�y)zn
        The repr of L{UNIXAddress} returns with the filename that the
        L{UNIXAddress} is for.
        zUNIXAddress('%s')N)r&�reprrrr`rs r�	test_reprzUNIXAddressTests.test_repr�s6��
	
�����"�"�$�%��<��0C�0C�#D�E�	
r�"Platform does not support symlinksc��|j�}t|jd�5|_t	j
tjj|j�|�|jt|j�t|��|jt|�t|j��ddd�y#1swYyxYw)zU
        UNIXAddress objects compare as equal if they link to the same file.
        �wN)
r_�openr`�fd�os�symlink�path�abspathr&r�r�linkNames  r�test_comparisonOfLinkedFilesz-UNIXAddressTests.test_comparisonOfLinkedFiles�s���
�;�;�=��
�$�%�%�s�
+�	V�t�w��J�J�r�w�w���t�':�':�;�X�F����[��)<�)<�=�{�8�?T�U����[��2�K��@S�@S�4T�U�	V�	V�	V���BC�Cc	�~�|j�}t|jd�5|_t	j
tjj|j�|�|jtt|j��tt|���ddd�y#1swYyxYw)zU
        UNIXAddress Objects that compare as equal have the same hash value.
        rkN)r_rlr`rmrnrorprqr&�hashrrrs  r�test_hashOfLinkedFilesz'UNIXAddressTests.test_hashOfLinkedFiles�s���
�;�;�=��
�$�%�%�s�
+�	�t�w��J�J�r�w�w���t�':�':�;�X�F�����[��!4�!4�5�6��[��=R�8S�
�	�	�	�s�BB3�3B<N)r,r-r.r9rbrrrhr�symlinkSkiprtrxr/rrrZrZ�sU��&�N�+�0�/�
��K�=�>�V�?�V��K�=�>�	�?�	rrZz&platform doesn't support UNIX sockets.c�J�eZdZdZdZd�Zd�Zd�Zee	d�d��Z
d�Zy	)
�EmptyUNIXAddressTestszJ
    Tests for L{UNIXAddress} operations involving a L{None} address.
    r[c�.�|j�|_yr^)r_r`rs rrbzEmptyUNIXAddressTests.setUp�s��"�k�k�m��rc��td�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)rrs rrz"EmptyUNIXAddressTests.buildAddress�s���4� � rc�,�t|j�S)zN
        Like L{buildAddress}, but with a random temporary directory.
        rdrs rrz+EmptyUNIXAddressTests.buildDifferentAddress�s���4�.�.�/�/rric��|j�}t|jd�5|_t	j
tjj|j�|�|jt|j�td��|jtd�t|j��ddd�y#1swYyxYw)z�
        A UNIXAddress referring to a L{None} address does not
        compare equal to a UNIXAddress referring to a symlink.
        rkN)
r_rlr`rmrnrorprq�assertNotEqualrrrs  rrtz2EmptyUNIXAddressTests.test_comparisonOfLinkedFiles�s����;�;�=��
�$�%�%�s�
+�	U�t�w��J�J�r�w�w���t�':�':�;�X�F�����D�,?�,?� @�+�d�BS�T�����D� 1�;�t�?R�?R�3S�T�	U�	U�	U�ruc�p�|j�}|di}|j||j��y)z�
        C{__hash__} can be used to get a hash of an address, even one referring
        to L{None} rather than a real path.
        TNrrs   r�test_emptyHashz$EmptyUNIXAddressTests.test_emptyHash�rrN)r,r-r.rAr9rbrrrryrtr�r/rrr{r{�s@���'�N�,�!�0��K�=�>�	U�?�	U�0rr{)rn�socket�unittestr�twisted.internet.addressrrrr�twisted.python.compatr�twisted.python.runtimer	�twisted.trial.unittestr
r�_supportsSymlinksry�AF_UNIX�unixSkip�AttributeErrorr
r1r;rCrPrUrZr{r/rr�<module>r�s��

�
����/�+�@�,�(�,�,�.�.���
�N�N��H�(+�(+�VF�3�F�2�8�%9�2�0
2�-�/G�
2� 
2�-�/G�
2� ,�*�,@�,�$��:�;�3�*�3�<�3�l��:�;�+0�/�1E�+0�<�+0��o���H��s�C�C�C

Zerion Mini Shell 1.0