+
    DfjJ                         ^ RI t ^ RIt^ RIHt ^ RIHtHtHtHt ^ RI	H
t
 ^ RIHt ^ RIHtHt ]P                   ! 4       '       * t ]P$                   Rt ! R	 R
4      t ! R R]4      t ! R R]]4      t ! R R]]4      t ! R R]]4      t ! R R]]4      t]! ]R4       ! R R]4      4       t]! ]R4       ! R R]]4      4       tR#   ] d    Rt Li ; i)    N)skipIf)HostnameAddressIPv4AddressIPv6AddressUNIXAddress)nativeString)platform)SynchronousTestCaseTestCaseFTc                   8   a  ] tR t^t o R tR tR tR tRtV t	R# )AddressTestCaseMixinc                    V P                  V P                  4       V P                  4       8H  4       V P                  V P                  4       V P                  4       8g  4       R# )z
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_addressComparison+AddressTestCaseMixin.test_addressComparison   sL     	))+t/@/@/BBC**,0A0A0CCD    c                x    V P                  4       pVR/pV P                  W P                  4       ,          4       R# )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_hashAddressTestCaseMixin.test_hash)   3    
   "4L++-./r   c                   V P                  V P                  4       V P                  4       8H  4       V P                  V P                  4       V P                  4       8H  4       V P                  V P                  4       V P                  4       8g  4       V P                  V P                  4       V P                  4       8g  4       R# )zf
Check that comparison operators work correctly on address objects
when a different name is passed in
N)r   r   buildDifferentAddressr   r   s   &r   test_differentNamesComparison2AddressTestCaseMixin.test_differentNamesComparison2   s    
 	**,0J0J0LLM3359J9J9LLM))+t/I/I/KKL2248I8I8KKLr   c                    V P                  V.4      pV P                  V^ ,          R,          \        4       V P                  V^ ,          R,          V4       V P                  \        V4      ^4       R# )zc
Assert that the a DeprecationWarning with the given message was
emitted against the given method.
categorymessageN)flushWarningsassertEqualDeprecationWarninglen)r   
testMethodr&   warningss   &&& r   assertDeprecations'AddressTestCaseMixin.assertDeprecations=   s]    
 %%zl3!Z02DE!Y/9X*r    N)
__name__
__module____qualname____firstlineno__r   r   r"   r-   __static_attributes____classdictcell____classdict__s   @r   r   r      s      	E0	M+ +r   r   c                       ] tR t^HtRtRtR# )IPv4AddressTestCaseMixinr/   N)type%s)host%rportz%d)r0   r1   r2   r3   addressArgSpecr4   r/   r   r   r9   r9   H   s    ENr   r9   c                   4   a  ] tR t^Lt o RtRtR tR tRtV t	R# )HostnameAddressTestsz#
Test case for L{HostnameAddress}.
c                    \        R^ 4      # )z_
Create an arbitrary new L{HostnameAddress} instance.

@return: A L{HostnameAddress} instance.
s   example.comr   r   s   &r   r   !HostnameAddressTests.buildAddressS        ~q11r   c                    \        R^ 4      # )z_
Like L{buildAddress}, but with a different hostname.

@return: A L{HostnameAddress} instance.
s   example.netrE   r   s   &r   r!   *HostnameAddressTests.buildDifferentAddress[   rG   r   r/   N))hostnamer<   r?   )
r0   r1   r2   r3   __doc__rA   r   r!   r4   r5   r6   s   @r   rC   rC   L   s       :N22 2r   rC   c                   ,   a  ] tR t^dt o R tR tRtV tR# )IPv4AddressTCPTestsc                    \        RR^ 4      # )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.1r   r   s   &r   r    IPv4AddressTCPTests.buildAddresse        5+q11r   c                    \        RR^ 4      # );
Like L{buildAddress}, but with a different fixed address.
rO   	127.0.0.2rQ   r   s   &r   r!   )IPv4AddressTCPTests.buildDifferentAddressm        5+q11r   r/   Nr0   r1   r2   r3   r   r!   r4   r5   r6   s   @r   rM   rM   d        22 2r   rM   c                   ,   a  ] tR t^tt o R tR tRtV tR# )IPv4AddressUDPTestsc                    \        RR^ 4      # )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.
UDPrP   rQ   r   s   &r   r    IPv4AddressUDPTests.buildAddressu   rS   r   c                    \        RR^ 4      # )rU   r^   rV   rQ   r   s   &r   r!   )IPv4AddressUDPTests.buildDifferentAddress}   rX   r   r/   NrY   r6   s   @r   r\   r\   t   rZ   r   r\   c                   0   a  ] tR t^t o RtR tR tRtV tR# )IPv6AddressTestsc                    \        RR^ 4      # )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.
rO   z::1r   r   s   &r   r   IPv6AddressTests.buildAddress   s     5%++r   c                    \        RR^ 4      # )rU   rO   z::2re   r   s   &r   r!   &IPv6AddressTests.buildDifferentAddress   s     5%++r   r/   Nr:   )	r0   r1   r2   r3   rA   r   r!   r4   r5   r6   s   @r   rc   rc      s     EN,, ,r   rc   z&Platform doesn't support UNIX sockets.c                   x   a  ] tR t^t o R
tR tR tR tR t]	! ]
R4      R 4       t]	! ]
R4      R 4       tRtV tR	# )UNIXAddressTestsc                Z    V P                  4       V n        V P                  4       V n        R # N)mktemp_socketAddress_otherAddressr   s   &r   setUpUNIXAddressTests.setUp   s    "kkm![[]r   c                ,    \        V P                  4      # )z}
Create an arbitrary new L{UNIXAddress} instance.  A new instance is
created for each call, but always for the same address.
r   rn   r   s   &r   r   UNIXAddressTests.buildAddress   s    
 4..//r   c                ,    \        V P                  4      # )rU   )r   ro   r   s   &r   r!   &UNIXAddressTests.buildDifferentAddress   s     4--..r   c                    V P                  \        V P                  4       4      R\        V P                  4      ,          4       R# )zV
