
    daf                     l    d dl Z d dlmZ d dlmZmZ  G d d      Z G d dee      Z G d d	ee      Zy)
    N)OrderedDict)PyTestCTestc                   T    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zy)TestUnicodec                 N    d}| j                  |      }| j                  |d       y )N   αΩz"\u03b1\u03a9"dumpsassertEqualselfujs      6/root/Python-3.12.4/Lib/test/test_json/test_unicode.pytest_encoding3zTestUnicode.test_encoding3
   s%    HJJqM./    c                 P    d}| j                  |g      }| j                  |d       y )Nr	   z["\u03b1\u03a9"]r
   r   s      r   test_encoding4zTestUnicode.test_encoding4   s'    HJJsO01r   c                 Z    d}| j                  |d      }| j                  |d| d       y )Nr	   Fensure_ascii"r
   r   s      r   test_encoding5zTestUnicode.test_encoding5   s1    HJJquJ-as!H%r   c                 \    d}| j                  |gd      }| j                  |d| d       y )Nr	   Fr   z["z"]r
   r   s      r   test_encoding6zTestUnicode.test_encoding6   s3    HJJsJ/b2J'r   c                 `    d}| j                  |dz   d      }| j                  |d| d       y )Nr	   
Fr   r   z\n"r
   r   s      r   test_encoding7zTestUnicode.test_encoding7   s5    HJJq4xeJ4as$K(r   c                     d}| j                  | j                  |      d       | j                  | j                  |d      d       y )Nu   𝄠z"\ud834\udd20"Fr   u   "𝄠")r   r   r   r   s     r   test_big_unicode_encodez#TestUnicode.test_big_unicode_encode#   s=    A(:;AE:NKr   c                     d}| j                  | j                  d| d      |       | j                  | j                  d      |       y )Nu   z𝄠xr   z"z\ud834\udd20x")r   loadsr!   s     r   test_big_unicode_decodez#TestUnicode.test_big_unicode_decode(   sB    as!H-q1$891=r   c                     t        dd      D ]5  }t        |      }d|dd}| j                  | j                  |      |       7 y )Nr   i  z"\u04xr   )rangechrr   r$   )r   ir   ss       r   test_unicode_decodezTestUnicode.test_unicode_decode-   sH    q&! 	/AAAqgQATZZ]A.	/r   c                    | j                  t        | j                  d            t               | j                  t        | j                  d            t               | j                  t        | j                  d      d         t               y )Nz""z"a"z["a"]r   )r   typer$   strr   s    r   test_unicode_preservationz%TestUnicode.test_unicode_preservation3   sa    djj./5djj/0#6djj1!45s;r   c                     | j                  t        | j                  d       | j                  t        | j                  dg       y )Ns   hi)assertRaises	TypeErrorr   r0   s    r   test_bytes_encodezTestUnicode.test_bytes_encode8   s0    )TZZ7)TZZ%9r   c                    dt         j                  fdt         j                  fdt         j                  fdt         j                  fdt         j
                  ffD ]m  \  }}dg}| j                  |      j                  |      }| j                  | j                  ||z         |       | j                  | j                  |      |       o | j                  t        | j                  d       | j                  | j                  dj                  d	            d
       | j                  | j                  d      d       | j                  | j                  d      d       | j                  | j                  d      d       y )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$   r3   UnicodeDecodeError)r   encodingbomdataencodeds        r   test_bytes_decodezTestUnicode.test_bytes_decode<   sC   &//*V001V001V001V001 
	8MHc ,,Djj&--h7GTZZg6=TZZ0$7
	8 	,djj+F
 	J$5$5k$BC!	# 	H-q1H-q1E*B/r   c                    d}g d}| j                  | j                  |      t        |             | j                  | j                  |d       |       | j                  |t              }| j                  |t        |             | j                  t	        |      t               | j                  | j                  |t        d       t        |             y )Nz?{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}))xkd   )kcw   )art   )hxm   )qrtr7   )pad   )hoyr8   c                     | S N xs    r   <lambda>zATestUnicode.test_object_pairs_hook_with_unicode.<locals>.<lambda>\   s    Q r   )object_pairs_hookc                      y rU   rV   rW   s    r   rY   zATestUnicode.test_object_pairs_hook_with_unicode.<locals>.<lambda>b   s    r   )rZ   object_hook)r   r$   evalr   r.   )r   r+   pods       r   #test_object_pairs_hook_with_unicodez/TestUnicode.test_object_pairs_hook_with_unicodeW   s    M1AQ0A;GKZZ{Z;[^,b;/A;2@ $ B$Q	)r   N)__name__
__module____qualname__r   r   r   r   r   r"   r%   r,   r1   r5   rF   r`   rV   r   r   r   r      s?    0
2
&
(
)
L
>
/<
:06)r   r   c                       e Zd Zy)TestPyUnicodeNra   rb   rc   rV   r   r   re   re   f       r   re   c                       e Zd Zy)TestCUnicodeNrf   rV   r   r   ri   ri   g   rg   r   ri   )	r:   collectionsr   test.test_jsonr   r   r   re   ri   rV   r   r   <module>rl      s1     # (]) ])@ /K . ,; ,r   