
    <e$                         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dS )
    N)OrderedDict)PyTestCTestc                   P    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S )TestUnicodec                 `    d}|                      |          }|                     |d           d S )N   αΩz"\u03b1\u03a9"dumpsassertEqualselfujs      2/usr/lib/python3.11/test/test_json/test_unicode.pytest_encoding3zTestUnicode.test_encoding3
   s3    HJJqMM./////    c                 b    d}|                      |g          }|                     |d           d S )Nr	   z["\u03b1\u03a9"]r
   r   s      r   test_encoding4zTestUnicode.test_encoding4   s5    HJJsOO011111r   c                     d}|                      |d          }|                     |d                    |                     d S )Nr	   Fensure_asciiz"{0}"r   r   formatr   s      r   test_encoding5zTestUnicode.test_encoding5   sD    HJJquJ--GNN1--.....r   c                     d}|                      |gd          }|                     |d                    |                     d S )Nr	   Fr   z["{0}"]r   r   s      r   test_encoding6zTestUnicode.test_encoding6   sH    HJJsJ//I,,Q//00000r   c                     d}|                      |                     |          d           |                      |                     |d          d           d S )Nu   𝄠z"\ud834\udd20"Fr   u   "𝄠")r   r   r   r   s     r   test_big_unicode_encodez#TestUnicode.test_big_unicode_encode   sT    A(:;;;AE::NKKKKKr   c                     d}|                      |                     d|z   dz             |           |                      |                     d          |           d S )Nu   z𝄠x"z"z\ud834\udd20x")r   loadsr   s     r   test_big_unicode_decodez#TestUnicode.test_big_unicode_decode#   sZ    C!GcM22A666$8991=====r   c                     t          dd          D ]O}t          |          }d                    |          }|                     |                     |          |           Pd S )Nr   i  z"\u{0:04x}")rangechrr   r   r#   )r   ir   ss       r   test_unicode_decodezTestUnicode.test_unicode_decode(   sf    q&!! 	/ 	/AAA%%a((ATZZ]]A....	/ 	/r   c                 t   |                      t          |                     d                    t                     |                      t          |                     d                    t                     |                      t          |                     d          d                   t                     d S )Nz""z"a"z["a"]r   )r   typer#   strr   s    r   test_unicode_preservationz%TestUnicode.test_unicode_preservation.   s    djj..//555djj//00#666djj11!455s;;;;;r   c                     |                      t          | j        d           |                      t          | j        dg           d S )Ns   hi)assertRaises	TypeErrorr   r.   s    r   test_bytes_encodezTestUnicode.test_bytes_encode3   s>    )TZ777)TZ%99999r   c                 H   dt           j        fdt           j        fdt           j        fdt           j        fdt           j        ffD ]\  }}dg}|                     |                              |          }|                     | 	                    ||z             |           |                     | 	                    |          |           | 
                    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#   r1   UnicodeDecodeError)r   encodingbomdataencodeds        r   test_bytes_decodezTestUnicode.test_bytes_decode7   s   &/*V01V01V01V01 
	8 
	8MHc ,,Djj&&--h77GTZZg66===TZZ00$7777,dj+FFF
 	J$5$5k$B$BCC!	# 	# 	# 	H--q111H--q111E**B/////r   c                 "   d}g d}|                      |                     |          t          |                     |                      |                     |d           |           |                     |t                    }|                      |t          |                     |                      t	          |          t                     |                      |                     |t          d           t          |                     d S )Nz?{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}))xkd   )kcw   )art   )hxm   )qrtr5   )pad   )hoyr6   c                     | S N xs    r   <lambda>zATestUnicode.test_object_pairs_hook_with_unicode.<locals>.<lambda>W   s    Q r   )object_pairs_hookc                     d S rS   rT   rU   s    r   rW   zATestUnicode.test_object_pairs_hook_with_unicode.<locals>.<lambda>]   s    D r   )rX   object_hook)r   r#   evalr   r,   )r   r)   pods       r   #test_object_pairs_hook_with_unicodez/TestUnicode.test_object_pairs_hook_with_unicodeR   s    M1 1 1AQ000A;;GGKKKZZ{Z;;[^^,,,b;///A;2@. $ B B$Q	) 	) 	) 	) 	)r   N)__name__
__module____qualname__r   r   r   r   r    r$   r*   r/   r3   rD   r^   rT   r   r   r   r      s        0 0 0
2 2 2
/ / /
1 1 1
L L L
> > >
/ / /< < <
: : :0 0 06) ) ) ) )r   r   c                       e Zd ZdS )TestPyUnicodeNr_   r`   ra   rT   r   r   rc   rc   a             r   rc   c                       e Zd ZdS )TestCUnicodeNrd   rT   r   r   rg   rg   b   re   r   rg   )	r8   collectionsr   test.test_jsonr   r   r   rc   rg   rT   r   r   <module>rj      s     # # # # # # ( ( ( ( ( ( ( (X) X) X) X) X) X) X) X)v / . . . .K . . . , , , , ,; , , , , ,r   