o
    2g                     @  sz   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ G d	d
 d
eZdddZdS )z(Tests for mypy incremental error output.    )annotations)build)CompileError)BuildSource)Options)DataDrivenTestCase	DataSuite)assert_string_arrays_equalc                   @  s$   e Zd ZdZdZdgZddd	Zd
S )ErrorStreamSuiteT.zerrorstream.testtestcaser   returnNonec                 C  s   t | d S )N)test_error_stream)selfr    r   Q/home/garg/my-data/venv/lib/python3.10/site-packages/mypy/test/testerrorstream.pyrun_case   s   zErrorStreamSuite.run_caseNr   r   r   r   )__name__
__module____qualname__required_out_section	base_pathfilesr   r   r   r   r   r
      s
    r
   r   r   r   r   c              
     s   t  }d|_d|_g  d fd
d}tddd| jg}z
tj|||d W n ty@ } z|jg ks6J W Y d}~nd}~ww t	| j
 d| j d| j d dS )zmPerform a single error streaming test case.

    The argument contains the description of the test case.
    Tfilename
str | Nonemsgs	list[str]seriousboolr   r   c                   s    |r  d  | d S d S )Nz==== Errors flushed ====)appendextend)r   r   r   logged_messagesr   r   flush_errors!   s   
z'test_error_stream.<locals>.flush_errorsmain__main__
)sourcesoptionsr%   NzInvalid output (z, line ))r   r   r   r   r   r    r   r   )r   show_tracebackhide_error_codesr   joininputr   r   messagesr	   outputfileline)r   r*   r%   r)   er   r#   r   r      s   r   Nr   )__doc__
__future__r   mypyr   mypy.errorsr   mypy.modulefinderr   mypy.optionsr   mypy.test.datar   r   mypy.test.helpersr	   r
   r   r   r   r   r   <module>   s    	