a
    Šxd6  ã                   @   sB   d dl Z d dlmZ d dlZg d¢ZdddœZG dd„ deƒZdS )	é    N)ÚTestCase):z<"A JSON payload should be an object or array, not a string."z["Unclosed array"z%{unquoted_key: "keys must be quoted"}z["extra comma",]z["double extra comma",,]z[   , "<-- missing value"]z["Comma after the close"],z["Extra close"]]z{"Extra comma": true,}z:{"Extra value after close": true} "misplaced quoted value"z{"Illegal expression": 1 + 2}z{"Illegal invocation": alert()}z+{"Numbers cannot have leading zeroes": 013}z{"Numbers cannot be hex": 0x14}z"["Illegal backslash escape: \x15"]z[\naked]z"["Illegal backslash escape: \017"]z2[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]z{"Missing colon" null}z{"Double colon":: null}z {"Comma instead of colon", null}z!["Colon instead of comma": false]z["Bad value", truth]z['single quote']z["	tab	character	in	string	"]z&["tab\   character\   in\  string\  "]z["line
break"]z["line\
break"]z[0e]z[0e+]z[0e+-1]z({"Comma instead if closing brace": true,z["mismatch"}z$["AZ control characters in string"]Ú{z{]z{"foo": "bar"]z{"foo": "bar"ÚnulZnulxú-z-xz-ez-e0z	-Infinitez-InfZInfinitÚInfiniteZNaMZNuNZfalsyZfalZtrugZtruZ1eZ1exz1e-z1e-xzwhy not have a string payload?z,spec doesn't specify any nesting limitations)é   é   c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚTestFailc              	   C   sh   t tƒD ]Z\}}|d }|tv r,t |¡ qzt |¡ W n tjyN   Y q0 |  d||f ¡ qd S )Nr   z$Expected failure for fail%d.json: %r)Ú	enumerateÚJSONDOCSÚSKIPSÚjsonÚloadsÚJSONDecodeErrorÚfail)ÚselfÚidxÚdoc© r   úR/var/www/html/Ranjet/env/lib/python3.9/site-packages/simplejson/tests/test_fail.pyÚtest_failuresm   s    
zTestFail.test_failuresc              	   C   s    dD ]–}zt  |¡ W nx t jy`   t ¡ d }|  |jd¡ |  |jd¡ |  |jd¡ Y q t	yŽ   t ¡ d }|  
d||f ¡ Y q0 |  
d¡ qd S )N)ú[,]r   r   é   ú!Unexpected exception raised %r %sz Unexpected success parsing '[,]')r   r   r   ÚsysÚexc_infoÚassertEqualÚposÚlinenoÚcolnoÚ	Exceptionr   )r   r   Úer   r   r   Útest_array_decoder_issue46z   s    z#TestFail.test_array_decoder_issue46c                 C   sÎ   g d¢}|D ]¼\}}}zt  |¡ W n’ t jyˆ   t ¡ d }|  |jd t|ƒ… |d|j||f ¡ |  |j|d|j||f ¡ Y q t	y¶   t ¡ d }|  
d||f ¡ Y q0 |  
d|f ¡ qd S )N))Ú úExpecting valuer   )ú[zExpecting value or ']'r   )z[42úExpecting ',' delimiteré   )z[42,r$   é   )z["úUnterminated string starting atr   )z["spamr)   r   )z["spam"r&   é   )z["spam",r$   é   )r   z8Expecting property name enclosed in double quotes or '}'r   )z{"r)   r   )z{"spamr)   r   )z{"spam"zExpecting ':' delimiterr*   )z{"spam":r$   r+   )z
{"spam":42r&   é
   )z{"spam":42,z1Expecting property name enclosed in double quotesé   )ú"r)   r   )z"spamr)   r   )z[,r$   r   )z--r$   r   )z"dzInvalid control character %rr   r   z%r doesn't start with %r for %rzpos %r != %r for %rr   zUnexpected success parsing '%r')r   r   r   r   r   r   ÚmsgÚlenr   r    r   )r   Z
test_casesÚdatar/   r   r!   r   r   r   Útest_truncated_inputŠ   s&    ýþzTestFail.test_truncated_inputN)Ú__name__Ú
__module__Ú__qualname__r   r"   r2   r   r   r   r   r	   l   s   r	   )r   Zunittestr   Z
simplejsonr   r   r   r	   r   r   r   r   Ú<module>   s   aþ