HEX
Server: LiteSpeed
System: Linux altar40.supremepanel40.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: sescorpcl (4477)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //lib64/python3.6/site-packages/simplejson/tests/__pycache__/test_unicode.cpython-36.pyc
3

�8�]��@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}|jd�}|j|�}|j|�}|j||�dS)Nzutf-8)�encodinguαΩ)�jsonZJSONEncoder�encode�assertEqual)�self�encoder�u�s�ju�js�r�$/usr/lib64/python3.6/test_unicode.py�test_encoding1	s


zTestUnicode.test_encoding1cCs:d}|jd�}tj|dd�}tj|dd�}|j||�dS)NuαΩzutf-8)r)r
r	�dumpsr)rrrrrrrr�test_encoding2s

zTestUnicode.test_encoding2cCsd}tj|�}|j|d�dS)NuαΩz"\u03b1\u03a9")r	rr)rr�jrrr�test_encoding3s
zTestUnicode.test_encoding3cCs d}tj|g�}|j|d�dS)NuαΩz["\u03b1\u03a9"])r	rr)rrrrrr�test_encoding4szTestUnicode.test_encoding4cCs*d}tj|dd�}|j|d|d�dS)NuαΩF)�ensure_ascii�")r	rr)rrrrrr�test_encoding5"szTestUnicode.test_encoding5cCs,d}tj|gdd�}|j|d|d�dS)NuαΩF)rz["z"])r	rr)rrrrrr�test_encoding6'szTestUnicode.test_encoding6cCs0d}|jtj|�d�|jtj|dd�d�dS)Nu𝄠z"\ud834\udd20"F)ru"𝄠")rr	r)rrrrr�test_big_unicode_encode,sz#TestUnicode.test_big_unicode_encodecCs4d}|jtjd|d�|�|jtjd�|�dS)Nuz𝄠xrz"z\ud834\udd20x")rr	�loads)rrrrr�test_big_unicode_decode1sz#TestUnicode.test_big_unicode_decodecCs<x6tdd�D](}t|�}d|f}|jtj|�|�qWdS)Nri��z"\u%04x")�rangerrr	r)r�irrrrr�test_unicode_decode6s
zTestUnicode.test_unicode_decodecCs�d}dddddddg}|jtj|�t|��|jtj|dd�d�|�tj|tjd�}|j|tj|��|jt|�tj�|jtj|tjdd�d�tj|��dS)Nz?{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}�xkd��kcw��art��hxm��qrt��pad��hoy�cSs|S)Nr)�xrrr�<lambda>BszATestUnicode.test_object_pairs_hook_with_unicode.<locals>.<lambda>)�object_pairs_hookcSsdS)Nr)r2rrrr3Is)r4Zobject_hook)r$r%)r&r')r(r))r*r+)r,r-)r.r/)r0r1)rr	r�eval�OrderedDict�type)rr�pZodrrr�#test_object_pairs_hook_with_unicode=s


z/TestUnicode.test_object_pairs_hook_with_unicodecCs |jtjdjd��ddi�dS)Nu{"a": "é"}zutf-8�a�é)rr	rr
)rrrr�test_default_encodingMsz!TestUnicode.test_default_encodingcCsJ|jttjd��t�|jttjd��t�|jttjd�d�t�dS)Nz""z"a"z["a"]r)rr7r	rr)rrrr�test_unicode_preservationQsz%TestUnicode.test_unicode_preservationcCsl|jttjgdd��t�|jttjddd��t�|jttjidd��t�|jttjddd��t�dS)NF)rr�)rr7r	rr)rrrr�'test_ensure_ascii_false_returns_unicodeVsz3TestUnicode.test_ensure_ascii_false_returns_unicodecCspdtd�i}ddi}d}d}|jtj|�|�|jtj|�|�|jtj|dd�|�|jtj|dd�|�dS)NZquuxuArrêt sur imagesuArrêt sur imagesz!{"quux": "Arr\u00eat sur images"}u{"quux": "Arrêt sur images"}F)r)rrr	r)rZdoc1Zdoc2Z	doc_asciiZdoc_unicoderrr�+test_ensure_ascii_false_bytestring_encoding]sz7TestUnicode.test_ensure_ascii_false_bytestring_encodingcCsjd}|jd�}d}d}|jtj|�|�|jtj|�|�|jtj|dd�|�|jtj|dd�|�dS)Nu

�utf8z"\u2029\u2028"u"

"F)r)r
rr	r)r�s1�s2�expectZexpect_non_asciirrr�$test_ensure_ascii_linebreak_encodinghs
z0TestUnicode.test_ensure_ascii_linebreak_encodingcCsB|jtjtjd�|jtjtjd�|jtjtjd�|jtjtjd�|jtjtjd�|jtjtjd�|jtjtjd�|jtjtjd�|jtjtjd	�tjd
k�r>|jtjtjd�|jtjtjd�|jtjtjd
�|jtjtjd�|jtjtjd�|jtjtjd�|jtjtjd�|jtjtjd�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�
maxunicode)rrrr�test_invalid_escape_sequencesss$z)TestUnicode.test_invalid_escape_sequencescCs\x4tttdd��D] }|jtj|dd�tj|��qWd}|jtj|dd�d|d�dS)Nr�F)ru☃r)�maprr!rr	r)r�cZsnowmanrrr�test_ensure_ascii_still_works�sz)TestUnicode.test_ensure_ascii_still_workscCs\d}tjttj|��}|jtjt|��|�x(||jd�fD]}|jtj	|�|�q>WdS)NuこんにちわrA)
�codecs�BOM_UTF8rr	rr�loadr�decoder)rZcontentZjson_doc�docrrr�test_strip_bom�s
zTestUnicode.test_strip_bomN)�__name__�
__module__�__qualname__rrrrrrrr r#r9r<r=r?r@rErHrLrRrrrrrs$r)rFrMZunittestrZ
simplejsonr	Zsimplejson.compatrrrrrrrrr�<module>s