§
    ÈtºfýA  ã                   ó  — d Z ddlZddlZddlZddlZddlmZ ddlmZm	Z	m
Z
mZmZmZmZmZ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  G d„ d	e¦  «        Z G d
„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Ze G d„ d¦  «        ¦   «         Z G d„ de¦  «        Z  G d„ de¦  «        Z! G d„ de¦  «        Z" G d„ de¦  «        Z# G d„ de¦  «        Z$ G d„ de¦  «        Z% G d„ de¦  «        Z& G d „ d!e¦  «        Z'dS )"z%
Tests for L{twisted.python.compat}.
é    N)ÚskipIf)Ú_PYPYÚbytesEnvironÚcmpÚ
comparableÚexecfileÚ
intToBytesÚioTypeÚ	iterbytesÚlazyByteSliceÚnativeStringÚnetworkStringÚreraise)ÚFilePath)Úplatform)ÚSynchronousTestCaseÚTestCasec                   ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚIOTypeTestsz?
    Test cases for determining a file-like object's type.
    c                 óx   — |                       t          t          j        ¦   «         ¦  «        t          ¦  «         dS )z=
        An L{io.StringIO} accepts and returns text.
        N)ÚassertEqualr
   ÚioÚStringIOÚstr©Úselfs    úW/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/test/test_compat.pyÚtest_3StringIOzIOTypeTests.test_3StringIO(   s.   € ð 	×Ò�¥¤¡¤Ñ.Ô.µÑ4Ô4Ð4Ð4Ð4ó    c                 óx   — |                       t          t          j        ¦   «         ¦  «        t          ¦  «         dS )z=
        An L{io.BytesIO} accepts and returns bytes.
        N)r   r
   r   ÚBytesIOÚbytesr   s    r   Útest_3BytesIOzIOTypeTests.test_3BytesIO.   s.   € ð 	×Ò�¥¤
¡¤Ñ-Ô-­uÑ5Ô5Ð5Ð5Ð5r   c                 óÌ   — t          |                      ¦   «         d¦  «        5 }|                      t          |¦  «        t          ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )zT
        A file opened via 'io.open' in text mode accepts and returns text.
        ÚwN)ÚopenÚmktempr   r
   r   ©r   Úfs     r   Útest_3openTextModezIOTypeTests.test_3openTextMode4   s™   € õ �$—+’+‘-”- Ñ%Ô%ð 	-¨Ø×Ò�V A™YœY­Ñ,Ô,Ð,ð	-ð 	-ð 	-ñ 	-ô 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-øøøð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ó   £)AÁAÁ Ac                 óÌ   — t          |                      ¦   «         d¦  «        5 }|                      t          |¦  «        t          ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )zW
        A file opened via 'io.open' in binary mode accepts and returns bytes.
        ÚwbN)r&   r'   r   r
   r"   r(   s     r   Útest_3openBinaryModez IOTypeTests.test_3openBinaryMode;   s™   € õ �$—+’+‘-”- Ñ&Ô&ð 	/¨!Ø×Ò�V A™YœY­Ñ.Ô.Ð.ð	/ð 	/ð 	/ñ 	/ô 	/ð 	/ð 	/ð 	/ð 	/ð 	/ð 	/ð 	/øøøð 	/ð 	/ð 	/ð 	/ð 	/ð 	/r+   c                 óÖ   — t          j        |                      ¦   «         d¦  «        5 }|                      t	          |¦  «        t
          ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )z�
        The L{codecs} module, oddly, returns a file-like object which returns
        bytes when not passed an 'encoding' argument.
        r-   N)Úcodecsr&   r'   r   r
   r"   r(   s     r   Útest_codecsOpenBytesz IOTypeTests.test_codecsOpenBytesB   s›   € õ
 Œ[˜Ÿš™œ¨Ñ-Ô-ð 	/°Ø×Ò�V A™YœY­Ñ.Ô.Ð.ð	/ð 	/ð 	/ñ 	/ô 	/ð 	/ð 	/ð 	/ð 	/ð 	/ð 	/ð 	/øøøð 	/ð 	/ð 	/ð 	/ð 	/ð 	/s   ¨)AÁA"Á%A"c                 óÚ   — t          j        |                      ¦   «         dd¬¦  «        5 }|                      t	          |¦  «        t
          ¦  «         ddd¦  «         dS # 1 swxY w Y   dS )zY
        When passed an encoding, however, the L{codecs} module returns unicode.
        r-   úutf-8)ÚencodingN)r0   r&   r'   r   r
   r   r(   s     r   Útest_codecsOpenTextzIOTypeTests.test_codecsOpenTextJ   s    € õ Œ[˜Ÿš™œ¨°wÐ?Ñ?Ô?ð 	-À1Ø×Ò�V A™YœY­Ñ,Ô,Ð,ð	-ð 	-ð 	-ñ 	-ô 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-øøøð 	-ð 	-ð 	-ð 	-ð 	-ð 	-s   ª)A Á A$Á'A$c                 ón   — |                       t          t          ¦   «         ¦  «        t          ¦  «         dS )zy
        When passed an object about which no sensible decision can be made, err
        on the side of unicode.
        N)r   r
   Úobjectr   r   s    r   Útest_defaultToTextzIOTypeTests.test_defaultToTextQ   s,   € ð
 	×Ò�¥¡¤Ñ)Ô)­3Ñ/Ô/Ð/Ð/Ð/r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r#   r*   r.   r1   r5   r8   © r   r   r   r   #   s‡   € € € € € ðð ð5ð 5ð 5ð6ð 6ð 6ð-ð -ð -ð/ð /ð /ð/ð /ð /ð-ð -ð -ð0ð 0ð 0ð 0ð 0r   r   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚCompatTestszy
    Various utility functions in C{twisted.python.compat} provide same
    functionality as modern Python variants.
    c                 óˆ  — t          ¦   «         }|                     d¦  «         |                     d¦  «         |                     d¦  «         t          |¦  «        }|                     ¦   «          |                      |g d¢¦  «         |                     d¦  «         t          |¦  «        }|                     ¦   «          |                      |ddg¦  «         |                     d¦  «         ddh}|                     |¦  «        }t          |¦  «        }|                     ¦   «          |                      |g d¢¦  «         d	S )
