§
    ÈtºfJ   ã                   óâ  — d dl Z d dlZd dlmZ d dlmZmZmZmZ d dl	m
Z
 d dlmZ d dlmZmZ  ej        ¦   «          Z	 ej         dZn# e$ r dZY nw xY w G d	„ d
¦  «        Z G d„ de¦  «        Z G d„ dee¦  «        Z G d„ dee¦  «        Z G d„ dee¦  «        Z G d„ dee¦  «        Z eed¦  «         G d„ de¦  «        ¦   «         Z eed¦  «         G d„ dee¦  «        ¦   «         ZdS )é    N)ÚskipIf)ÚHostnameAddressÚIPv4AddressÚIPv6AddressÚUNIXAddress)ÚnativeString)Úplatform)ÚSynchronousTestCaseÚTestCaseFTc                   ó&   — e Zd Zd„ Zd„ Zd„ Zd„ ZdS )ÚAddressTestCaseMixinc                 óú   — |                       |                      ¦   «         |                      ¦   «         k    ¦  «         |                      |                      ¦   «         |                      ¦   «         k    ¦  «         dS )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    úa/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/internet/test/test_address.pyÚtest_addressComparisonz+AddressTestCaseMixin.test_addressComparison   sj   € ð 	�Š˜×)Ò)Ñ+Ô+¨t×/@Ò/@Ñ/BÔ/BÒBÑCÔCÐCØ×Ò˜×*Ò*Ñ,Ô,°×0AÒ0AÑ0CÔ0CÒCÑDÔDÐDÐDÐDó    c                 ó�   — |                       ¦   «         }|di}|                      ||                       ¦   «                  ¦  «         dS )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©r   r   ©r   ÚaddrÚds      r   Ú	test_hashzAddressTestCaseMixin.test_hash)   óG   € ð
 × Ò Ñ"Ô"ˆØ�4ˆLˆØ�Š˜˜$×+Ò+Ñ-Ô-Ô.Ñ/Ô/Ð/Ð/Ð/r   c                 óî  — |                       |                      ¦   «         |                      ¦   «         k    ¦  «         |                       |                      ¦   «         |                      ¦   «         k    ¦  «         |                      |                      ¦   «         |                      ¦   «         k    ¦  «         |                      |                      ¦   «         |                      ¦   «         k    ¦  «         dS )z~
        Check that comparison operators work correctly on address objects
        when a different name is passed in
        N)r   r   ÚbuildDifferentAddressr   r   s    r   Útest_differentNamesComparisonz2AddressTestCaseMixin.test_differentNamesComparison2   sÊ   € ð
 	×Ò˜×*Ò*Ñ,Ô,°×0JÒ0JÑ0LÔ0LÒLÑMÔMÐMØ×Ò˜×3Ò3Ñ5Ô5¸×9JÒ9JÑ9LÔ9LÒLÑMÔMÐMà�Š˜×)Ò)Ñ+Ô+¨t×/IÒ/IÑ/KÔ/KÒKÑLÔLÐLØ�Š˜×2Ò2Ñ4Ô4¸×8IÒ8IÑ8KÔ8KÒKÑLÔLÐLÐLÐLr   c                 ó
  — |                       |g¦  «        }|                      |d         d         t          ¦  «         |                      |d         d         |¦  «         |                      t          |¦  «        d¦  «         dS )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=   sz   € ð
 ×%Ò% z lÑ3Ô3ˆØ×Ò˜ !œ ZÔ0Õ2DÑEÔEÐEØ×Ò˜ !œ YÔ/°Ñ9Ô9Ð9Ø×Ò�˜X™œ¨Ñ*Ô*Ð*Ð*Ð*r   N)Ú__name__Ú
