o
    KXh$                     @   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   E/opt/python-3.10.19/usr/lib/python3.10/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 ]#\}}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   579   )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                   @      e Zd ZdS )TestPyUnicodeNrE   rF   rG   r   r   r   r   rI   a       rI   c                   @   rH   )TestCUnicodeNrJ   r   r   r   r   rL   b   rK   rL   )	r+   collectionsr   Ztest.test_jsonr   r   r   rI   rL   r   r   r   r   <module>   s    [