zG
        L{set} should behave like the expected set interface.
        ÚbÚcÚa)rC   rA   rB   ÚdÚrÚs)rC   rB   rE   rF   N)ÚsetÚaddÚlistÚsortr   ÚremoveÚdiscardÚunion©r   rC   rA   rD   s       r   Útest_setzCompatTests.test_set_   s  € õ ‰EŒEˆØ	�Šˆc‰
Œ
ˆ
Ø	�Šˆc‰
Œ
ˆ
Ø	�Šˆc‰
Œ
ˆ
Ý�‰GŒGˆØ	�Š‰ŒˆØ×Ò˜˜O˜O˜OÑ,Ô,Ð,Ø	�Š�‰ŒˆÝ�‰GŒGˆØ	�Š‰ŒˆØ×Ò˜˜S #˜JÑ'Ô'Ð'à	�	Š	�#‰Œˆà�#ˆJˆØ�GŠG�A‰JŒJˆÝ�‰GŒGˆØ	�Š‰ŒˆØ×Ò˜Ð0Ð0Ð0Ñ1Ô1Ð1Ð1Ð1r   c                 óx  — t          ddg¦  «        }|                      t          t          |d¦  «         |                      t          |¦  «        ddg¦  «         t          ddg¦  «        }|                     |¦  «        }t          |¦  «        }|                     ¦   «          |                      |g d¢¦  «         dS )zS
        L{frozenset} should behave like the expected frozenset interface.
        rC   rA   rH   rE   rF   )rC   rA   rE   rF   N)	Ú	frozensetÚassertRaisesÚAttributeErrorÚgetattrr   ÚsortedrM   rI   rJ   rN   s       r   Útest_frozensetzCompatTests.test_frozensetw   sª   € õ �s˜C�jÑ!Ô!ˆØ×Ò�.­'°1°eÑ<Ô<Ð<Ø×Ò� ™œ S¨# JÑ/Ô/Ð/å�s˜C�jÑ!Ô!ˆØ�GŠG�A‰JŒJˆÝ�‰GŒGˆØ	�Š‰ŒˆØ×Ò˜Ð0Ð0Ð0Ñ1Ô1Ð1Ð1Ð1r   N)r9   r:   r;   r<   rO   rV   r=   r   r   r?   r?   Y   s<   € € € € € ðð ð
2ð 2ð 2ð02ð 2ð 2ð 2ð 2r   r?   c                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚExecfileCompatTestszE
    Tests for the Python 3-friendly L{execfile} implementation.
    c                 ó  — |                       ¦   «         }t          |d¦  «        5 }|                     |                     d¦  «        ¦  «         ddd¦  «         n# 1 swxY w Y   t	          |                     d¦  «        ¦  «        S )zo
        Write L{content} to a new temporary file, returning the L{FilePath}
        for the new file.
        r-   ÚasciiNr3   )r'   r&   ÚwriteÚencoder   )r   ÚcontentÚpathr)   s       r   ÚwriteScriptzExecfileCompatTests.writeScript‹   s«   € ð
 �{Š{‰}Œ}ˆÝ�$˜ÑÔð 	- Ø�GŠG�G—N’N 7Ñ+Ô+Ñ,Ô,Ð,ð	-ð 	-ð 	-ñ 	-ô 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-øøøð 	-ð 	-ð 	-ð 	-å˜Ÿš GÑ,Ô,Ñ-Ô-Ð-s   ¥)AÁAÁ!Ac                 óš   — |                       d¦  «        }ddi}t          |j        |¦  «         |                      d|d         ¦  «         dS )zX
        L{execfile} executes the specified file in the given global namespace.
        ú	foo += 1
