Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_unicodedata.cpython-35.opt-1.pyc



��Yf�/�@s�dZddlZddlZddlZddlmZdZdZGdd�dej�Z	Gdd	�d	ej�Z
Gd
d�de
�ZGdd
�d
e
�Ze
dkr�ej�dS)z� Test script for the unicodedata module.

    Written by Marc-Andre Lemburg (mal@lemburg.com).

    (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

�N)�
script_helperzutf-8�
surrogatepassc@s"eZdZdZdd�ZdS)�UnicodeMethodsTestZ(5971760872b2f98bb9c701e6c0db3273d756b3eccCs�tj�}x�td�D]�}t|�}d|j�d|j�d|j�d|j�d|j�d|j	�d|j
�d|j�d|j�d|dj�d|dj�d|dj�d|dj�d|dj�d|dj	�d|dj
�d|dj�d|dj�|j
�|j�|j�|dj
�|dj�|dj�|dj�g}|jdj|�jtt��qW|j�}|j||j�dS)NiZ01�abcZ123z 	�ABC�)�hashlib�sha1�range�chr�isalnum�isalpha�	isdecimal�isdigit�islower�	isnumeric�isspace�istitle�isupper�lower�upper�title�update�join�encode�encoding�errors�	hexdigest�assertEqual�expectedchecksum)�self�h�i�char�data�result�r&�:/opt/alt/python35/lib64/python3.5/test/test_unicodedata.py�test_method_checksums>








			


