
    <ei	                         d dl mZ d dlmZ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 )    )StringIO)PyTestCTest)
bigmemtest_1Gc                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )TestDumpc                     t                      }| j                            i |           |                     |                                d           d S Nz{})r   jsondumpassertEqualgetvalue)selfsios     //usr/lib/python3.11/test/test_json/test_dump.py	test_dumpzTestDump.test_dump   sE    jj	r3.....    c                 X    |                      |                     i           d           d S r   r   dumpsr   s    r   
test_dumpszTestDump.test_dumps   s(    B.....r   c                 l   ddd}|                      t                    5  | j                            |           d d d            n# 1 swxY w Y   | j                            |d          }| j                            |          }|                     d|           |                     d|           d S )NFT)   invalid_key	valid_key)skipkeysr   r   )assertRaises	TypeErrorr   r   loadsassertInassertNotIn)r   vsos       r   test_dump_skipkeyszTestDump.test_dump_skipkeys   s    "66y)) 	 	IOOA	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 IOOAO--IOOAk1%%%+++++s   AAAc           	          |                      |                     dddd          d           |                      |                     ddddd	d          d
           d S )NFT)TF	sort_keysz{"false": true, "true": false}g      @      )   g      @F   z+{"false": 1, "2": 3.0, "4.0": 5, "6": true}r   r   s    r   test_encode_truefalsezTestDump.test_encode_truefalse   s    d++t $ = =1	3 	3 	3 	ad33t $ E E=	? 	? 	? 	? 	?r   c                     t                      gdz  fd}|                     |                     |          d           d S )N
   c                     d= d S )N )objas    r   crasherz-TestDump.test_encode_mutated.<locals>.crasher$   s    "r   )defaultz[null, null, null, null, null])objectr   r   )r   r6   r5   s     @r   test_encode_mutatedzTestDump.test_encode_mutated"   sb    XXJO	 	 	 	 	Aw771	3 	3 	3 	3 	3r   c                      G fddt                     } G fdd          fdt          d          D              |            }d|d<   |                     |                     |d	
          d           d S )Nc                       e Zd Z fdZdS ))TestDump.test_encode_evil_dict.<locals>.Dc                     S )Nr3   r   Ls    r   keysz.TestDump.test_encode_evil_dict.<locals>.D.keys,   s    r   N)__name__
__module____qualname__r@   r?   s   r   Dr<   +   s.              r   rE   c                        e Zd Z fdZd ZdS ))TestDump.test_encode_evil_dict.<locals>.Xc                     d= dS )Nr   9  r3   r>   s    r   __hash__z2TestDump.test_encode_evil_dict.<locals>.X.__hash__0   s    aDtr   c                     dS )Nr   r3   )r   r%   s     r   __lt__z0TestDump.test_encode_evil_dict.<locals>.X.__lt__4   s    qr   N)rA   rB   rC   rJ   rL   rD   s   r   XrG   /   s=                r   rM   c                 $    g | ]}             S r3   r3   ).0irM   s     r   
<listcomp>z2TestDump.test_encode_evil_dict.<locals>.<listcomp>7   s    &&&QQQSS&&&r   ib  ztrue.datrI   Tr(   z{"1337": "true.dat"})dictranger   r   )r   rE   dr?   rM   s      @@r   test_encode_evil_dictzTestDump.test_encode_evil_dict*   s    	 	 	 	 	 	 	 	 	 		 	 	 	 	 	 	 	 	 	 '&&&%++&&&ACC$A668NOOOOOr   N)	rA   rB   rC   r   r   r&   r.   r9   rU   r3   r   r   r	   r	      ss        / / /
/ / /, , ,? ? ?3 3 3P P P P Pr   r	   c                       e Zd ZdS )
TestPyDumpN)rA   rB   rC   r3   r   r   rW   rW   =   s          r   rW   c                   :    e Zd Z eed          d             ZdS )	TestCDumpr+   )sizememusec                 |   t          d|t          z  z            }dg|z  }|                     |          }|                     t	          |          |dz             |                     |d d         d           |                     |dd          d           |                     |dd         d|dz
  z             d S )Ni  r+      [z1]z1, )intr   r   r   len)r   rZ   Nlencodeds        r   test_large_listzTestCDump.test_large_listF   s     D3J/00C!G**Q--Wq1u---!c***t,,,2Q88888r   N)rA   rB   rC   r   r   re   r3   r   r   rY   rY   ?   s?         ZS###9 9 $#9 9 9r   rY   N)ior   test.test_jsonr   r   test.supportr   r   r	   rW   rY   r3   r   r   <module>ri      s          ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (4P 4P 4P 4P 4P 4P 4P 4Pn ) ( ( ( (6 ( ( (9 9 9 9 9% 9 9 9 9 9r   