Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/simplejson/tests/__pycache__/ |
Upload File : |
o \Փa� � @ sB d dl Z d dlmZ d dlZg d�Zddd�ZG dd� de�ZdS ) � 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$["AZ 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�1exz1e-z1e-xzwhy not have a string payload?z,spec doesn't specify any nesting limitations)� � c @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�TestFailc C sh t t�D ]-\}}|d }|tv rt�|� qzt�|� W n tjy' Y qw | �d||f � qd S )Nr z$Expected failure for fail%d.json: %r)� enumerate�JSONDOCS�SKIPS�json�loads�JSONDecodeError�fail)�self�idx�doc� r �</usr/lib/python3/dist-packages/simplejson/tests/test_fail.py� test_failuresm s ��zTestFail.test_failuresc C s� dD ]K}zt �|� W n< t jy0 t�� d }| �|jd� | �|jd� | �|jd� Y q t yG t�� d }| � d||f � Y qw | � d� qd 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 ]^\}}}zt �|� W nI t jyD t�� d }| �|jd t|�� |d|j||f � | �|j|d|j||f � Y q t y[ t�� d }| � d||f � Y qw | � d|f � qd S )N))� �Expecting valuer )�[zExpecting 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"zExpecting ':' 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 %rzpos %r != %r for %rr# zUnexpected success parsing '%r')r r r r$ r% r&