File: //lib/python3/dist-packages/twisted/words/test/__pycache__/test_jabberxmppstringprep.cpython-38.pyc
U
W[� � @ sH d dl mZ d dlmZmZmZ G dd� dej�ZG dd� dej�ZdS )� )�unittest)�nodeprep�resourceprep�nameprepc @ s e Zd ZdZdd� ZdS )�DeprecationTestszL
Deprecations in L{twisted.words.protocols.jabber.xmpp_stringprep}.
c C sd ddl m} | j| jgd�}| �t|d d � | �d|d d � | �dt|�� | �|d� d S )
zX
L{xmpp_stringprep.crippled} is deprecated and always returns C{False}.
r )�crippled)ZoffendingFunctions�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 �
�zDeprecationTests.test_crippledN)�__name__�
__module__�__qualname__�__doc__r r r r r r s r c @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� ZdS )
�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� | �ttjd � | � t�d
�d� | � t�d�d� | �ttjd
� | �ttjd� | �ttjd� | � t�d�d� | �ttjd� | �ttjd� | �ttjd� | �ttjd� | �ttjd� | �ttjd� | �ttjd� | �ttjd� | � t�d�d� | �ttjd� | �ttjd� | �ttjd� | �ttjd� | �ttjd� | �ttjd � | �ttjd!� | � t�d"�d"� | �ttjd#� d S )$N�resourceZResource� u Henry ⅣzHenry IVu% foo͏᠆᠋barbaz︀︈️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 �prepareZassertNotEqual�assertRaises�UnicodeError�r r r r �testResourcePrep/ sF ��z$XMPPStringPrepTests.testResourcePrepc C s8 | � t�d�d� | � t�d�d� | �ttjd� d S )N�userZUserzus&er)r
r r r r r! r r r �testNodePrepX s z XMPPStringPrepTests.testNodePrepc C s | � ttjd� dS )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� | �ttjd� | �ttjd� | �ttjd� | � t�d�d� d S )Nzexample.comzExample.comzex@mple.comz-example.comzexample-.comu straße.example.comzstrasse.example.com)r
r r r r r! r r r �testNamePrepe s �z XMPPStringPrepTests.testNamePrepc C s | � t�d�d� dS )z>
A trailing dot in domain names is preserved.
zexample.com.N)r
r r r! r r r �test_nameprepTrailingDoto s z,XMPPStringPrepTests.test_nameprepTrailingDotN) r r r r r"