Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/test_unicodedata.cpython-34.pyo

�
f fB0�@s�dZddlZddlZddlZddlZddlZdZdZGdd�dej	�Z
Gdd�dej	�ZGd	d
�d
e�ZGdd�de�Z
d
d�Zedkr�e�ndS)z� Test script for the unicodedata module.

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

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

�Nzutf-8�
surrogatepassc@s"eZdZdZdd�ZdS)�UnicodeMethodsTestZ(e74e878de71b6e780ffac271785c3cb58f6251f3cCs�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/python34/lib64/python3.4/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)rr,r%r%r&�setUpGszUnicodeDatabaseTest.setUpcCs
|`dS)N)r-)rr%r%r&�tearDownMszUnicodeDatabaseTest.tearDownN)r(r)r*r.r/r%r%r%r&r+Esr+c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�UnicodeFunctionsTestZ(f0b74d26776331cc7bdc3a4698f037d73f2cee2bcCs%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���r3r3)rrr	r
�formatr-�digit�numeric�decimal�category�
bidirectional�
decomposition�str�mirrored�	combiningrrrrrr)rr#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-r5�assertRaises�	TypeError�
ValueError)rr%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?r@rAu⅛g�?u⑨g"@u꘧g@u𠀀u𐄪i(#rCrD)rr-r6rErFrG)rr%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?r@rAu⅛u⑨u𠀀u𝟽rBrCrD)rr-r7rErFrG)rr%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𐄪ZNorC)rr-r8rErF)rr%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𠀀rC)rr-r9rErF)rr%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 0034rC)rr-r:rErF)rr%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￾rrKu∁r1u𠀀rC)rr-r<rErF)rr%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￾rrKu⃡��u𠀀rC)rr-r=rErF)rr%r%r&�test_combining�sz#UnicodeFunctionsTest.test_combiningcCsU|jt|jj�|jt|jjdd�|j|jjdd�d�dS)N�unknownrCZNFKCr)rErFr-�	normalizerGr)rr%r%r&�test_normalize�sz#UnicodeFunctionsTest.test_normalizecCs:d}x-|D]%}|j|jjd|�|�q
WdS)N�େ̀ା�ᄀ̀ᅡ�Li̍t-sṳ́uमार्क ज़uुकेरबर्गuकिर्गिज़uस्तान�NFC�.मार्क ज़ुकेरबर्ग�'किर्गिज़स्तान)rXrYrZr\r])rr-rV)rZcomposed�textr%r%r&�	test_pr29�s
zUnicodeFunctionsTest.test_pr29cCs?ddd}ddd}|j|jjd|�|�dS)NuC̸�uÇ�Çr[)rr-rV)rrK�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��NrMZNau좔�Wuヲ�Hu?�Fu‐r?u𠀀)r-�east_asian_widthrErF�	bytearrayr)rZeawr%r%r&�test_east_asian_width�sz*UnicodeFunctionsTest.test_east_asian_widthN)r(r)r*rr>rHrIrJrLrOrQrRrTrWr_rcrlr%r%r%r&r0Ps

			r0c@speZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�UnicodeMiscTestcCs�d}tjd|g}tj|dtj�}|j�|j|jd�d}|j||j	j
�jd��|j	j�dS)NzGimport sys;sys.modules['unicodedata'] = None;eval("'\\N{SOFT HYPHEN}'")z-c�stderrr1zUSyntaxError: (unicode error) \N escapes not supported (can't load unicodedata module)r2)
�sys�
executable�
subprocess�Popen�PIPE�waitr�
returncodeZassertInrn�read�decode�close)r�code�args�popen�errorr%r%r&�#test_failed_import_during_compiling�s
"z3UnicodeMiscTest.test_failed_import_during_compilingcCs�d}xjtd�D]\}t|�}|jj|d�}|dkr|j||jj|��|d7}qqW|j|dk�dS)Nrir1�
r3r3)r	r
r-r7rr6�
assertTrue)r�countr!�c�decr%r%r&�test_decimal_numeric_consistent�sz/UnicodeMiscTest.test_decimal_numeric_consistentcCs�d}xjtd�D]\}t|�}|jj|d�}|dkr|j||jj|��|d7}qqW|j|dk�dS)Nrir1r~r3r3)r	r
r-r5rr6r)rr�r!r�r�r%r%r&�test_digit_numeric_consistentsz-UnicodeMiscTest.test_digit_numeric_consistentcCs |j|jjd�d�dS)NzGOTHIC LETTER FAIHUu𐍆)rr-�lookup)rr%r%r&�test_bug_1704793sz UnicodeMiscTest.test_bug_1704793cCs�ddl}|j|jd��|j|jjd��|jdj�dk�|jdj�dk�|jdj�dk�dS)Nru༺rKr?uᵹuꝽ�.)r,rr<�	ucd_3_2_0r)rr,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)�)r
rrr)�.0r�r%r%r&�
<listcomp>$s	z1UnicodeMiscTest.test_bug_5828.<locals>.<listcomp>r1r)rrr	ro�
maxunicode)rr%r%r&�
test_bug_5828szUnicodeMiscTest.test_bug_5828cCsF|jdj�d�|jdj�d�|jdj�d�dS)NuDŽuDžudž)rr)rr%r%r&�
test_bug_4971*szUnicodeMiscTest.test_bug_4971cCszxstd�D]e}t|�dj�}|dkrU|jt|�d
d|�q
|jt|�dd|�q
WdS)Nir?r~���
�����( �) �z\u%.4x should be a linebreakr1z \u%.4x should not be a linebreak)
r~r�r�r�r�r�r�r�r�r�)r	r
�
splitlinesr�len)rr!�linesr%r%r&�test_linebreak_76430s	z#UnicodeMiscTest.test_linebreak_7643N)r(r)r*r}r�r�r�r�r�r�r�r%r%r%r&rm�s

rmcCstjjttt�dS)N)�testZsupportZrun_unittestrmrr0r%r%r%r&�	test_main;s	r��__main__)�__doc__roZunittestrrqZtest.supportr�rrZTestCaserr+r0rmr�r(r%r%r%r&�<module>s0�Z