U
    
W[­  ã                   @   sH   d dl mZ d dlmZmZmZ G dd„ dejƒZG dd„ dejƒZdS )é    )Úunittest)ÚnodeprepÚresourceprepÚnameprepc                   @   s   e Zd ZdZdd„ ZdS )ÚDeprecationTestszL
    Deprecations in L{twisted.words.protocols.jabber.xmpp_stringprep}.
    c                 C   sd   ddl m} | j| jgd}|  t|d d ¡ |  d|d d ¡ |  dt|ƒ¡ |  |d¡ d	S )
zX
        L{xmpp_stringprep.crippled} is deprecated and always returns C{False}.
        r   )Úcrippled)ZoffendingFunctionsÚcategoryzrtwisted.words.protocols.jabber.xmpp_stringprep.crippled was deprecated in Twisted 13.1.0: crippled is always FalseÚmessageé   FN)Ú.twisted.words.protocols.jabber.xmpp_stringprepr   ZflushWarningsÚtest_crippledÚassertEqualÚDeprecationWarningÚlen)Úselfr   Úwarnings© r   úN/usr/lib/python3/dist-packages/twisted/words/test/test_jabberxmppstringprep.pyr      s    ÿ
ýzDeprecationTests.test_crippledN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r      s   r   c                   @   s8   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ ZdS )ÚXMPPStringPrepTestsa¼  
    The nodeprep stringprep profile is similar to the resourceprep profile,
    but does an extra mapping of characters (table B.2) and disallows
    more characters (table C.1.1 and eight extra punctuation characters).
    Due to this similarity, the resourceprep tests are more extensive, and
    the nodeprep tests only address the mappings additional restrictions.

    The nameprep profile is nearly identical to the nameprep implementation in
    L{encodings.idna}, but that implementation assumes the C{UseSTD4ASCIIRules}
    flag to be false. This implementation assumes it to be true, and restricts
    the allowed set of characters.  The tests here only check for the
    differences.
    c                 C   s
  |   t d¡d¡ |  t d¡d¡ |   t d¡d¡ |   t d¡d¡ |   t d¡d¡ |   t d¡d¡ |  ttjd	¡ |   t d
¡d¡ |   t d¡d¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |   t d¡d¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |   t d¡d¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |  ttjd ¡ |  ttjd!¡ |   t d"¡d"¡ |  ttjd#¡ d S )$NÚresourceZResourceú u	   Henry â…£zHenry IVu%   fooÂ­Íá †á ‹barâ€‹â bazï¸€ï¸ˆï¸ï»¿Z	foobarbazõ   Â u   áš€u   â€€u   â€‹Ú zõ   Â…u   á Žu   ï»¿u   ï„£u   ó±ˆ´u   ôˆ´u   ò¿¾u   ô¿¿u   í½‚u   ï¿½u   â¿µu   Íu   Ìu   â€Žu   â€ªu   ó €u   ó ‚u   fooÖ¾baru	   fooïµbaru   Ø§1u   Ø§1Ø¨u   ó €‚)r   r   ÚprepareZassertNotEqualÚassertRaisesÚUnicodeError©r   r   r   r   ÚtestResourcePrep/   sF    ýÿz$XMPPStringPrepTests.testResourcePrepc                 C   s8   |   t d¡d¡ |   t d¡d¡ |  ttjd¡ d S )NÚuserZUserzus&er)r   r   r   r   r    r!   r   r   r   ÚtestNodePrepX   s    z XMPPStringPrepTests.testNodePrepc                 C   s   |   ttjd¡ dS )zQ
        Make sure unassigned code points from Unicode 3.2 are rejected.
        u   á´¹N)r   r    r   r   r!   r   r   r   Ú"test_nodeprepUnassignedInUnicode32^   s    z6XMPPStringPrepTests.test_nodeprepUnassignedInUnicode32c                 C   sj   |   t d¡d¡ |   t d¡d¡ |  ttjd¡ |  ttjd¡ |  ttjd¡ |   t d¡d¡ d S )Nzexample.comzExample.comzex@mple.comz-example.comzexample-.comu   straÃŸe.example.comzstrasse.example.com)r   r   r   r   r    r!   r   r   r   ÚtestNamePrepe   s    ÿz XMPPStringPrepTests.testNamePrepc                 C   s   |   t d¡d¡ dS )z>
        A trailing dot in domain names is preserved.
        zexample.com.N)r   r   r   r!   r   r   r   Útest_nameprepTrailingDoto   s    z,XMPPStringPrepTests.test_nameprepTrailingDotN)	r   r   r   r   r"   r$   r%   r&   r'   r   r   r   r   r       s   )
r   N)	Ztwisted.trialr   r   r   r   r   ZTestCaser   r   r   r   r   r   Ú<module>   s   