B
    v9a
                 @   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   #/usr/lib/python3.7/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 )N_json)assertEqualjsondecoderZ
scanstringr
   assertIsZc_scanstring)r   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 )Nr   )r   r   encoderZencode_basestring_asciir
   r   Zc_encode_basestring_ascii)r   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_scanner)r   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)value)r   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               @   s,   e Z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_encoder)r   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 Q R X | t |dd
id	 W d Q R X dd }| j jd dd |d ddddd	}| t |dd	 W d Q R X 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 )N)str)objr   r   r   <lambda>,       z1TestEncode.test_bad_str_encoder.<locals>.<lambda>z: z, FZspam   *   c              W   s   dd  d S )Nr   r   r   )r$   r   r   r   bad_encoder24   s    z5TestEncode.test_bad_str_encoder.<locals>.bad_encoder2c             S   s   t | S )N)r&   )r'   r   r   r   r(   6   r)   )r   r   r"   r   r!   r   )r   r%   encr,   r   r   r   test_bad_str_encoder'   s    

zTestEncode.test_bad_str_encoderc                sV    fdd}  t|d   t|d   t|d   t|d   t|d d S )Nc                s$    j jjf | t iddi d S )Nar   )r   r   JSONEncoderr   encode)name)r   r   r   r   =   s    z+TestEncode.test_bad_bool_args.<locals>.testZskipkeysZensure_asciiZcheck_circularZ	allow_nan	sort_keys)r   r   )r   r   r   )r   r   r   <   s    zTestEncode.test_bad_bool_argsc          	   C   s6   |  t" | jjjddddd W d Q R X d S )NT)r3   r   r/   )r/   r   )r   r!   r   r   r0   r1   )r   r   r   r   test_unsortable_keysE   s    zTestEncode.test_unsortable_keysN)r	   r
   r   r#   r.   r   r4   r   r   r   r   r        s   	r    N)Ztest.test_jsonr   r   r   r   r    r   r   r   r   <module>   s   