The repr of L{UNIXAddress} returns with the filename that the
L{UNIXAddress} is for.
zUNIXAddress('%s')N)r(   reprr   r   rn   r   s   &r   	test_reprUNIXAddressTests.test_repr   s6    
 	""$%<0C0C#DE	
r   "Platform does not support symlinksc                   V P                  4       p\        V P                  R4      ;_uu_ 4       V n        \        P
                  ! \        P                  P                  V P                  4      V4       V P                  \        V P                  4      \        V4      4       V P                  \        V4      \        V P                  4      4       RRR4       R#   + '       g   i     R# ; i)zE
UNIXAddress objects compare as equal if they link to the same file.
wN)
rm   openrn   fdossymlinkpathabspathr(   r   r   linkNames   & r   test_comparisonOfLinkedFiles-UNIXAddressTests.test_comparisonOfLinkedFiles   s    
 ;;=$%%s++twJJrwwt':':;XF[)<)<={8?TU[2K@S@S4TU ,+++   B CC*	c           
        V P                  4       p\        V P                  R4      ;_uu_ 4       V n        \        P
                  ! \        P                  P                  V P                  4      V4       V P                  \        \        V P                  4      4      \        \        V4      4      4       RRR4       R#   + '       g   i     R# ; i)zE
UNIXAddress Objects that compare as equal have the same hash value.
r}   N)rm   r~   rn   r   r   r   r   r   r(   hashr   r   s   & r   test_hashOfLinkedFiles'UNIXAddressTests.test_hashOfLinkedFiles   s    
 ;;=$%%s++twJJrwwt':':;XF[!4!456[=R8S ,+++s   BB==C	)ro   rn   r   N)namer>   )r0   r1   r2   r3   rA   rp   r   r!   ry   r   symlinkSkipr   r   r4   r5   r6   s   @r   rj   rj      sX     &N+0/
 K=>V ?V K=>	 ?	r   rj   z&platform doesn't support UNIX sockets.c                   ^   a  ] tR t^t o RtR
tR tR tR t]	! ]
R4      R 4       tR tRtV tR	# )EmptyUNIXAddressTestszB
Tests for L{UNIXAddress} operations involving a L{None} address.
c                0    V P                  4       V n        R # rl   )rm   rn   r   s   &r   rp   EmptyUNIXAddressTests.setUp   s    "kkmr   c                    \        R4      # )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   "EmptyUNIXAddressTests.buildAddress   s     4  r   c                ,    \        V P                  4      # )z>
Like L{buildAddress}, but with a random temporary directory.
rs   r   s   &r   r!   +EmptyUNIXAddressTests.buildDifferentAddress   s     4..//r   r{   c                   V P                  4       p\        V P                  R4      ;_uu_ 4       V n        \        P
                  ! \        P                  P                  V P                  4      V4       V P                  \        V P                  4      \        R4      4       V P                  \        R4      \        V P                  4      4       RRR4       R#   + '       g   i     R# ; i)zn
A UNIXAddress referring to a L{None} address does not
compare equal to a UNIXAddress referring to a symlink.
r}   N)
rm   r~   rn   r   r   r   r   r   assertNotEqualr   r   s   & r   r   2EmptyUNIXAddressTests.test_comparisonOfLinkedFiles   s     ;;=$%%s++twJJrwwt':':;XFD,?,? @+dBSTD 1;t?R?R3ST ,+++r   c                x    V P                  4       pVR/pV P                  W P                  4       ,          4       R# )zm
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_emptyHash$EmptyUNIXAddressTests.test_emptyHash   r   r   )rn   r   Nr   )r0   r1   r2   r3   rK   rA   rp   r   r!   r   r   r   r   r4   r5   r6   s   @r   r   r      sH      'N,!0 K=>	U ?	U0 0r   r   )r   socketunittestr   twisted.internet.addressr   r   r   r   twisted.python.compatr   twisted.python.runtimer	   twisted.trial.unittestr
   r   _supportsSymlinksr   AF_UNIXunixSkipAttributeErrorr   r9   rC   rM   r\   rc   rj   r   r/   r   r   <module>r      s  
 
    / + @,,..
NN H(+ (+VF3 F28%9 202-/G 2 2-/G 2 ,*,@ ,$ :;3* 3 <3l :;+0/1E +0 <+0o  Hs   C
 
	CC