File: D:/Python311/Lib/test/test_json/__pycache__/test_fail.cpython-311.opt-1.pyc
�
��Vc,$ � �~ � d dl mZmZ g d�Zddd�Z G d� d� � Z G d� d ee� � Z G d
� dee� � ZdS )
� )�PyTest�CTest)"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"]zwhy not have a string payload?z,spec doesn't specify any nesting limitations)� � c �8 � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z dS ) �TestFailc � � t t � � D ]x\ }}|dz }|t v r| � |� � �) | � |� � | � d� ||� � � � �i# | j $ r Y �uw xY wd S )Nr z(Expected failure for fail{0}.json: {1!r})� enumerate�JSONDOCS�SKIPS�loads�fail�format�JSONDecodeError)�self�idx�docs �,D:\Python311\Lib\test\test_json\test_fail.py�
test_failureszTestFail.test_failuresQ s� � �!�(�+�+�
W�
W�H�C����'�C��e�|�
��
�
�3�����
W��
�
�3���� � � �D�K�K�C�QT�U�U�V�V�V�V�� �'�
�
�
���
����
W�
Ws �A>�>
B�
Bc � � ddd�}| � t d� � 5 | � |� � d d d � � d S # 1 swxY w Y d S )Nr � )�a)r r z5keys must be str, int, float, bool or None, not tuple)�assertRaisesRegex� TypeError�dumps)r �datas r �test_non_string_keys_dictz"TestFail.test_non_string_keys_dict^ s� � ��!�$�$��
�
#�
#�I�G�I� I� � ��J�J�t���� � � � � � � � � � � � ���� � � � � � s �A�A�Ac � � dd l }| � t d� � 5 | � |� � d d d � � d S # 1 swxY w Y d S )Nr z.Object of type module is not JSON serializable)�sysr r r )r r s r �test_not_serializablezTestFail.test_not_serializabled s� � ��
�
�
�
�
#�
#�I�@�B� B� � ��J�J�s�O�O�O� � � � � � � � � � � � ���� � � � � � s �A�A�
Ac � � g d�}|ddgz
}|D ]�\ }}}| � | j � � 5 }| � |� � d d d � � n# 1 swxY w Y |j }| � |j |� � | � |j |� � | � |j d� � | � |j |dz � � | � t |� � d||dz |fz � � ��d S )N))� �Expecting valuer )�[r# r )z[42�Expecting ',' delimiter� )z[42,r# � )z["�Unterminated string starting atr )z["spamr( r )z["spam"r% � )z["spam",r# � )�{�1Expecting property name enclosed in double quotesr )z{"r( r )z{"spamr( r )z{"spam"�Expecting ':' delimiterr) )z{"spam":r# r* )z
{"spam":42r% �
)z{"spam":42,r, � )�"r( r )z"spamr( r r �%s: line 1 column %d (char %d)�
�assertRaisesr r
� exception�assertEqual�msg�pos�lineno�colno�str�r �
test_casesr r6 r �cm�errs r �test_truncated_inputzTestFail.test_truncated_inputj sl � �
�
�
�
�"