a
    óń"h$  ć                   @   sZ   d dl Z d dlmZ d dlmZmZ G dd dZG dd deeZG dd	 d	eeZdS )
é    N)ŚOrderedDict)ŚPyTestŚCTestc                   @   sd   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd ZdS )ŚTestUnicodec                 C   s   d}|   |”}|  |d” d S )Nõ   Ī±Ī©z"\u03b1\u03a9"©ŚdumpsŚassertEqual©ŚselfŚuŚj© r   śC/opt/python-3.9.21/usr/lib/python3.9/test/test_json/test_unicode.pyŚtest_encoding3
   s    
zTestUnicode.test_encoding3c                 C   s    d}|   |g”}|  |d” d S )Nr   z["\u03b1\u03a9"]r   r
   r   r   r   Śtest_encoding4   s    zTestUnicode.test_encoding4c                 C   s(   d}| j |dd}|  |d |”” d S )Nr   F©Zensure_asciiz"{0}"©r   r	   Śformatr
   r   r   r   Śtest_encoding5   s    zTestUnicode.test_encoding5c                 C   s*   d}| j |gdd}|  |d |”” d S )Nr   Fr   z["{0}"]r   r
   r   r   r   Śtest_encoding6   s    zTestUnicode.test_encoding6c                 C   s0   d}|   |  |”d” |   | j|ddd” d S )Nu   š z"\ud834\udd20"Fr   u   "š ")r	   r   ©r   r   r   r   r   Śtest_big_unicode_encode   s    z#TestUnicode.test_big_unicode_encodec                 C   s4   d}|   |  d| d ”|” |   |  d”|” d S )Nu   zš xś"z"z\ud834\udd20x")r	   Śloadsr   r   r   r   Śtest_big_unicode_decode#   s    z#TestUnicode.test_big_unicode_decodec                 C   s8   t ddD ](}t|}d |”}|  |  |”|” q
d S )Nr   i’×  z"\u{0:04x}")ŚrangeŚchrr   r	   r   )r   Śir   Śsr   r   r   Śtest_unicode_decode(   s    
zTestUnicode.test_unicode_decodec                 C   sJ   |   t|  d”t” |   t|  d”t” |   t|  d”d t” d S )Nz""z"a"z["a"]r   )r	   Śtyper   Śstr©r   r   r   r   Śtest_unicode_preservation.   s    z%TestUnicode.test_unicode_preservationc                 C   s&   |   t| jd” |   t| jdg” d S )Ns   hi)ŚassertRaisesŚ	TypeErrorr   r#   r   r   r   Śtest_bytes_encode3   s    zTestUnicode.test_bytes_encodec                 C   sÖ   dt jfdt jfdt jfdt jfdt jffD ]F\}}dg}|  |” |”}|  |  	|| ”|” |  |  	|”|” q,|  
t| j	d” |  |  	d d	””d
” |  |  	d”d” |  |  	d”d” |  |  	d”d” d S )Nzutf-8zutf-16bezutf-16lezutf-32bezutf-32leu
   aĀµā¬š s   [""]u   "ā"z	utf-16-leu   ās   5 é   s    7é   s   57é9   )ŚcodecsŚBOM_UTF8ŚBOM_UTF16_BEŚBOM_UTF16_LEŚBOM_UTF32_BEŚBOM_UTF32_LEr   Śencoder	   r   r%   ŚUnicodeDecodeError)r   ŚencodingZbomŚdataŚencodedr   r   r   Śtest_bytes_decode7   s"    ū’zTestUnicode.test_bytes_decodec                 C   s   d}g d¢}|   |  |”t|” |   | j|dd d|” | j|td}|   |t|” |   t|t” |   | j|tdd dt|” d S )Nz?{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}))Zxkdé   )Zkcwé   )Zarté   )Zhxmé   )Zqrtr(   )Zpadé   )Zhoyr)   c                 S   s   | S ©Nr   ©Śxr   r   r   Ś<lambda>W   ó    zATestUnicode.test_object_pairs_hook_with_unicode.<locals>.<lambda>)Śobject_pairs_hookc                 S   s   d S r<   r   r=   r   r   r   r?   ]   r@   )rA   Zobject_hook)r	   r   Śevalr   r!   )r   r   ŚpZodr   r   r   Ś#test_object_pairs_hook_with_unicodeR   s    ’žz/TestUnicode.test_object_pairs_hook_with_unicodeN)Ś__name__Ś
__module__Ś__qualname__r   r   r   r   r   r   r    r$   r'   r6   rD   r   r   r   r   r      s   r   c                   @   s   e Zd ZdS )ŚTestPyUnicodeN©rE   rF   rG   r   r   r   r   rH   a   r@   rH   c                   @   s   e Zd ZdS )ŚTestCUnicodeNrI   r   r   r   r   rJ   b   r@   rJ   )	r+   Ścollectionsr   Ztest.test_jsonr   r   r   rH   rJ   r   r   r   r   Ś<module>   s
   [