
    <e/                     t    d dl Z d dlmZmZ  G d d          Z G d dee          Z G d dee          ZdS )	    N)PyTestCTestc                   &    e Zd Zd Zd Zd Zd ZdS )TestScanstringc                 P   | j         j        j        }|                      |ddd          d           |                      |ddd          d           |                      |ddd          d           |                      |d	d
d          d           |                      |dd
d          d           |                      |dd
d          d           |                      |dd
d          d           |                      |dd
d          d           |                      |dd
d          d           |                      |dd
d          d           |                      |dd
d          d           |                      |dd
d          d           |                      |dd
d          d           |                      |dd
d          d           |                      |d d!d          d"           |                      |d#d
d          d$           |                      |d%d
d          d&           |                      |d'd
d          d(           |                      |d)d
d          d*           |                      |d+d
d          d,           d S )-Nu   "z𝄠x"   T)   z𝄠x   z"\u007b"){   z<"A JSON payload should be an object or array, not a string.")z:A JSON payload should be an object or array, not a string.<   z["Unclosed array"   )zUnclosed array   z["extra comma",])zextra comma   z["double extra comma",,])zdouble extra comma   z["Comma after the close"],)zComma after the close   z["Extra close"]])zExtra closer   z{"Extra comma": true,})zExtra commar   z:{"Extra value after close": true} "misplaced quoted value")zExtra value after close   z{"Illegal expression": 1 + 2})zIllegal expressionr   z{"Illegal invocation": alert()})zIllegal invocationr   z+{"Numbers cannot have leading zeroes": 013})z"Numbers cannot have leading zeroes%   z{"Numbers cannot be hex": 0x14})zNumbers cannot be hexr   z2[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]r   )zToo deep   z{"Missing colon" null})zMissing colon   z{"Double colon":: null})zDouble colon   z {"Comma instead of colon", null})zComma instead of colon   z!["Colon instead of comma": false])zColon instead of commar   z["Bad value", truth])z	Bad value   )jsondecoder
scanstringassertEqual)selfr   s     5/usr/lib/python3.11/test/test_json/test_scanstring.pytest_scanstringzTestScanstring.test_scanstring   s   Y&1
J'D11	! 	! 	! 	J{At,,	 	 	 	JUWXZ^__N	P 	P 	P 	J*At44"	$ 	$ 	$ 	J)1d33	! 	! 	! 	J11d;;&	( 	( 	( 	J3Q==)	+ 	+ 	+ 	J)1d33	! 	! 	! 	J/D99	! 	! 	! 	JSUVX\]]+	- 	- 	- 	J64@@&	( 	( 	( 	J8!TBB&	( 	( 	( 	JDaNN6	8 	8 	8 	J8!TBB)	+ 	+ 	+ 	JKRQUVV	 	 	 	J/D99!	# 	# 	# 	J0!T:: 	" 	" 	" 	J91dCC*	, 	, 	, 	J:AtDD*	, 	, 	, 	J-q$77	 	 	 	 	    c                      j         j        j         fd} |dd            |dd            |dd            |dd	            |d
d            |dd            |dd            |dd            |dd	           d S )Nc                 h                          | dd          |t          |           f           d S )Nr   T)r   len)givenexpectr   r   s     r   
assertScanz2TestScanstring.test_surrogates.<locals>.assertScanZ   sC    ZZq$77$c%jj13 3 3 3 3r!   z"z\ud834\u0079x"u   zyxz"z\ud834\udd20x"r	   z"z\ud834\ud834\udd20x"u	   z𝄠xz
"z\ud834x"u   zxu   "z\ud834x12345"u   zx12345z
"z\udd20x"u   zxu
   "zx"u   zxu   "z\udd20x"u   "zx")r   r   r   )r   r'   r   s   ` @r   test_surrogateszTestScanstring.test_surrogatesX   s    Y&1
	3 	3 	3 	3 	3 	3 	
'555
'888
.0DEEE
=*---
+-BCCC
=*---
%'7888
&(8999
<,,,,,r!   c                     | j         j        j        }g d}|D ]C}|                     | j        |          5   ||dd           d d d            n# 1 swxY w Y   Dd S )N)z"\"z"\x"z"\u"z"\u0"z"\u01"z"\u012"z"\uz012"z"\u0z12"z"\u01z2"z"\u012z"z"\u0x12"z"\u0X12"z	"\ud834\"z
"\ud834\u"z"\ud834\ud"z"\ud834\udd"z"\ud834\udd2"z"\ud834\uzdd2"z"\ud834\udzd2"z"\ud834\uddz2"z"\ud834\udd2z"z"\ud834\u0x20"z"\ud834\u0X20")msgr   T)r   r   r   assertRaisesJSONDecodeError)r   r   bad_escapesss       r   test_bad_escapeszTestScanstring.test_bad_escapesh   s    Y&1

 
 
2  	' 	'A""4#7Q"?? ' '
1a&&&' ' ' ' ' ' ' ' ' ' ' ' ' ' '	' 	's   AA	A	c                     |                      t                    5  | j        j                            dt
          j        dz              d d d            d S # 1 swxY w Y   d S )Ns   xxxr   )r+   OverflowErrorr   r   r   sysmaxsize)r   s    r   test_overflowzTestScanstring.test_overflow   s    }-- 	@ 	@I((Q???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s   .AAAN)__name__
__module____qualname__r    r(   r/   r4    r!   r   r   r      sY        P P Pd- - - ' ' '>@ @ @ @ @r!   r   c                       e Zd ZdS )TestPyScanstringNr5   r6   r7   r8   r!   r   r:   r:                r!   r:   c                       e Zd ZdS )TestCScanstringNr;   r8   r!   r   r>   r>      r<   r!   r>   )r2   test.test_jsonr   r   r   r:   r>   r8   r!   r   <module>r@      s    



 ( ( ( ( ( ( ( (D@ D@ D@ D@ D@ D@ D@ D@N 5 4 4 4 4~v 4 4 4 2 2 2 2 2ne 2 2 2 2 2r!   