__module__Ú__qualname__r   r   r    r+   © r   r   r   r      sV   € € € € € ð	Eð 	Eð 	Eð0ð 0ð 0ð	Mð 	Mð 	Mð+ð +ð +ð +ð +r   r   c                   ó   — e Zd ZdZdS )ÚIPv4AddressTestCaseMixin©)Útypeú%s)Úhostú%r©Úportz%dN)r,   r-   r.   ÚaddressArgSpecr/   r   r   r1   r1   H   s   € € € € € ØE€N€N€Nr   r1   c                   ó"   — e Zd ZdZdZd„ Zd„ ZdS )ÚHostnameAddressTestsz+
    Test case for L{HostnameAddress}.
    ))Úhostnamer4   r7   c                 ó"   — t          dd¦  «        S )zw
        Create an arbitrary new L{HostnameAddress} instance.

        @return: A L{HostnameAddress} instance.
        s   example.comr   ©r   r   s    r   r   z!HostnameAddressTests.buildAddressS   ó   € õ ˜~¨qÑ1Ô1Ð1r   c                 ó"   — t          dd¦  «        S )zw
        Like L{buildAddress}, but with a different hostname.

        @return: A L{HostnameAddress} instance.
        s   example.netr   r>   r   s    r   r   z*HostnameAddressTests.buildDifferentAddress[   r?   r   N)r,   r-   r.   Ú__doc__r9   r   r   r/   r   r   r;   r;   L   sC   € € € € € ðð ð :€Nð2ð 2ð 2ð2ð 2ð 2ð 2ð 2r   r;   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚIPv4AddressTCPTestsc                 ó$   — t          ddd¦  «        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   ©r   r   s    r   r   z IPv4AddressTCPTests.buildAddresse   ó   € õ ˜5 +¨qÑ1Ô1Ð1r   c                 ó$   — t          ddd¦  «        S )úK
        Like L{buildAddress}, but with a different fixed address.
        rE   ú	127.0.0.2r   rG   r   s    r   r   z)IPv4AddressTCPTests.buildDifferentAddressm   ó   € õ ˜5 +¨qÑ1Ô1Ð1r   N©r,   r-   r.   r   r   r/   r   r   rC   rC   d   ó2   € € € € € ð2ð 2ð 2ð2ð 2ð 2ð 2ð 2r   rC   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚIPv4AddressUDPTestsc                 ó$   — t          ddd¦  «        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.
        ÚUDPrF   r   rG   r   s    r   r   z IPv4AddressUDPTests.buildAddressu   rH   r   c                 ó$   — t          ddd¦  «        S )rJ   rR   rK   r   rG   r   s    r   r   z)IPv4AddressUDPTests.buildDifferentAddress}   rL   r   NrM   r/   r   r   rP   rP   t   rN   r   rP   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚIPv6AddressTestsr2   c                 ó$   — t          ddd¦  «        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.
        rE   z::1r   ©r   r   s    r   r   zIPv6AddressTests.buildAddress‡   s   € õ ˜5 %¨Ñ+Ô+Ð+r   c                 ó$   — t          ddd¦  «        S )rJ   rE   z::2r   rW   r   s    r   r   z&IPv6AddressTests.buildDifferentAddress�   s   € õ ˜5 %¨Ñ+Ô+Ð+r   N)r,   r-   r.   r9   r   r   r/   r   r   rU   rU   „   s7   € € € € € ØE€Nð,ð ,ð ,ð,ð ,ð ,ð ,ð ,r   rU   z&Platform doesn't support UNIX sockets.c                   ó~   — e Zd ZdZd„ Zd„ Zd„ Zd„ Z ee	d¦  «        d„ ¦   «         Z
 ee	d¦  «        d„ ¦   «         Zd	S )