Úfooé   é   N©r_   r   r^   r   )r   ÚscriptÚglobalNamespaces      r   Útest_execfileGlobalsz(ExecfileCompatTests.test_execfileGlobals•   sS   € ð ×!Ò! ,Ñ/Ô/ˆØ  !˜*ˆÝ�”˜oÑ.Ô.Ð.Ø×Ò˜˜O¨EÔ2Ñ3Ô3Ð3Ð3Ð3r   c                 óÜ   — |                       d¦  «        }ddi}ddi}t          |j        ||¦  «         |                      d|d         ¦  «         |                      d|d         ¦  «         dS )zk
        L{execfile} executes the specified file in the given global and local
        namespaces.
        ra   rb   é
   é   é   Nre   )r   rf   rg   ÚlocalNamespaces       r   Útest_execfileGlobalsAndLocalsz1ExecfileCompatTests.test_execfileGlobalsAndLocalsž   sy   € ð
 ×!Ò! ,Ñ/Ô/ˆØ  "˜+ˆØ ˜ˆÝ�”˜o¨~Ñ>Ô>Ð>Ø×Ò˜˜_¨UÔ3Ñ4Ô4Ð4Ø×Ò˜˜^¨EÔ2Ñ3Ô3Ð3Ð3Ð3r   c                 óª   — dD ]O}|                       d|z   ¦  «        }ddi}t          |j        |¦  «         |                      d|d         ¦  «         ŒPdS )z˜
        L{execfile} reads in the specified file using universal newlines so
        that scripts written on one platform will work on another.
        )ú
úz
zfoo = 'okay'rb   NÚokayre   )r   Ú
lineEndingrf   rg   s       r   Útest_execfileUniversalNewlinesz2ExecfileCompatTests.test_execfileUniversalNewlinesª   sn   € ð
 -ð 	=ð 	=ˆJØ×%Ò% n°zÑ&AÑBÔBˆFØ$ d˜mˆOÝ�V”[ /Ñ2Ô2Ð2Ø×Ò˜V _°UÔ%;Ñ<Ô<Ð<Ð<ð		=ð 	=r   N)r9   r:   r;   r<   r_   rh   rn   rt   r=   r   r   rX   rX   †   sZ   € € € € € ðð ð.ð .ð .ð4ð 4ð 4ð
4ð 
4ð 
4ð	=ð 	=ð 	=ð 	=ð 	=r   rX   c                   ó   — e Zd ZdZd„ ZdS )ÚPYPYTestz!
    Identification of PyPy.
    c                 óŽ   — dt           j        v r|                      t          ¦  «         dS |                      t          ¦  «         dS )z,
        On PyPy, L{_PYPY} is True.
        ÚPyPyN)ÚsysÚversionÚ
assertTruer   ÚassertFalser   s    r   Ú	test_PYPYzPYPYTest.test_PYPY»   sC   € ð •S”[Ð Ð Ø�OŠO�EÑ"Ô"Ð"Ð"Ð"à×Ò�UÑ#Ô#Ð#Ð#Ð#r   N)r9   r:   r;   r<   r}   r=   r   r   rv   rv   ¶   s-   € € € € € ðð ð$ð $ð $ð $ð $r   rv   c                   ó   — e Zd ZdZd„ Zd„ ZdS )Ú
ComparablezE
    Objects that can be compared to each other, but not others.
    c                 ó   — || _         d S ©N)Úvalue)r   r‚   s     r   Ú__init__zComparable.__init__Ë   s   € ØˆŒ
