
    dafj                         d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlZ G d dej                        Z
ed	k(  r ej                          yy)
z/test script for a few new invalid token catches    N)support)	os_helper)script_helper)warnings_helperc                       e Zd Zd Zd Zd Z ej                  e      d        Z	d Z
 ej                  ej                   d      d        Zy	)
EOFTestCasec                     d}dD ]   }	 t        | d       t        j                   y # t        $ rA}| j	                  t        |      |       | j	                  |j                  d       Y d }~id }~ww xY w)NzCunterminated string literal (detected at line 1) (<string>, line 1))'"zthis is a test                   evalr   
TestFailedSyntaxErrorassertEqualstroffset)selfexpectquotemsgs       (/root/Python-3.12.4/Lib/test/test_eof.pytest_EOF_single_quotez!EOFTestCase.test_EOF_single_quote   s|    V  	)E)% !   (((	)  0  S62  Q//0s   )	A37A..A3c                     d}	 t        d       t        j                  # t        $ rA}| j	                  t        |      |       | j	                  |j                  d       Y d }~y d }~ww xY w)NzQunterminated triple-quoted string literal (detected at line 1) (<string>, line 1)z'''this is a testr   r   r   r   r   s      r   	test_EOFSzEOFTestCase.test_EOFS   s`    e	%()
 $$$	  	,SXv.SZZ++	,s    	A)7A$$A)c                     d}t        j                         5 }t        j                  |dd      }t        j                  |      \  }}}d d d        | j                  d       y # 1 sw Y   xY w)Nz(<string>, line 1)fooz'''this is 
a 
tests>   unterminated triple-quoted string literal (detected at line 3)r   temp_dirr   make_scriptassert_python_failureassertIn)r   r   r    	file_namercouterrs          r   test_EOFS_with_filezEOFTestCase.test_EOFS_with_file!   sk    &! 	JX%11(EC^_I(>>yILBS	J 	WY\]	J 	Js   1A##A,)categoryc                     d}	 t        ddd       t        j                  # t        $ r%}| j	                  t        |      |       Y d }~y d }~ww xY w)N/unexpected EOF while parsing (<string>, line 1)z"\Xhh" \z<string>exec)compiler   r   r   r   r   r   s      r   test_eof_with_line_continuationz+EOFTestCase.test_eof_with_line_continuation(   sO    B	%L*f5 $$$  	/SXv..	/s   ! 	AA

Ac                 p   d}| j                  t              5 }t        d       ddd       | j                  t	        j
                        |       | j                  t              5 }t        d       ddd       | j                  t	        |j
                        |       y# 1 sw Y   }xY w# 1 sw Y   ;xY w)z=A continuation at the end of input must be an error; bpo2180.r+   zx = 5\N\)assertRaisesr   r,   r   r   	exception)r   r   excinfos      r   test_line_continuation_EOFz&EOFTestCase.test_line_continuation_EOF2   s    B{+ 	wO	W../8{+ 	wJ	W../8	 		 	s   B &B, B),B5zsys.executable requiredc                    t        j                         5 }t        j                  |dd      }t        j                  |      \  }}}| j                  d|       | j                  d|       | j                  d|       t        j                  |dd      }t        j                  |      \  }}}| j                  d|       | j                  d|       | j                  d|       ddd       y# 1 sw Y   yxY w)	z9Ensure tok_nextc() does not add too many ending newlines.r   r0   s   unexpected EOF while parsings   line 1   \zy = 6\s   y = 6\Nr   )r   r    r$   r%   r&   r'   s         r   ,test_line_continuation_EOF_from_file_bpo2180z8EOFTestCase.test_line_continuation_EOF_from_file_bpo2180<   s     ! 	+X%11(E4HI(>>yILBSMM93?MM)S)MM%%%11(E9MI(>>yILBSMM93?MM)S)MM*c*	+ 	+ 	+s   CC++C4N)__name__
__module____qualname__r   r   r(   r   ignore_warningsSyntaxWarningr.   r4   unittestskipIfsys
executabler7        r   r   r   
   sb    
)%^ %_$$m<% =%9 X__')BC+ D+rB   r   __main__)__doc__r?   testr   test.supportr   r   r   r=   TestCaser   r8   mainrA   rB   r   <module>rI      sI    5 
  " & ( @+(## @+D zHMMO rB   