ÚUNIXAddressTests©)Únamer6   c                 ój   — |                       ¦   «         | _        |                       ¦   «         | _        d S ©N)ÚmktempÚ_socketAddressÚ_otherAddressr   s    r   ÚsetUpzUNIXAddressTests.setUpš   s(   € Ø"Ÿkšk™mœmˆÔØ!Ÿ[š[™]œ]ˆÔÐÐr   c                 ó*   — 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.
        ©r   r`   r   s    r   r   zUNIXAddressTests.buildAddressž   s   € õ
 ˜4Ô.Ñ/Ô/Ð/r   c                 ó*   — t          | j        ¦  «        S )rJ   )r   ra   r   s    r   r   z&UNIXAddressTests.buildDifferentAddress¥   s   € õ ˜4Ô-Ñ.Ô.Ð.r   c                 óš   — |                       t          |                      ¦   «         ¦  «        dt          | j        ¦  «        z  ¦  «         dS )zn
        The repr of L{UNIXAddress} returns with the filename that the
        L{UNIXAddress} is for.
        zUNIXAddress('%s')N)r&   Úreprr   r   r`   r   s    r   Ú	test_reprzUNIXAddressTests.test_repr«   sP   € ð
 	×ÒÝ�×"Ò"Ñ$Ô$Ñ%Ô%Ø¥<°Ô0CÑ#DÔ#DÑEñ	
ô 	
ð 	
ð 	
ð 	
r   ú"Platform does not support symlinksc                 óÖ  — |                       ¦   «         }t          | j        d¦  «        5 | _        t	          j        t          j                             | j        ¦  «        |¦  «         |                      t          | j        ¦  «        t          |¦  «        ¦  «         |                      t          |¦  «        t          | j        ¦  «        ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )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•r”w—’ tÔ':Ñ;Ô;¸XÑFÔFÐFØ×Ò�[¨Ô)<Ñ=Ô=½{È8Ñ?TÔ?TÑUÔUÐUØ×Ò�[¨Ñ2Ô2µKÀÔ@SÑ4TÔ4TÑUÔUÐUð	Vð 	Vð 	Vñ 	Vô 	Vð 	Vð 	Vð 	Vð 	Vð 	Vð 	Vð 	Vøøøð 	Vð 	Vð 	Vð 	Vð 	Vð 	Vó   ªB'CÃC"Ã%C"c           	      ó   — |                       ¦   «         }t          | j        d¦  «        5 | _        t	          j        t          j                             | j        ¦  «        |¦  «         |                      t          t          | j        ¦  «        ¦  «        t          t          |¦  «        ¦  «        ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )zU
        UNIXAddress Objects that compare as equal have the same hash value.
        rk   N)r_   rl   r`   rm   rn   ro   rp   rq   r&   Úhashr   rr   s     r   Útest_hashOfLinkedFilesz'UNIXAddressTests.test_hashOfLinkedFilesÀ   sê   € ð
 —;’;‘=”=ˆÝ�$Ô% sÑ+Ô+ð 	¨t¬wÝŒJ•r”w—’ tÔ':Ñ;Ô;¸XÑFÔFÐFØ×ÒÝ•[ Ô!4Ñ5Ô5Ñ6Ô6½½[ÈÑ=RÔ=RÑ8SÔ8Sñô ð ð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð 	ð 	s   ªBCÃCÃ
CN)r,   r-   r.   r9   rb   r   r   rh   r   ÚsymlinkSkiprt   rx   r/   r   r   rZ   rZ   –   sª   € € € € € à&€Nð+ð +ð +ð0ð 0ð 0ð/ð /ð /ð
ð 
ð 
ð €VˆKÐ=Ñ>Ô>ðVð Vñ ?Ô>ðVð €VˆKÐ=Ñ>Ô>ð	ð 	ñ ?Ô>ð	ð 	ð 	r   rZ   z&platform doesn't support UNIX sockets.c                   óX   — e Zd ZdZdZd„ Zd„ Zd„ Z ee	d¦  «        d„ ¦   «         Z
d„ Zd	S )
ÚEmptyUNIXAddressTestszJ
    Tests for L{UNIXAddress} operations involving a L{None} address.
    r[   c                 ó8   — |                       ¦   «         | _        d S r^   )r_   r`   r   s    r   rb   zEmptyUNIXAddressTests.setUpÕ   s   € Ø"Ÿkšk™mœmˆÔÐÐr   c                 ó    — t          d¦  «        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)r   r   s    r   r   z"EmptyUNIXAddressTests.buildAddressØ   s   € õ ˜4Ñ Ô Ð r   c                 ó*   — t          | j        ¦  «        S )zN
        Like L{buildAddress}, but with a random temporary directory.
        rd   r   s    r   r   z+EmptyUNIXAddressTests.buildDifferentAddressà   s   € õ ˜4Ô.Ñ/Ô/Ð/r   ri   c                 óÖ  — |                       ¦   «         }t          | j        d¦  «        5 | _        t	          j        t          j                             | j        ¦  «        |¦  «         |                      t          | j        ¦  «        t          d¦  «        ¦  «         |                      t          d¦  «        t          | j        ¦  «        ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )z†
        A UNIXAddress referring to a L{None} address does not
        compare equal to a UNIXAddress referring to a symlink.
        rk   N)
