
    Yfo                     r    d dl mZ d dlmZmZmZ  G d dej                  Z G d dej                  ZdS )    )unittest)nameprepnodeprepresourceprepc                       e Zd ZdZddZdS )DeprecationTestszL
    Deprecations in L{twisted.words.protocols.jabber.xmpp_stringprep}.
    returnNc                 N   ddl m} |                     | j        g          }|                     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)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   flushWarningstest_crippledassertEqualDeprecationWarninglen)selfr   warningss      ^/var/www/html/env/lib/python3.11/site-packages/twisted/words/test/test_jabberxmppstringprep.pyr   zDeprecationTests.test_crippled   s     	LKKKKK%%$:L9M%NN+Xa[-DEEEEQK	"	
 	
 	

 	CMM***5)))))    r	   N)__name__
__module____qualname____doc__r    r   r   r   r      s2         * * * * * *r   r   c                   :    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.
    r	   Nc                 f	   |                      t          j        d          d           |                     t          j        d          d           |                      t          j        d          d           |                      t          j        d          d           |                      t          j        d          d           |                      t          j        d          d           |                     t
          t          j        d	           |                      t          j        d
          d           |                      t          j        d          d           |                     t
          t          j        d           |                     t
          t          j        d           |                     t
          t          j        d           |                      t          j        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          j        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          j        d"          d"           |                     t
          t          j        d#           d S )$NresourceResource u	   Henry ⅣzHenry IVu%   foo­͏᠆᠋bar​⁠baz︀︈️﻿	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   prepareassertNotEqualassertRaisesUnicodeErrorr   s    r   testResourcePrepz$XMPPStringPrepTests.testResourcePrep1   s   -j99:FFFL0<<jIII-c22C888-n==zJJJ . 
 	
 	
 	
 	-h77===,(<hGGG-h77===-h77<<<,(<nMMM,(<hGGG,(<hGGG-h77<<<,(<hGGG,(<lKKK,(<lKKK,(<lKKK,(<lKKK,(<hGGG,(<hGGG,(<hGGG-h77BBB,(<hGGG,(<hGGG,(<lKKK,(<lKKK,(<nMMM,(<nMMM 	,(<iHHH-o>>PPP,(<lKKKKKr   c                     |                      t          j        d          d           |                      t          j        d          d           |                     t          t          j        d           d S )NuserUserzus&er)r   r   r*   r,   r-   r.   s    r   testNodePrepz XMPPStringPrepTests.testNodePrep\   se    )&116:::)&116:::,(8'BBBBBr   c                 R    |                      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.   s    r   "test_nodeprepUnassignedInUnicode32z6XMPPStringPrepTests.test_nodeprepUnassignedInUnicode32a   s%     	,(8(CCCCCr   c                    |                      t          j        d          d           |                      t          j        d          d           |                     t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           |                      t          j        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.   s    r   testNamePrepz XMPPStringPrepTests.testNamePrepg   s    )-88-HHH)-88-HHH,(8-HHH,(8.III,(8.III6779N	
 	
 	
 	
 	
r   c                 V    |                      t          j        d          d           dS )z>
        A trailing dot in domain names is preserved.
        zexample.com.N)r   r   r*   r.   s    r   test_nameprepTrailingDotz,XMPPStringPrepTests.test_nameprepTrailingDotr   s+     	).99>JJJJJr   r   )	r   r   r   r   r/   r3   r5   r7   r9   r   r   r   r!   r!   "   s         )L )L )L )LVC C C C
D D D D	
 	
 	
 	
K K K K K Kr   r!   N)	twisted.trialr   r   r   r   r   TestCaser   r!   r   r   r   <module>r<      s    # " " " " "         * * * * *x( * * *,TK TK TK TK TK(+ TK TK TK TK TKr   