
    X-Ph                    ~    d Z ddlmZ ddl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mZ  G d d	e          ZddZdS )zTest cases for `--output=json`.

These cannot be run by the usual unit test runner because of the backslashes in
the output, which get normalized to forward slashes by the test suite on Windows.
    )annotationsN)api)PYTHON3_VERSION)test_temp_dir)DataDrivenTestCase	DataSuitec                      e Zd ZdgZddZdS )	OutputJSONsuitezoutputjson.testtestcaser   returnNonec                $    t          |           d S )N)test_output_json)selfr   s     T/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mypy/test/testoutput.pyrun_casezOutputJSONsuite.run_case   s    """""    Nr   r   r   r   )__name__
__module____qualname__filesr    r   r   r
   r
      s0        E# # # # # #r   r
   r   r   r   r   c           	     B   dg}|                     dd                    t          t          t                                          t
          j                            t          d          }|                     |           t          |dd          5 }| j	        D ]}|
                    | d           	 d	d	d	           n# 1 swxY w Y   g }t          j        |          \  }}}||z                       d                                          D ]}	|	                    t          t
          j        z             rP|                     |	t#          t          t
          j        z             d	                             d
                     y|                     |	                    d
                     |dk    r|                     d           t          j        |           t
          j                            dd          fd|D             }
|
| j        k    sJ d	S )zNRuns Mypy in a subprocess, and ensures that `--output=json` works as intended.z--output=jsonz--python-version=.mainwutf8)encoding
Nz
   z!!! Mypy crashed !!!\z\\c                L    g | ] }|                     t          z   d           !S ) )replacer   ).0linejson_os_separators     r   
<listcomp>z$test_output_json.<locals>.<listcomp>8   s.    ```QUm6G&GLL```r   )appendjoinmapstrr   ospathr   openinputwriter   runrstrip
splitlines
startswithseplenremover%   output)r   mypy_cmdlineprogram_pathfilesr:   outerr
returncoder'   normalized_outputr(   s              @r   r   r      s>   #$LQCHHSo5N5N,O,OQQRRR 7<<v66L%%%	lC&	1	1	1 !T 	! 	!AJJ!xxx    	!! ! ! ! ! ! ! ! ! ! ! ! ! ! ! F7<00Cjs""4((3355 / /??=26122 	/MM$s=26#9::<<=DDVLLMMMMMM$++f--....A~~,--- Il tV44````Y_```//////s   #CCCr   )__doc__
__future__r   r.   os.pathmypyr   mypy.defaultsr   mypy.test.configr   mypy.test.datar   r   r
   r   r   r   r   <module>rJ      s     # " " " " " 				        ) ) ) ) ) ) * * * * * * 8 8 8 8 8 8 8 8# # # # #i # # #!0 !0 !0 !0 !0 !0r   