ˆ
ˆ
r   c                 ón   — t          |t          ¦  «        st          S t          | j        |j        ¦  «        S r�   )Ú
isinstancer   ÚNotImplementedr   r‚   )r   Úothers     r   Ú__cmp__zComparable.__cmp__Î   s.   € Ý˜%¥Ñ,Ô,ð 	"Ý!Ð!Ý�4”:˜uœ{Ñ+Ô+Ð+r   N)r9   r:   r;   r<   rƒ   rˆ   r=   r   r   r   r   Å   s<   € € € € € ðð ðð ð ð,ð ,ð ,ð ,ð ,r   r   c                   ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	ÚComparableTestszR
    L{comparable} decorated classes emulate Python 2's C{__cmp__} semantics.
    c                 óÒ   — |                       t          d¦  «        t          d¦  «        k    ¦  «         |                      t          d¦  «        t          d¦  «        k    ¦  «         dS )zo
        Instances of a class that is decorated by C{comparable} support
        equality comparisons.
        rc   rd   N©r{   r   r|   r   s    r   Útest_equalityzComparableTests.test_equalityÙ   sR   € ð 	�Š�
 1™œ­°A©¬Ò6Ñ7Ô7Ð7Ø×Ò� A™œ­*°Q©-¬-Ò7Ñ8Ô8Ð8Ð8Ð8r   c                 óÒ   — |                       t          d¦  «        t          d¦  «        k    ¦  «         |                      t          d¦  «        t          d¦  «        k    ¦  «         dS )zq
        Instances of a class that is decorated by C{comparable} support
        inequality comparisons.
        rc   rd   N)r|   r   r{   r   s    r   Útest_nonEqualityz ComparableTests.test_nonEqualityâ   sR   € ð 	×Ò� A™œ­*°Q©-¬-Ò7Ñ8Ô8Ð8Ø�Š�
 1™œ­°A©¬Ò6Ñ7Ô7Ð7Ð7Ð7r   c                 óÒ   — |                       t          d¦  «        t          d¦  «        k    ¦  «         |                      t          d¦  «        t          d¦  «        k    ¦  «         dS )zs
        Instances of a class that is decorated by C{comparable} support
        greater-than comparisons.
        rd   rc   r   é   NrŒ   r   s    r   Útest_greaterThanz ComparableTests.test_greaterThanë   óR   € ð
 	�Š�
 1™œ­
°1©¬Ò5Ñ6Ô6Ð6Ø×Ò� A™œ­°A©¬Ò6Ñ7Ô7Ð7Ð7Ð7r   c                 ó8  — |                       t          d¦  «        t          d¦  «        k    ¦  «         |                       t          d¦  «        t          d¦  «        k    ¦  «         |                      t          d¦  «        t          d¦  «        k    ¦  «         dS )z|
        Instances of a class that is decorated by C{comparable} support
        greater-than-or-equal comparisons.
        rc   rd   r   r‘   NrŒ   r   s    r   Útest_greaterThanOrEqualz'ComparableTests.test_greaterThanOrEqualó   óu   € ð
 	�Š�
 1™œ­°A©¬Ò6Ñ7Ô7Ð7Ø�Š�
 1™œ­°A©¬Ò6Ñ7Ô7Ð7Ø×Ò� A™œ­*°Q©-¬-Ò7Ñ8Ô8Ð8Ð8Ð8r   c                 óÒ   — |                       t          d¦  «        t          d¦  «        k     ¦  «         |                      t          d¦  «        t          d¦  «        k     ¦  «         dS )zp
        Instances of a class that is decorated by C{comparable} support
        less-than comparisons.
        r   r‘   rd   NrŒ   r   s    r   Útest_lessThanzComparableTests.test_lessThanü   r“   r   c                 ó8  — |                       t          d¦  «        t          d¦  «        k    ¦  «         |                       t          d¦  «        t          d¦  «        k    ¦  «         |                      t          d¦  «        t          d¦  «        k    ¦  «         dS )zy
        Instances of a class that is decorated by C{comparable} support
        less-than-or-equal comparisons.
        r‘   r   rd   NrŒ   r   s    r   Útest_lessThanOrEqualz$ComparableTests.test_lessThanOrEqual  r–   r   N)
