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: //proc/self/root/lib/python3/dist-packages/simplejson/tests/__pycache__/test_unicode.cpython-38.pyc
U

�O5[��@sPddlZddlZddlmZddlZddlmZmZm	Z	m
Z
Gdd�de�ZdS)�N)�TestCase)�unichr�	text_type�b�BytesIOc@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#d$�Zd%S)&�TestUnicodecCs>tjdd�}d}|�d�}|�|�}|�|�}|�||�dS)N�utf-8��encoding�αΩ)�jsonZJSONEncoder�encode�assertEqual)�self�encoder�u�s�ju�js�r�?/usr/lib/python3/dist-packages/simplejson/tests/test_unicode.py�test_encoding1	s


zTestUnicode.test_encoding1cCs:d}|�d�}tj|dd�}tj|dd�}|�||�dS)Nrrr	)r
r�dumpsr)rrrrrrrr�test_encoding2s

zTestUnicode.test_encoding2cCsd}t�|�}|�|d�dS)Nrz"\u03b1\u03a9"�rrr�rr�jrrr�test_encoding3s
zTestUnicode.test_encoding3cCs d}t�|g�}|�|d�dS)Nrz["\u03b1\u03a9"]rrrrr�test_encoding4szTestUnicode.test_encoding4cCs*d}tj|dd�}|�|d|d�dS)NrF�Zensure_ascii�"rrrrr�test_encoding5"szTestUnicode.test_encoding5cCs,d}tj|gdd�}|�|d|d�dS)NrFrz["z"]rrrrr�test_encoding6'szTestUnicode.test_encoding6cCs0d}|�t�|�d�|�tj|dd�d�dS)Nu𝄠z"\ud834\udd20"Fru"𝄠")rrr�rrrrr�test_big_unicode_encode,sz#TestUnicode.test_big_unicode_encodecCs4d}|�t�d|d�|�|�t�d�|�dS)Nuz𝄠xr z"z\ud834\udd20x")rr�loadsr#rrr�test_big_unicode_decode1sz#TestUnicode.test_big_unicode_decodecCs8tdd�D](}t|�}d|f}|�t�|�|�q
dS)Nri��z"\u%04x")�rangerrrr%)r�irrrrr�test_unicode_decode6s
zTestUnicode.test_unicode_decodecCs�d}dddddddg}|�t�|�t|��|�tj|d	d
�d�|�tj|tjd�}|�|t�|��|�t|�tj�|�tj|tjdd
�d
�t�|��dS)Nz?{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7})Zxkd�)Zkcw�)Zart�)Zhxm�)Zqrt�)Zpad�)Zhoy�cSs|S�Nr��xrrr�<lambda>B�zATestUnicode.test_object_pairs_hook_with_unicode.<locals>.<lambda>)�object_pairs_hookcSsdSr1rr2rrrr4Ir5)r6Zobject_hook)rrr%�eval�OrderedDict�type)rr�pZodrrr�#test_object_pairs_hook_with_unicode=s"�
��z/TestUnicode.test_object_pairs_hook_with_unicodecCs |�t�d�d��ddi�dS)Nu{"a": "é"}r�a�é)rrr%r
�rrrr�test_default_encodingMs�z!TestUnicode.test_default_encodingcCsJ|�tt�d��t�|�tt�d��t�|�tt�d�d�t�dS)Nz""z"a"z["a"]r)rr9rr%rr>rrr�test_unicode_preservationQsz%TestUnicode.test_unicode_preservationcCsl|�ttjgdd��t�|�ttjddd��t�|�ttjidd��t�|�ttjddd��t�dS)NFrr�)rr9rrrr>rrr�'test_ensure_ascii_false_returns_unicodeVsz3TestUnicode.test_ensure_ascii_false_returns_unicodecCspdtd�i}ddi}d}d}|�t�|�|�|�t�|�|�|�tj|dd�|�|�tj|dd�|�dS)NZquuxuArrêt sur imagesuArrêt sur imagesz!{"quux": "Arr\u00eat sur images"}u{"quux": "Arrêt sur images"}Fr)rrrr)rZdoc1Zdoc2Z	doc_asciiZdoc_unicoderrr�+test_ensure_ascii_false_bytestring_encoding]sz7TestUnicode.test_ensure_ascii_false_bytestring_encodingcCsjd}|�d�}d}d}|�t�|�|�|�t�|�|�|�tj|dd�|�|�tj|dd�|�dS)Nu

�utf8z"\u2029\u2028"u"

"Fr)r
rrr)r�s1�s2ZexpectZexpect_non_asciirrr�$test_ensure_ascii_linebreak_encodinghs
z0TestUnicode.test_ensure_ascii_linebreak_encodingcCsB|�tjtjd�|�tjtjd�|�tjtjd�|�tjtjd�|�tjtjd�|�tjtjd�|�tjtjd�|�tjtjd�|�tjtjd	�tjd
k�r>|�tjtjd�|�tjtjd�|�tjtjd
�|�tjtjd�|�tjtjd�|�tjtjd�|�tjtjd�|�tjtjd�dS)Nz"\uz"\u1z"\u12z"\u123z"\u1234z"\u123x"z"\u12x4"z"\u1x34"z"\ux234"i��z
"\ud800\u"z"\ud800\u0"z"\ud800\u00"z
"\ud800\u000"z"\ud800\u000x"z"\ud800\u00x0"z"\ud800\u0x00"z"\ud800\ux000")ZassertRaisesrZJSONDecodeErrorr%�sys�
maxunicoder>rrr�test_invalid_escape_sequencesss$z)TestUnicode.test_invalid_escape_sequencescCsXtttdd��D] }|�tj|dd�t�|��qd}|�tj|dd�d|d�dS)Nr�Fru☃r )�maprr'rrr)r�cZsnowmanrrr�test_ensure_ascii_still_works�s�
�z)TestUnicode.test_ensure_ascii_still_workscCsXd}tjtt�|��}|�t�t|��|�||�d�fD]}|�t�	|�|�q<dS)NuこんにちわrD)
�codecs�BOM_UTF8rrrr�loadr�decoder%)rZcontentZjson_doc�docrrr�test_strip_bom�s
zTestUnicode.test_strip_bomN)�__name__�
__module__�__qualname__rrrrr!r"r$r&r)r;r?r@rBrCrGrJrNrTrrrrrs$r)rHrOZunittestrZ
simplejsonrZsimplejson.compatrrrrrrrrr�<module>s