o
    È·eÊ  ã                   @   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"ÚnulÚnulxú-z-xz-ez-e0z	-Infinitez-InfÚInfinitÚInfiniteÚNaMÚNuNÚfalsyÚfalÚtrugÚtruÚ1eÚ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 ]-\}}|d }|tv rt |¡ qzt |¡ W n
 tjy'   Y qw |  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   úQ/var/www/ideatree/venv/lib/python3.10/site-packages/simplejson/tests/test_fail.pyÚtest_failuresm   s   
ÿözTestFail.test_failuresc              	   C   s    dD ]K}zt  |¡ W n< t jy0   t ¡ d }|  |jd¡ |  |jd¡ |  |jd¡ Y q t	yG   t ¡ d }|  
d||f ¡ Y qw |  
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 nI t jyD   t ¡ d }|  |jd t|ƒ… |d|j||f ¡ |  |j|d|j||f ¡ Y q t	y[   t ¡ d }|  
d||f ¡ Y qw |  
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["spamr3   r   )z["spam"r0   é   )z["spam",r.   é   )r   ú1Expecting property name enclosed in double quotesr   )z{"r3   r   )z{"spamr3   r   )z{"spam"zExpecting ':' delimiterr4   )z{"spam":r.   r5   )z
{"spam":42r0   é
   )z{"spam":42,r6   é   )ú"r3   r   )z"spamr3   r   )z[,r.   r   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   Ú
test_casesÚdatar:   r   r+   r   r   r   Útest_truncated_inputŠ   s*   ýþþðzTestFail.test_truncated_inputN)Ú__name__Ú
__module__Ú__qualname__r    r,   r>   r   r   r   r   r   l   s    r   )r$   Úunittestr   Ú
simplejsonr   r   r   r   r   r   r   r   Ú<module>   s    aþ