&z'UnicodeMethodsTest.test_method_checksumN)�__name__�
__module__�__qualname__rr(r&r&r&r'rsrc@s(eZdZdd�Zdd�ZdS)�UnicodeDatabaseTestcCsddl}||_dS)Nr)�unicodedata�db)r r-r&r&r'�setUpFszUnicodeDatabaseTest.setUpcCs
|`dS)N)r.)r r&r&r'�tearDownLszUnicodeDatabaseTest.tearDownN)r)r*r+r/r0r&r&r&r'r,Dsr,c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�UnicodeFunctionsTestZ(5e74827cd07f9e546a30f34b7bcf6cc2eac38c8ccCs%g}tj�}x�td�D]�}t|�}t|jj|d�d�t|jj|d�d�t|jj|d�d�|jj	|�|jj
|�|jj|�t|jj
|��t|jj|��g}|jdj|�jd��qW|j�}|j||j�dS)	Ni�z.12gr�ascii���r4r4)rr	r
r�formatr.�digit�numeric�decimal�category�
bidirectional�
decomposition�str�mirrored�	combiningrrrrrr)r r$r!r"r#r%r&r&r'�test_function_checksumTs#z+UnicodeFunctionsTest.test_function_checksumcCs�|j|jjdd�d�|j|jjd�d�|j|jjdd�d�|j|jjd�d�|j|jjdd�d�|j|jjd�d�|jt|jj�|jt|jjd	�|jt|jjd
�dS)N�A�9�	u⅛u⑨u𠀀u𝟽��xx�x)rr.r6�assertRaises�	TypeError�
ValueError)r r&r&r'�
test_digitiszUnicodeFunctionsTest.test_digitcCs|j|jjdd�d�|j|jjd�d�|j|jjd�d�|j|jjd�d�|j|jjd�d	�|j|jjd
d�d�|j|jjd�d�|jt|jj�|jt|jjd
�|jt|jjd�dS)Nr@rArBu⅛g�?u⑨g"@u꘧g@u𠀀u𐄪i(#rDrE)rr.r7rFrGrH)r r&r&r'�test_numericusz!UnicodeFunctionsTest.test_numericcCs|j|jjdd�d�|j|jjd�d�|j|jjdd�d�|j|jjdd�d�|j|jjdd�d�|j|jjd�d�|jt|jj�|jt|jjd	�|jt|jjd
�dS)Nr@rArBu⅛u⑨u𠀀u𝟽rCrDrE)rr.r8rFrGrH)r r&r&r'�test_decimal�sz!UnicodeFunctionsTest.test_decimalcCs�|j|jjd�d�|j|jjd�d�|j|jjd�d�|j|jjd�d�|j|jjd	�d
�|jt|jj�|jt|jjd�dS)Nu￾ZCn�aZLlr@ZLuu𠀀ZLou𐄪ZNorD)rr.r9rFrG)r r&r&r'�
test_category�sz"UnicodeFunctionsTest.test_categorycCs�|j|jjd�d�|j|jjd�d�|j|jjd�d�|j|jjd�d�|jt|jj�|jt|jjd�dS)	Nu￾r� ZWSr@�Lu𠀀rD)rr.r:rFrG)r r&r&r'�test_bidirectional�sz'UnicodeFunctionsTest.test_bidirectionalcCsk|j|jjd�d�|j|jjd�d�|jt|jj�|jt|jjd�dS)Nu￾r�¼z<fraction> 0031 2044 0034rD)rr.r;rFrG)r r&r&r'�test_decomposition�sz'UnicodeFunctionsTest.test_decompositioncCs�|j|jjd�d�|j|jjd�d�|j|jjd�d�|j|jjd�d�|jt|jj�|jt|jjd�dS)Nu￾rrLu∁r2u𠀀rD)rr.r=rFrG)r r&r&r'�
test_mirrored�sz"UnicodeFunctionsTest.test_mirroredcCs�|j|jjd�d�|j|jjd�d�|j|jjd�d�|j|jjd�d�|jt|jj�|jt|jjd�dS)Nu￾rrLu⃡��u𠀀rD)rr.r>rFrG)r r&r&r'�test_combining�sz#UnicodeFunctionsTest.test_combiningcCsU|jt|jj�|jt|jjdd�|j|jjdd�d�dS)N�unknownrDZNFKCr)rFrGr.�	normalizerHr)r r&r&r'�test_normalize�sz#UnicodeFunctionsTest.test_normalizecCs:d}x-|D]%}|j|jjd|�|�q
WdS)N�େ̀ା�ᄀ̀ᅡ�Li̍t-sṳ́uमार्क ज़uुकेरबर्गuकिर्गिज़uस्तान�NFC�.मार्क ज़ुकेरबर्ग�'किर्गिज़स्तान)rYrZr[r]r^)rr.rW)r Zcomposed�textr&r&r'�	test_pr29�s
zUnicodeFunctionsTest.test_pr29cCs?ddd}ddd}|j|jjd|�|�dS)NuC̸�uÇ�Çr\)rr.rW)r rL�br&r&r'�test_issue10254�sz$UnicodeFunctionsTest.test_issue10254cCs�|jj}|jt|d�|jt|t��|jt|d�|jt|d�|j|d�d�|j|d�d�|j|d�d	�|j|d
�d�|j|d�d
�|j|d�d�|j|d�d	�dS)N�arZra��NrNZNau좔�Wuヲ�Hu?�Fu‐r@u𠀀)r.�east_asian_widthrFrG�	bytearrayr)r Zeawr&r&r'�test_east_asian_width�sz*UnicodeFunctionsTest.test_east_asian_widthN)r)r*r+rr?rIrJrKrMrPrRrSrUrXr`rdrmr&r&r&r'r1Os

			r1c@speZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�UnicodeMiscTestcCs>d}tjd|�}d}|j||jjd��dS)NzGimport sys;sys.modules['unicodedata'] = None;eval("'\\N{SOFT HYPHEN}'")z-czUSyntaxError: (unicode error) \N escapes not supported (can't load unicodedata module)r3)rZassert_python_failureZassertIn�err�decode)r �coder%�errorr&r&r'�#test_failed_import_during_compiling�sz3UnicodeMiscTest.test_failed_import_during_compilingcCs�d}xgtd�D]Y}t|�}|jj|d�}|dkr|j||jj|��|d7}qW|j|dk�dS)Nrir2�
r4r4)r
rr.r8rr7�
assertTrue)r �countr"�c�decr&r&r'�test_decimal_numeric_consistent�sz/UnicodeMiscTest.test_decimal_numeric_consistentcCs�d}xgtd�D]Y}t|�}|jj|d�}|dkr|j||jj|��|d7}qW|j|dk�dS)Nrir2rtr4r4)r
rr.r6rr7ru)r rvr"rwrxr&r&r'�test_digit_numeric_consistentsz-UnicodeMiscTest.test_digit_numeric_consistentcCs |j|jjd�d�dS)NzGOTHIC LETTER FAIHUu𐍆)rr.�lookup)r r&r&r'�test_bug_1704793
sz UnicodeMiscTest.test_bug_1704793cCs�ddl}|j|jd��|j|jjd��|jdj�dk�|jdj�dk�|jdj�dk�dS)Nru༺rLr@uᵹuꝽ�.)r-rur=�	ucd_3_2_0r)r r-r&r&r'�test_ucd_510szUnicodeMiscTest.test_ucd_510cCsG|jdj�d�|jdd�ttjd�D�dg�dS)NuᵹcSsNg|]D}dt|�j�t|�j�t|�j�kr|�qS)�)rrrr)�.0rwr&r&r'�
<listcomp> s	z1UnicodeMiscTest.test_bug_5828.<locals>.<listcomp>r2r)rrr
�sys�
maxunicode)r r&r&r'�
test_bug_5828szUnicodeMiscTest.test_bug_5828cCsF|jdj�d�|jdj�d�|jdj�d�dS)NuDŽuDžudž)rr)r r&r&r'�
test_bug_4971&szUnicodeMiscTest.test_bug_4971cCszxstd�D]e}t|�dj�}|dkrU|jt|�d
d|�q
|jt|�dd|�q
WdS)Nir@rt���
�����( �) �z\u%.4x should be a linebreakr2z \u%.4x should not be a linebreak)
rtr�r�r�r�r�r�r�r�r�)r
r�
splitlinesr�len)r r"�linesr&r&r'�test_linebreak_7643,s	z#UnicodeMiscTest.test_linebreak_7643N)r)r*r+rsryrzr|rr�r�r�r&r&r&r'rn�s

rn�__main__)�__doc__r�ZunittestrZtest.supportrrrZTestCaserr,r1rnr)�mainr&r&r&r'�<module>s0�V