
    ;e                         d Z ddl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                     dS dS )	z/test script for a few new invalid token catches    N)support)	os_helper)script_helperc                   l    e Zd Zd Zd Zd Zd Zd Z ej	        e
j         d          d             ZdS )	EOFTestCasec                     d}dD ]u}	 t          | d           t          j        # t          $ rH}|                     t          |          |           |                     |j        d           Y d }~nd }~ww xY wd S )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       $/usr/lib/python3.11/test/test_eof.pytest_EOF_single_quotez!EOFTestCase.test_EOF_single_quote
   s    V  	) 	)E)%       ((	  0 0 0  S6222  Q////////0		) 	)s   &
A8>A33A8c                     d}	 t          d           t          j        # t          $ rI}|                     t          |          |           |                     |j        d           Y d }~d S 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XXv...SZ+++++++++	,s    
A2>A--A2c                     d}t          j                    5 }t          j        |dd          }t          j        |          \  }}}d d d            n# 1 swxY w Y   |                     d|           d S )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    s    &!! 	JX%1(EC^__I(>yIILBS	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	WY\]]]]]s   /AAAc                     d}	 t          dddd           t          j        # t          $ r.}|                     t          |          |           Y d }~d S d }~ww xY w)N/unexpected EOF while parsing (<string>, line 1)z"\xhh" \z<string>execT)dont_inherit)compiler   r   r   r   r   r   s      r   test_eof_with_line_continuationz+EOFTestCase.test_eof_with_line_continuation'   s}    B	%L:vDIIII $$  	/ 	/ 	/SXXv.........	/s   # 
A#AAc                    d}|                      t                    5 }t          d           ddd           n# 1 swxY w Y   |                     t	          |j                  |           |                      t                    5 }t          d           ddd           n# 1 swxY w Y   |                     t	          |j                  |           dS )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_EOF0   s1   B{++ 	wOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	W.//888{++ 	wJJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	W.//88888s   9= =B""B&)B&zsys.executable requiredc                    t          j                    5 }t          j        |dd          }t          j        |          \  }}}|                     d|           |                     d|           |                     d|           t          j        |dd          }t          j        |          \  }}}|                     d|           |                     d|           |                     d|           ddd           dS # 1 swxY w Y   dS )	z9Ensure tok_nextc() does not add too many ending newlines.r   r/   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:   sB    !! 	+X%1(E4HHI(>yIILBSMM93???MM)S)))MM%%%%%1(E9MMI(>yIILBSMM93???MM)S)))MM*c***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   C!DD	DN)__name__
__module____qualname__r   r   r'   r-   r3   unittestskipIfsys
executabler6        r   r   r   	   s        
) 
) 
)% % %^ ^ ^% % %9 9 9 X_')BCC+ + DC+ + +r?   r   __main__)__doc__r<   testr   test.supportr   r   r:   TestCaser   r7   mainr>   r?   r   <module>rF      s    5 5 



       " " " " " " & & & & & & ?+ ?+ ?+ ?+ ?+(# ?+ ?+ ?+B zHMOOOOO r?   