r_   rl   r`   rm   rn   ro   rp   rq   ÚassertNotEqualr   rr   s     r   rt   z2EmptyUNIXAddressTests.test_comparisonOfLinkedFilesæ   s  € ð —;’;‘=”=ˆÝ�$Ô% sÑ+Ô+ð 	U¨t¬wÝŒJ•r”w—’ tÔ':Ñ;Ô;¸XÑFÔFÐFØ×Ò¥¨DÔ,?Ñ @Ô @Å+ÈdÑBSÔBSÑTÔTÐTØ×Ò¥¨DÑ 1Ô 1µ;¸tÔ?RÑ3SÔ3SÑTÔTÐTð	Uð 	Uð 	Uñ 	Uô 	Uð 	Uð 	Uð 	Uð 	Uð 	Uð 	Uð 	Uøøøð 	Uð 	Uð 	Uð 	Uð 	Uð 	Uru   c                 ó�   — |                       ¦   «         }|di}|                      ||                       ¦   «                  ¦  «         dS )z…
        C{__hash__} can be used to get a hash of an address, even one referring
        to L{None} rather than a real path.
        TNr   r   s      r   Útest_emptyHashz$EmptyUNIXAddressTests.test_emptyHashò   r   r   N)r,   r-   r.   rA   r9   rb   r   r   r   ry   rt   r‚   r/   r   r   r{   r{   Í   s�   € € € € € ðð ð '€Nð,ð ,ð ,ð!ð !ð !ð0ð 0ð 0ð €VˆKÐ=Ñ>Ô>ð	Uð 	Uñ ?Ô>ð	Uð0ð 0ð 0ð 0ð 0r   r{   )rn   ÚsocketÚunittestr   Útwisted.internet.addressr   r   r   r   Útwisted.python.compatr   Útwisted.python.runtimer	   Útwisted.trial.unittestr
   r   Ú_supportsSymlinksry   ÚAF_UNIXÚunixSkipÚAttributeErrorr   r1   r;   rC   rP   rU   rZ   r{   r/   r   r   ú<module>r�      sž  ðð
 
€	€	€	Ø €€€Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð /Ð .Ð .Ð .Ð .Ð .Ø +Ð +Ð +Ð +Ð +Ð +Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @à,�(Ô,Ñ.Ô.Ð.€ðØ
„N€Nð €H€Høð ð ð ð Ø€H€H€Hðøøøð(+ð (+ð (+ð (+ð (+ñ (+ô (+ð (+ðVFð Fð Fð Fð FÐ3ñ Fô Fð Fð2ð 2ð 2ð 2ð 2˜8Ð%9ñ 2ô 2ð 2ð02ð 2ð 2ð 2ð 2Ð-Ð/Gñ 2ô 2ð 2ð 2ð 2ð 2ð 2ð 2Ð-Ð/Gñ 2ô 2ð 2ð ,ð ,ð ,ð ,ð ,Ð*Ð,@ñ ,ô ,ð ,ð$ €ˆÐ:Ñ;Ô;ð3ð 3ð 3ð 3ð 3Ð*ñ 3ô 3ñ <Ô;ð3ðl €ˆÐ:Ñ;Ô;ð+0ð +0ð +0ð +0ð +0Ð/Ð1Eñ +0ô +0ñ <Ô;ð+0ð +0ð +0s   Á A
 Á
AÁA