o
    È·e!  ã                   @   sH   d dl Z d dlZd dlmZ d dlZd dlmZmZ G dd„ deƒZ	dS )é    N)ÚTestCase)Ú	text_typeÚbc                   @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )Ú
TestErrorsc                 C   s\   dddddœg}zt  |¡ W n ty   t ¡ d }Y nw |  d¡ |  t|ƒd¡ d S )	NÚA)é   é   g      @zD tuple)Úar   Úc)Údé   úExpected TypeErrorz5keys must be str, int, float, bool or None, not tuple©ÚjsonÚdumpsÚ	TypeErrorÚsysÚexc_infoÚfailÚassertEqualÚstr)ÚselfÚdataÚerr© r   úS/var/www/ideatree/venv/lib/python3.10/site-packages/simplejson/tests/test_errors.pyÚtest_string_keys_error   s   ÿ

ÿz!TestErrors.test_string_keys_errorc                 C   sL   zt  t ¡ W n ty   t ¡ d }Y nw |  d¡ |  t|ƒd¡ d S )Nr   r   z.Object of type module is not JSON serializabler   ©r   r   r   r   r   Útest_not_serializable   s   ÿ

ÿz TestErrors.test_not_serializablec                 C   sz   d }zt  d¡ W n t jy   t ¡ d }Y nw |  d¡ |  |jd¡ |  |jd¡ |  |j	d¡ |  |j
d¡ d S )Nú{}
a
br   úExpected JSONDecodeErrorr   é   )r   ÚloadsÚJSONDecodeErrorr   r   r   r   ÚlinenoÚcolnoÚ	endlinenoÚendcolnor   r   r   r   Útest_decode_error   s   ÿ
zTestErrors.test_decode_errorc              	   C   sp   d }t tfD ]/}z	t |dƒ¡ W n tjy!   t ¡ d }Y nw |  d¡ |  |j	d¡ |  |j
d¡ qd S )Nz
{"asdf": "r   r    é
   )r   r   r   r"   r#   r   r   r   r   r$   r%   )r   r   Útr   r   r   Útest_scan_error*   s   ÿ
øzTestErrors.test_scan_errorc                 C   s–   d }zt  d¡ W n t jy   t ¡ d }Y nw |  d¡ t |¡}t |¡}|  |j	|j	¡ |  |j
|j
¡ |  |j|j¡ |  |j|j¡ d S )Nr   r   r    )r   r"   r#   r   r   r   Úpickler   r   ÚmsgÚdocÚposÚend)r   r   ÚsÚer   r   r   Útest_error_is_pickable6   s   ÿ


z!TestErrors.test_error_is_pickableN)Ú__name__Ú
__module__Ú__qualname__r   r   r(   r+   r3   r   r   r   r   r      s    
r   )
r   r,   Úunittestr   Ú
simplejsonr   Úsimplejson.compatr   r   r   r   r   r   r   Ú<module>   s
    