a
    "h                      @   sN   d dl mZ G dd dZG dd deZG dd deZG dd	 d	eZd
S )    )CTestc                   @   s   e Zd Zdd ZdS )BadBoolc                 C   s   dd  d S N   r    selfr   r   D/opt/python-3.9.21/usr/lib/python3.9/test/test_json/test_speedups.py__bool__   s    zBadBool.__bool__N)__name__
__module____qualname__r
   r   r   r   r	   r      s   r   c                   @   s   e Zd Zdd Zdd ZdS )TestSpeedupsc                 C   s0   |  | jjjjd | | jjj| jjj d S NZ_json)assertEqualjsondecoderZ
scanstringr   assertIsZc_scanstringr   r   r   r	   test_scanstring
   s    zTestSpeedups.test_scanstringc                 C   s0   |  | jjjjd | | jjj| jjj d S r   )r   r   encoderZencode_basestring_asciir   r   Zc_encode_basestring_asciir   r   r   r	   test_encode_basestring_ascii   s    z)TestSpeedups.test_encode_basestring_asciiN)r   r   r   r   r   r   r   r   r	   r   	   s   r   c                   @   s   e Zd Zdd Zdd ZdS )
TestDecodec                 C   s   |  t| jjjd d S )Nr   )assertRaisesAttributeErrorr   scannerZc_make_scannerr   r   r   r	   test_make_scanner   s    zTestDecode.test_make_scannerc                    s,    fdd}  t|d   t|d d S )Nc                    s    j jjt d|  d S )N)strict)r   r   ZJSONDecoderr   decode)valuer   r   r	   test   s    z+TestDecode.test_bad_bool_args.<locals>.testz""z{}r   ZeroDivisionErrorr   r   r   r   r	   test_bad_bool_args   s    zTestDecode.test_bad_bool_argsN)r   r   r   r   r#   r   r   r   r	   r      s   r   c                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )
TestEncodec                 C   s   |  t| jjjddd  d S )N)TFs   }=NLyR'J}u)r   	TypeErrorr   r   c_make_encoderr   r   r   r	   test_make_encoder!   s
    zTestEncode.test_make_encoderc                 C   s   dd }| j jd dd |d ddddd	}| t |dd	 W d    n1 sT0    Y  | t |dd
id	 W d    n1 s0    Y  dd }| j jd dd |d ddddd	}| t |dd	 W d    n1 s0    Y  d S )Nc                  W   s   d S Nr   argsr   r   r	   bad_encoder1,   s    z5TestEncode.test_bad_str_encoder.<locals>.bad_encoder1c                 S   s   t | S r(   strobjr   r   r	   <lambda>.       z1TestEncode.test_bad_str_encoder.<locals>.<lambda>: , FZspam   *   c                  W   s   dd  d S r   r   r)   r   r   r	   bad_encoder26   s    z5TestEncode.test_bad_str_encoder.<locals>.bad_encoder2c                 S   s   t | S r(   r,   r.   r   r   r	   r0   8   r1   )r   r   r&   r   r%   r!   )r   r+   encr6   r   r   r	   test_bad_str_encoder)   s     (,zTestEncode.test_bad_str_encoderc                 C   sN   |  td. | jjdd d d ddddd	 W d    n1 s@0    Y  d S )Nz9make_encoder\(\) argument 1 must be dict or None, not intr   r2   r3   F)ZassertRaisesRegexr%   r   r   r&   r   r   r   r	   $test_bad_markers_argument_to_encoder>   s    z/TestEncode.test_bad_markers_argument_to_encoderc                    sV    fdd}  t|d   t|d   t|d   t|d   t|d d S )Nc                    s(    j jjf i | t iddi d S )Nar   )r   r   JSONEncoderr   encode)namer   r   r	   r   H   s    z+TestEncode.test_bad_bool_args.<locals>.testZskipkeysZensure_asciiZcheck_circularZ	allow_nan	sort_keysr    r"   r   r   r	   r#   G   s    zTestEncode.test_bad_bool_argsc                 C   sJ   |  t, | jjjddddd W d    n1 s<0    Y  d S )NT)r>   r   r:   )r:   r   )r   r%   r   r   r;   r<   r   r   r   r	   test_unsortable_keysP   s    zTestEncode.test_unsortable_keysN)r   r   r   r'   r8   r9   r#   r?   r   r   r   r	   r$       s
   		r$   N)Ztest.test_jsonr   r   r   r   r$   r   r   r   r	   <module>   s   