관리-도구
편집 파일: test_fail.cpython-37.opt-1.pyc
B VX�Y� � : @ s� d dl Z d dlmZ d dlZddddddd d ddd ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<g:Zd=d>d?�ZG d@dA� dAe�ZdS )B� N)�TestCasez<"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"ZnulZnulx�-z-xz-ez-e0z -Infinitez-InfZInfinitZInfiniteZNaMZNuNZfalsyZfalZtrugZtruZ1eZ1exz1e-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 sn xht t�D ]\\}}|d }|tkr.t�|� q yt�|� W n tjk rR Y q X | �d||f � q W d S )Nr z$Expected failure for fail%d.json: %r)� enumerate�JSONDOCS�SKIPS�json�loads�JSONDecodeError�fail)�self�idx�doc� r �M/opt/alt/python37/lib64/python3.7/site-packages/simplejson/tests/test_fail.py� test_failuresm s zTestFail.test_failuresc C s� x�dD ]�}yt �|� W n| t jk rd t�� d }| �|jd� | �|jd� | �|jd� Y q t k r� t�� d }| � d||f � Y qX | � d� qW d S )N)z[,]z[,]r � z!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� ddddddddd d ddd dddddg}x�|D ]�\}}}yt �|� W n� t jk r� t�� d }| �|jd t|�� |d|j||f � | �|j|d|j||f � Y q. t k r� t�� d }| � d||f � Y q.X | � d|f � q.W d S )N)� zExpecting valuer )�[zExpecting value or ']'r )z[42zExpecting ',' delimiter� )z[42,zExpecting value� )z["zUnterminated string starting atr )z["spamzUnterminated string starting atr )z["spam"zExpecting ',' delimiter� )z["spam",zExpecting value� )r z1Expecting property name enclosed in double quotesr )z{"zUnterminated string starting atr )z{"spamzUnterminated string starting atr )z{"spam"zExpecting ':' delimiterr# )z{"spam":zExpecting valuer$ )z {"spam":42zExpecting ',' delimiter� )z{"spam":42,z1Expecting property name enclosed in double quotes� )�"zUnterminated string starting atr )z"spamzUnterminated string starting atr )z[,zExpecting valuer r z%r doesn't start with %r for %rzpos %r != %r for %rz!Unexpected exception raised %r %szUnexpected 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� sD zTestFail.test_truncated_inputN)�__name__� __module__�__qualname__r r r+ r r r r r l s r )r Zunittestr Z simplejsonr r r r r r r r �<module> s~