r9   r:   r;   r<   r�   r�   r’   r•   r˜   rš   r=   r   r   rŠ   rŠ   Ô   sx   € € € € € ðð ð9ð 9ð 9ð8ð 8ð 8ð8ð 8ð 8ð9ð 9ð 9ð8ð 8ð 8ð9ð 9ð 9ð 9ð 9r   rŠ   c                   ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	ÚPython3ComparableTestsz;
    Python 3-specific functionality of C{comparable}.
    c                 ó”   — |                       t          d¦  «                             t          ¦   «         ¦  «        t          ¦  «         dS )zÁ
        Instances of a class that is decorated by C{comparable} support
        returning C{NotImplemented} from C{__eq__} if it is returned by the
        underlying C{__cmp__} call.
        rc   N)r   r   Ú__eq__r7   r†   r   s    r   Útest_notImplementedEqualsz0Python3ComparableTests.test_notImplementedEquals  ó8   € ð 	×Ò� A™œ×-Ò-­f©h¬hÑ7Ô7½ÑHÔHÐHÐHÐHr   c                 ó”   — |                       t          d¦  «                             t          ¦   «         ¦  «        t          ¦  «         dS )zÁ
        Instances of a class that is decorated by C{comparable} support
        returning C{NotImplemented} from C{__ne__} if it is returned by the
        underlying C{__cmp__} call.
        rc   N)r   r   Ú__ne__r7   r†   r   s    r   Útest_notImplementedNotEqualsz3Python3ComparableTests.test_notImplementedNotEquals  r    r   c                 ó”   — |                       t          d¦  «                             t          ¦   «         ¦  «        t          ¦  «         dS )zÁ
        Instances of a class that is decorated by C{comparable} support
        returning C{NotImplemented} from C{__gt__} if it is returned by the
        underlying C{__cmp__} call.
        rc   N)r   r   Ú__gt__r7   r†   r   s    r   Útest_notImplementedGreaterThanz5Python3ComparableTests.test_notImplementedGreaterThan#  r    r   c                 ó”   — |                       t          d¦  «                             t          ¦   «         ¦  «        t          ¦  «         dS )zÁ
        Instances of a class that is decorated by C{comparable} support
        returning C{NotImplemented} from C{__lt__} if it is returned by the
        underlying C{__cmp__} call.
        rc   N)r   r   Ú__lt__r7   r†   r   s    r   Útest_notImplementedLessThanz2Python3ComparableTests.test_notImplementedLessThan+  r    r   c                 ó”   — |                       t          d¦  «                             t          ¦   «         ¦  «        t          ¦  «         dS )zÁ
        Instances of a class that is decorated by C{comparable} support
        returning C{NotImplemented} from C{__ge__} if it is returned by the
        underlying C{__cmp__} call.
        rc   N)r   r   Ú__ge__r7   r†   r   s    r   Ú$test_notImplementedGreaterThanEqualsz;Python3ComparableTests.test_notImplementedGreaterThanEquals3  r    r   c                 ó”   — |                       t          d¦  «                             t          ¦   «         ¦  «        t          ¦  «         dS )zÁ
        Instances of a class that is decorated by C{comparable} support
        returning C{NotImplemented} from C{__le__} if it is returned by the
        underlying C{__cmp__} call.
        rc   N)r   r   Ú__le__r7   r†   r   s    r   Ú!test_notImplementedLessThanEqualsz8Python3ComparableTests.test_notImplementedLessThanEquals;  r    r   N)
r9   r:   r;   r<   rŸ   r£   r¦   r©   r¬   r¯   r=   r   r   rœ   rœ     sŒ   € € € € € ðð ðIð Ið IðIð Ið IðIð Ið IðIð Ið IðIð Ið IðIð Ið Ið Ið Ir   rœ   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚCmpTestszA
    L{cmp} should behave like the built-in Python 2 C{cmp}.
    c                 óâ   — |                       t          dd¦  «        d¦  «         |                       t          dd¦  «        d¦  «         |                       t          dgdg¦  «        d¦  «         dS )z5
        L{cmp} returns 0 for equal objects.
        rC   r   rc   N©r   r   r   s    r   Útest_equalszCmpTests.test_equalsI  sh   € ð 	×Ò�˜S #™œ¨Ñ*Ô*Ð*Ø×Ò�˜Q ™œ AÑ&Ô&Ð&Ø×Ò�˜a˜S 1 #™œ¨Ñ*Ô*Ð*Ð*Ð*r   c                 ó–   — |                       t          dd¦  «        d¦  «         |                       t          dd¦  «        d¦  «         dS )zS
        L{cmp} returns 1 if its first argument is bigger than its second.
        é   r   rc   ó   zó   aNr³   r   s    r   r’   zCmpTests.test_greaterThanQ  sF   € ð 	×Ò�˜Q ™œ AÑ&Ô&Ð&Ø×Ò�˜T 4™œ¨!Ñ,Ô,Ð,Ð,Ð,r   c                 ó–   — |                       t          dd¦  «        d¦  «         |                       t          dd¦  «        d¦  «         dS )zU
        L{cmp} returns -1 if its first argument is smaller than its second.
        gš™™™™™¹?gffffff@éÿÿÿÿr¸   ó   dNr³   r   s    r   r˜   zCmpTests.test_lessThanX  sF   € ð 	×Ò�˜S #™œ¨Ñ+Ô+Ð+Ø×Ò�˜T 4™œ¨"Ñ-Ô-Ð-Ð-Ð-r   N)r9   r:   r;   r<   r´   r’   r˜   r=   r   r   r±   r±   D  sK   € € € € € ðð ð+ð +ð +ð-ð -ð -ð.ð .ð .ð .ð .r   r±   c                   ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚStringTestsz8
    Compatibility functions and types for strings.
    c                 óœ   — |                       t          |¦  «        |¦  «         |                      t          |¦  «        t          ¦  «         dS )z¶
        Raise an exception indicating a failed test if the output of
        C{nativeString(original)} is unequal to the expected string, or is not
        a native string.
        N)r   r   ÚassertIsInstancer   )r   ÚoriginalÚexpecteds      r   ÚassertNativeStringzStringTests.assertNativeStringe  sF   € ð 	×Ò� hÑ/Ô/°Ñ:Ô:Ð:Ø×Ò�l¨8Ñ4Ô4µcÑ:Ô:Ð:Ð:Ð:r   c                 óH   — |                       t          t          d¦  «         dS )zj
        C{nativeString} raises a C{UnicodeError} if input bytes are not ASCII
        decodable.
        ó   ÿN©rR   ÚUnicodeErrorr   r   s    r   Útest_nonASCIIBytesToStringz&StringTests.test_nonASCIIBytesToStringn  s"   € ð
 	×Ò�,­°gÑ>Ô>Ð>Ð>Ð>r   c                 óH   — |                       t          t          d¦  «         dS )zk
        C{nativeString} raises a C{UnicodeError} if input Unicode is not ASCII
        encodable.
        u   áˆ´NrÅ   r   s    r   Útest_nonASCIIUnicodeToStringz(StringTests.test_nonASCIIUnicodeToStringu  s"   € ð
 	×Ò�,­°hÑ?Ô?Ð?Ð?Ð?r   c                 ó2   — |                       dd¦  «         dS )z
        C{nativeString} converts bytes to the native string format, assuming
        an ASCII encoding if applicable.
        s   helloÚhelloN©rÂ   r   s    r   Útest_bytesToStringzStringTests.test_bytesToString|  s    € ð
 	×Ò ¨'Ñ2Ô2Ð2Ð2Ð2r   c                 ó2   — |                       dd¦  «         dS )z�
        C{nativeString} converts unicode to the native string format, assuming
        an ASCII encoding if applicable.
        zGood dayNrÌ   r   s    r   Útest_unicodeToStringz StringTests.test_unicodeToStringƒ  s    € ð
 	×Ò 
