HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/words/test/__pycache__/test_jabberjid.cpython-38.pyc
U


W[*�@sbdZddlmZddlmZddlmZGdd�dej�ZGdd�dej�Z	Gd	d
�d
ej�Z
dS)z2
Tests for L{twisted.words.protocols.jabber.jid}.
�)�unicode)�unittest)�jidc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�JIDParsingTestscCs�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d	�d
�|�t�d�d�|�t�d
�d�|�t�d�d�|�t�d�d�|�t�d�d�dS)z/
        Test different forms of JIDs.
        �user@host/resource��user�host�resource�	user@host�rr	Nr	�Nr	N�
host/resource�Nr	r
zfoo/bar@baz)N�foo�bar@bazzboo@foo/bar@baz)�boorrzboo@foo/bar/baz)rrzbar/bazzboo/foo@bar@baz)Nrzfoo@bar@bazzboo/foo/bar)Nrzfoo/barzboo//foo)Nrz/fooN)�assertEqualr�parse��self�r�C/usr/lib/python3/dist-packages/twisted/words/test/test_jabberjid.py�
test_parses<����������zJIDParsingTests.test_parsecCs|�tjtjd�dS)z3
        Test for failure on no host part.
        zuser@N��assertRaisesrZ
InvalidFormatrrrrr�test_noHost*szJIDParsingTests.test_noHostcCs|�tjtjd�dS)z�
        Test for failure on double @ signs.

        This should fail because @ is not a valid character for the host
        part of the JID.
        z
user@@hostNrrrrr�
test_doubleAt0szJIDParsingTests.test_doubleAtcCs|�tjtjd�dS)z�
        Test for failure on two @ signs.

        This should fail because @ is not a valid character for the host
        part of the JID.
        zuser@host@hostNrrrrr�test_multipleAt9szJIDParsingTests.test_multipleAtcCs|�t�ddd�d�dS)z@
        Test case mapping of the user part of the JID.
        ZUsErr	r
rN�rr�preprrrr�test_prepCaseMapUserEs�z$JIDParsingTests.test_prepCaseMapUsercCs|�t�ddd�d�dS)z@
        Test case mapping of the host part of the JID.
        r�hoSTr
rNrrrrr�test_prepCaseMapHostLs�z$JIDParsingTests.test_prepCaseMapHostcCs0|�t�ddd�d�|�t�ddd�d�dS)zH
        Test no case mapping of the resourcce part of the JID.
        rr"r
rr	ZResourceN)rrr �assertNotEqualrrrr�test_prepNoCaseMapResourceSs��z*JIDParsingTests.test_prepNoCaseMapResourceN)
�__name__�
__module__�__qualname__rrrrr!r#r%rrrrr
s	rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#S)$�JIDTestscCs|�ttj�dS)zC
        Test that using no arguments raises an exception.
        N)r�RuntimeErrorr�JIDrrrr�test_noneArguments^szJIDTests.test_noneArgumentscCs8t�d�}|�|jd�|�|jd�|�|jd�dS)zI
        Test that the attributes correspond with the JID parts.
        rrr	r
N)rr+rrr	r
�r�jrrr�test_attributesds
zJIDTests.test_attributescCst�d�}|�d|���dS)z6
        Test the extraction of the bare JID.
        rrN�rr+rZuserhostr-rrr�
test_userhostms
zJIDTests.test_userhostcCst�d�}|�d|���dS)zU
        Test the extraction of the bare JID of the full form host/resource.
        rr	Nr0r-rrr�test_userhostOnlyHostts
zJIDTests.test_userhostOnlyHostcCs(t�d�}t�d�}|�||���dS)z<
        Test getting a JID object of the bare JID.
        rrN)rr+�	internJID�assertIdentical�userhostJID�rZj1Zj2rrr�test_userhostJID{s

zJIDTests.test_userhostJIDcCst�d�}|�||���dS)zW
        Test getting a JID object of the bare JID when there was no resource.
        rN)rr+r4r5r-rrr�test_userhostJIDNoResource�s
z#JIDTests.test_userhostJIDNoResourcecCs tjdd�}|�d|���dS)zW
        Test giving a string representation of the JID with only a host part.
        r
��tupler	N�rr+rZfullr-rrr�
test_fullHost�szJIDTests.test_fullHostcCs tjdd�}|�d|���dS)zU
        Test giving a string representation of the JID with host, resource.
        rr9rNr;r-rrr�test_fullHostResource�szJIDTests.test_fullHostResourcecCs tjdd�}|�d|���dS)zQ
        Test giving a string representation of the JID with user, host.
        rr9rNr;r-rrr�test_fullUserHost�szJIDTests.test_fullUserHostcCs tjdd�}|�d|���dS)zA
        Test giving a string representation of the JID.
        rr9rNr;r-rrr�test_fullAll�szJIDTests.test_fullAllcCs0t�d�}t�d�}|�||�|�||�dS�z$
        Test JID equality.
        rN)rr+ZassertNotIdenticalrr6rrr�
test_equality�s

zJIDTests.test_equalitycCst�d�}|�|dk�dSr@)rr+ZassertFalser-rrr�test_equalityWithNonJIDs�s
z!JIDTests.test_equalityWithNonJIDscCs$t�d�}t�d�}|�||�dS)z&
        Test JID inequality.
        zuser1@host/resourcezuser2@host/resourceN�rr+r$r6rrr�test_inequality�s

zJIDTests.test_inequalitycCst�d�}|�|d�dSr@rCr-rrr�test_inequalityWithNonJIDs�s
z#JIDTests.test_inequalityWithNonJIDscCs,t�d�}t�d�}|�t|�t|��dS)z'
        Test JID hashability.
        rN)rr+r�hashr6rrr�
test_hashable�s

zJIDTests.test_hashablecCs tjdd�}|�dt|��dS)z6
        Test unicode representation of JIDs.
        rr9rN)rr+rrr-rrr�test_unicode�szJIDTests.test_unicodecCs(tjdd�}|�dtd�t|��dS)z5
        Test representation of JID objects.
        rr9zJID(%s)rN)rr+r�reprr-rrr�	test_repr�szJIDTests.test_reprN)r&r'r(r,r/r1r2r7r8r<r=r>r?rArBrDrErGrHrJrrrrr)\s"		r)c@seZdZdd�ZdS)�InternJIDTestscCs$t�d�}t�d�}|�||�dS)zD
        Test that two interned JIDs yield the same object.
        rN)rr3r4r6rrr�
test_identity�s

zInternJIDTests.test_identityN)r&r'r(rLrrrrrK�srKN)�__doc__Ztwisted.python.compatrZ
twisted.trialrZtwisted.words.protocols.jabberrZTestCaserr)rKrrrr�<module>sO