¨JÑ7Ô7Ð7Ð7Ð7r   c                 ó2   — |                       dd¦  «         dS )zJ
        C{nativeString} leaves native strings as native strings.
        zHello!NrÌ   r   s    r   Útest_stringToStringzStringTests.test_stringToStringŠ  s    € ð 	×Ò ¨(Ñ3Ô3Ð3Ð3Ð3r   c                 óH   — |                       t          t          d¦  «         dS )zu
        C{nativeString} raises a C{TypeError} if given an object that is not a
        string of some sort.
        rc   N)rR   Ú	TypeErrorr   r   s    r   Útest_unexpectedTypezStringTests.test_unexpectedType�  s"   € ð
 	×Ò�)¥\°1Ñ5Ô5Ð5Ð5Ð5r   N)r9   r:   r;   r<   rÂ   rÇ   rÉ   rÍ   rÏ   rÑ   rÔ   r=   r   r   r½   r½   `  sŠ   € € € € € ðð ð;ð ;ð ;ð?ð ?ð ?ð@ð @ð @ð3ð 3ð 3ð8ð 8ð 8ð4ð 4ð 4ð6ð 6ð 6ð 6ð 6r   r½   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚNetworkStringTestsz%
    Tests for L{networkString}.
    c                 óL   — |                       dt          d¦  «        ¦  «         dS )zu
        L{networkString} returns a C{unicode} object passed to it encoded into
        a C{bytes} instance.
        s   foorb   N)r   r   r   s    r   Útest_strzNetworkStringTests.test_str�  s(   € ð
 	×Ò˜¥¨uÑ!5Ô!5Ñ6Ô6Ð6Ð6Ð6r   c                 óH   — |                       t          t          d¦  «         dS )z�
        L{networkString} raises L{UnicodeError} if passed a C{unicode} instance
        containing characters not encodable in ASCII.
        u   â˜ƒN)rR   rÆ   r   r   s    r   Útest_unicodeOutOfRangez)NetworkStringTests.test_unicodeOutOfRange¤  s"   € ð
 	×Ò�,­°}ÑEÔEÐEÐEÐEr   c                 ó¢   — |                       t          t          t          ¦   «         ¦  «         |                       t          t          d¦  «         dS )z€
        L{networkString} raises L{TypeError} if passed a non-string object or
        the wrong type of string object.
        s   bytesN)rR   rÓ   r   r7   r   s    r   Útest_nonStringz!NetworkStringTests.test_nonString«  s>   € ð
 	×Ò�)¥]µF±H´HÑ=Ô=Ð=Ø×Ò�)¥]°HÑ=Ô=Ð=Ð=Ð=r   N)r9   r:   r;   r<   rØ   rÚ   rÜ   r=   r   r   rÖ   rÖ   ˜  sN   € € € € € ðð ð7ð 7ð 7ðFð Fð Fð>ð >ð >ð >ð >r   rÖ   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚReraiseTestszH
    L{reraise} re-raises exceptions on both Python 2 and Python 3.
    c                 óì  — 	 ddz   n'# t           $ r t          j        ¦   «         \  }}}Y nw xY w	 t          |d¦  «         |                      d¦  «         dS # t           $ r’ t          j        ¦   «         \  }}}|                      |t          ¦  «         |                      ||¦  «         |                      t          j
        |¦  «        d         t          j
        |¦  «        d         ¦  «         Y dS w xY w)z…
        Calling L{reraise} with an exception instance and a traceback of
        L{None} re-raises it with a new traceback.
        rc   r   NúThe exception was not raised.rº   )ÚBaseExceptionry   Úexc_infor   Úfailr   ÚZeroDivisionErrorÚassertIsÚassertNotEqualÚ	tracebackÚ	format_tb©r   Útypr‚   ÚtbÚtyp2Úvalue2Útb2s          r   Útest_reraiseWithNonez!ReraiseTests.test_reraiseWithNone¹  s  € ð
	,Ø�‰EˆEˆEøÝð 	,ð 	,ð 	,Ý œ\™^œ^‰NˆC�˜˜˜ð	,øøøð
	7Ý�E˜4Ñ Ô Ð ð �IŠIÐ5Ñ6Ô6Ð6Ð6Ð6øõ ð 	ð 	ð 	Ý #¤¡¤ÑˆD�&˜#Ø×Ò˜TÕ#4Ñ5Ô5Ð5Ø�MŠM˜% Ñ(Ô(Ð(Ø×ÒÝÔ# BÑ'Ô'¨Ô+­YÔ-@ÀÑ-EÔ-EÀbÔ-Iñô ð ð ð ð ð		øøøó   ‚ ˆ!,«,°A ÁBC3Ã2C3c                 óì  — 	 ddz   n'# t           $ r t          j        ¦   «         \  }}}Y nw xY w	 t          ||¦  «         |                      d¦  «         dS # t           $ r’ t          j        ¦   «         \  }}}|                      |t          ¦  «         |                      ||¦  «         |                      t          j	        |¦  «        d         t          j	        |¦  «        d         ¦  «         Y dS w xY w)z‰
        Calling L{reraise} with an exception instance and a traceback
        re-raises the exception with the given traceback.
        rc   r   rà   rº   N)
rá   ry   râ   r   rã   r   rä   rå   rç   rè   ré   s          r   Útest_reraiseWithTracebackz&ReraiseTests.test_reraiseWithTracebackÎ  s  € ð
	,Ø�‰EˆEˆEøÝð 	,ð 	,ð 	,Ý œ\™^œ^‰NˆC�˜˜˜ð	,øøøð	7Ý�E˜2ÑÔÐð �IŠIÐ5Ñ6Ô6Ð6Ð6Ð6øõ ð 	Xð 	Xð 	XÝ #¤¡¤ÑˆD�&˜#Ø×Ò˜TÕ#4Ñ5Ô5Ð5Ø�MŠM˜% Ñ(Ô(Ð(Ø×Ò�YÔ0°Ñ4Ô4°RÔ8½)Ô:MÈcÑ:RÔ:RÐSUÔ:VÑWÔWÐWÐWÐWÐWð		Xøøørð   N)r9   r:   r;   r<   rï   rò   r=   r   r   rÞ   rÞ   ´  s<   € € € € € ðð ð7ð 7ð 7ð*7ð 7ð 7ð 7ð 7r   rÞ   c                   ó0   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚPython3BytesTestszB
    Tests for L{iterbytes}, L{intToBytes}, L{lazyByteSlice}.
    c                 ór   — d}t          t          |¦  «        ¦  «        }|                      |g d¢¦  «         dS )z¯
        When L{iterbytes} is called with a bytestring, the returned object
        can be iterated over, resulting in the individual bytes of the
        bytestring.
        s   abcd)r¸   ó   bó   cr»   N)rI   r   r   )r   ÚinputÚresults      r   Útest_iterationz Python3BytesTests.test_iterationç  sA   € ð ˆÝ•i Ñ&Ô&Ñ'Ô'ˆØ×Ò˜Ð!9Ð!9Ð!9Ñ:Ô:Ð:Ð:Ð:r   c                 óL   — |                       t          d¦  «        d¦  «         dS )z‹
        When L{intToBytes} is called with an integer, the result is an
        ASCII-encoded string representation of the number.
        éÕ   s   213N)r   r	   r   s    r   Útest_intToBytesz!Python3BytesTests.test_intToBytesñ  s&   € ð
 	×Ò� C™œ¨&Ñ1Ô1Ð1Ð1Ð1r   c                 ój   — d}|                       t          t          |¦  «        ¦  «        |¦  «         dS )zv
        L{lazyByteSlice} called with some bytes returns a semantically equal
        version of these bytes.
        ó   123XYZN©r   r"   r   ©r   Údatas     r   Útest_lazyByteSliceNoOffsetz,Python3BytesTests.test_lazyByteSliceNoOffsetø  s5   € ð
 ˆØ×Ò��}¨TÑ2Ô2Ñ3Ô3°TÑ:Ô:Ð:Ð:Ð:r   c                 ó|   — d}|                       t          t          |d¦  «        ¦  «        |dd…         ¦  «         dS )z¡
        L{lazyByteSlice} called with some bytes and an offset returns a
        semantically equal version of these bytes starting at the given offset.
        rÿ   rd   Nr   r  s     r   Útest_lazyByteSliceOffsetz*Python3BytesTests.test_lazyByteSliceOffset   s?   € ð
 ˆØ×Ò��}¨T°1Ñ5Ô5Ñ6Ô6¸¸Q¸R¸R¼ÑAÔAÐAÐAÐAr   c           	      ó~   — d}|                       t          t          |dd¦  «        ¦  «        |dd…         ¦  «         dS )zË
        L{lazyByteSlice} called with some bytes, an offset and a length returns
        a semantically equal version of these bytes starting at the given
        offset, up to the given length.
        rÿ   rd   r‘   é   Nr   r  s     r   Ú!test_lazyByteSliceOffsetAndLengthz3Python3BytesTests.test_lazyByteSliceOffsetAndLength  sA   € ð ˆØ×Ò��}¨T°1°aÑ8Ô8Ñ9Ô9¸4ÀÀ!À¼9ÑEÔEÐEÐEÐEr   N)	r9   r:   r;   r<   rú   rý   r  r  r  r=   r   r   rô   rô   â  sq   € € € € € ðð ð;ð ;ð ;ð2ð 2ð 2ð;ð ;ð ;ðBð Bð BðFð Fð Fð Fð Fr   rô   c                   óV   — e Zd ZdZ e ej        ¦   «         d¦  «        d„ ¦   «         ZdS )ÚBytesEnvironTestsz$
    Tests for L{BytesEnviron}.
    z+Environment vars are always str on Windows.c                 óL  — t          ¦   «         }t          ¦   «         }|                     ¦   «         D ]I\  }}|                     t	          |¦  «        ¦  «         |                     t	          |¦  «        ¦  «         ŒJ|                      t          |¦  «        t          g¦  «         dS )zz
        The output of L{BytesEnviron} should always be a L{dict} with L{bytes}
        values and L{bytes} keys.
        N)r   rG   ÚitemsrH   Útyper   rI   r"   )r   rù   ÚtypesÚkeyÚvals        r   Útest_alwaysBytesz"BytesEnvironTests.test_alwaysBytes  sˆ   € õ ‘”ˆÝ‘”ˆàŸš™œð 	!ð 	!‰HˆC�Ø�IŠI•d˜3‘i”iÑ Ô Ð Ø�IŠI•d˜3‘i”iÑ Ô Ð Ð à×Ò�˜e™œ¥u gÑ.Ô.Ð.Ð.Ð.r   N)r9   r:   r;   r<   r   r   Ú	isWindowsr  r=   r   r   r
  r
    sT   € € € € € ðð ð €VÐˆHÔÑ Ô Ð"OÑPÔPð/ð /ñ QÔPð/ð /ð /r   r
  )(r<   r0   r   ry   rç   Úunittestr   Útwisted.python.compatr   r   r   r   r   r	   r
   r   r   r   r   r   Útwisted.python.filepathr   Útwisted.python.runtimer   Útwisted.trial.unittestr   r   r   r?   rX   rv   r   rŠ   rœ   r±   r½   rÖ   rÞ   rô   r
  r=   r   r   ú<module>r     sm  ðð
ð ð
 €€€Ø 	€	€	€	Ø 
€
€
€
Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð -Ð ,Ð ,Ð ,Ð ,Ð ,Ø +Ð +Ð +Ð +Ð +Ð +Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @ð30ð 30ð 30ð 30ð 30Ð%ñ 30ô 30ð 30ðl*2ð *2ð *2ð *2ð *2Ð%ñ *2ô *2ð *2ðZ-=ð -=ð -=ð -=ð -=Ð-ñ -=ô -=ð -=ð`$ð $ð $ð $ð $Ð"ñ $ô $ð $ð ð,ð ,ð ,ð ,ð ,ñ ,ô ,ñ „ð,ð79ð 79ð 79ð 79ð 79Ð)ñ 79ô 79ð 79ðt3Ið 3Ið 3Ið 3Ið 3IÐ0ñ 3Iô 3Ið 3Iðl.ð .ð .ð .ð .Ð"ñ .ô .ð .ð856ð 56ð 56ð 56ð 56Ð%ñ 56ô 56ð 56ðp>ð >ð >ð >ð >Ð,ñ >ô >ð >ð8+7ð +7ð +7ð +7ð +7Ð&ñ +7ô +7ð +7ð\-Fð -Fð -Fð -Fð -FÐ+ñ -Fô -Fð -Fð`/ð /ð /ð /ð /˜ñ /ô /ð /ð /ð /r   