Ë
    pPêjê  ã                  óî   — d Z ddlmZ ddlZddlZddl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 ddlmZmZ dd	lmZmZ ej,                  Z ej0                  d
«      Z G d„ de«      Zdd„Zdd„Zy)a»  Test cases for running mypy programs using a Python interpreter.

Each test case type checks a program then runs it using Python. The
output (stdout) of the program is compared to expected output. Type checking
uses full builtins and other stubs.

Note: Currently Python interpreter paths are hard coded.

Note: These test cases are *not* included in the main test suite, as including
      this suite would slow down the main suite too much.
é    )ÚannotationsN)ÚTemporaryDirectory)Úapi)ÚPYTHON3_VERSION)Útest_temp_dir)ÚDataDrivenTestCaseÚ	DataSuite)Úassert_string_arrays_equalÚsplit_linesz\b_program.py\bc                  ó*   — e Zd ZddgZ e«       Zdd„Zy)ÚPythonEvaluationSuitezpythoneval.testzpythoneval-asyncio.testc                ó€   — t        |t        j                  j                  | j                  j
                  d«      «       y )Nz.mypy_cache)Útest_python_evaluationÚosÚpathÚjoinÚ	cache_dirÚname)ÚselfÚtestcases     ú]/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/mypy/test/testpythoneval.pyÚrun_casezPythonEvaluationSuite.run_case%   s%   € Ü˜x¬¯©¯©°d·n±n×6IÑ6IÈ=Ó)YÕZó    N)r   r   ÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__Úfilesr   r   r   © r   r   r   r   !   s   „ ØÐ 9Ð:€EÙ"Ó$€Iô[r   r   c           	     ó4  — | j                   €J d«       ‚g d¢}t        }|j                  ddj                  t	        t
        t        «      «      › �«       t        j                  ddj                  | j                  «      t        j                  «      }|r¾|j                  d«      j                  «       }|D ]‰  }|j                  d«      sŒ|j                  d	«      d   }|j                  d«      \  }}	t        |«      t        |	«      ft        j                   j"                  t        j                   j$                  fkD  sŒ‰ y |j'                  |«       d
| j(                  z   dz   }
t*        j,                  j                  t.        |
«      }|j                  |«       t1        |dd¬«      5 }| j                  D ]  }|j3                  |› d�«       Œ 	 ddd«       |j                  d|› �«       g }t5        j6                  |«      \  }}}||z   j9                  «       D ]¸  }|j                  t.        t*        j:                  z   «      rB|j                  |t=        t.        t*        j:                  z   «      d j?                  d«      «       Œk|jA                  t.        t*        j:                  z   t.        dz   «      }|j                  |j?                  d«      «       Œº |dkD  r| jB                  s|j                  d«       |dk(  rP|sNtE        j6                  |d|
gt.        d¬«      }|j'                  tG        |jH                  |jJ                  «      «       t+        jL                  |«       tO        |«      D ]o  \  }}t*        j,                  j:                  dz   t*        j,                  j:                  z   |v sŒA|j                  t*        j,                  j:                  «      d   ||<   Œq tQ        tS        | «      |d| jT                  › d| jV                  › d�«       y# 1 sw Y   �ŒBxY w)z~Runs Mypy in a subprocess.

    If this passes without errors, executes the script again with a given Python
    version.
    Nztest was not properly set up)z--show-tracebackz--no-silence-site-packagesz--no-error-summaryz--hide-error-codesz--allow-empty-bodiesz
--test-envz--python-version=ú.z# flags: (.*)$ú
é   ú=Ú_ú.pyÚwÚutf8)Úencodingz--cache-dir=z
ú/z!!! Mypy crashed !!!r   z-WignoreT)ÚcwdÚcapture_outputÚtypeshedéÿÿÿÿzInvalid output (z, line ú)),Úold_cwdÚpython3_pathÚappendr   ÚmapÚstrr   ÚreÚsearchÚinputÚ	MULTILINEÚgroupÚsplitÚ
startswithÚintÚsysÚversion_infoÚmajorÚminorÚextendr   r   r   r   ÚopenÚwriter   ÚrunÚ
splitlinesÚsepÚlenÚrstripÚreplaceÚoutputÚ
subprocessr   ÚstdoutÚstderrÚremoveÚ	enumerater
   Úadapt_outputÚfileÚline)r   r   Úmypy_cmdlineÚinterpreterÚmÚadditional_flagsÚflagÚtargeted_python_versionÚtargeted_majorÚtargeted_minorÚprogramÚprogram_pathrR   ÚsrK   ÚoutÚerrÚ
returncoderS   ÚprocÚis                        r   r   r   )   s`  € ð ×ÑÐ'ÐGÐ)GÓGÐ'ò€Lô €KØ×ÑÐ+¨C¯H©H´S¼¼oÓ5NÓ,OÐ+PÐQÔRä
�	‰	Ð" D§I¡I¨h¯n©nÓ$=¼r¿|¹|ÓL€AÙØŸ7™7 1›:×+Ñ+Ó-ÐØ$ò 	ˆDØ�‰Ð2Õ3Ø*.¯*©*°S«/¸!Ñ*<Ð'Ø1H×1NÑ1NÈsÓ1SÑ.� Ü˜Ó'¬¨^Ó)<Ð=Ü×$Ñ$×*Ñ*Ü×$Ñ$×*Ñ*ðAó ñ ð	ð 	×ÑÐ,Ô-ð �H—M‘MÑ! EÑ)€GÜ—7‘7—<‘<¤¨wÓ7€LØ×Ñ˜Ô%Ü	ˆl˜C¨&Ô	1ð !°TØ—‘ò 	!ˆAØ�J‰J˜!˜˜B�xÕ ñ	!÷!ð ×Ñ˜, y kÐ2Ô3Ø€FäŸ7™7 <Ó0Ñ€Cˆˆjà�s‘×&Ñ&Ó(ò /ˆØ�?‰?œ=¬2¯6©6Ñ1Ô2Ø�M‰M˜$œs¤=´2·6±6Ñ#9Ó:Ð<Ð=×DÑDÀVÓLÕMð —<‘<¤´·±Ñ 6¼ÈÑ8KÓLˆDØ�M‰M˜$Ÿ+™+ fÓ-Õ.ð/ð �A‚~˜hŸošoð 	�‰Ð,Ô-Ø�Q‚™vä�~‰~Ø˜* gÐ.´MÐRVô
ˆð 	�‰”k $§+¡+¨t¯{©{Ó;Ô<ä‡I�IˆlÔÜ˜VÓ$ò 4‰ˆˆ4Ü�7‰7�;‰;˜Ñ#¤b§g¡g§k¡kÑ1°TÒ9ØŸ
™
¤2§7¡7§;¡;Ó/°Ñ3ˆF�1ŠIð4ô Ü�XÓ Ð*:¸8¿=¹=¸/ÈÐQY×Q^ÑQ^ÐP_Ð_`Ð(aõ÷=!ñ !ús   Æ&&PÐPc                óŒ   — d| j                   z   dz   }| j                  D �cg c]  }t        j                  ||«      ‘Œ c}S c c}w )z<Translates the generic _program.py into the actual filename.r&   r'   )r   rK   Ú
program_reÚsub)r   r\   rS   s      r   rQ   rQ   q   s8   € à�H—M‘MÑ! EÑ)€GØ6>·o±oÖF¨dŒJ�N‰N˜7 DÕ)ÒFÐFùÒFs   ¡A)r   r   r   r5   r   r   )r   r   r   z	list[str])Ú__doc__Ú
__future__r   r   Úos.pathr6   rL   r>   Útempfiler   Úmypyr   Úmypy.defaultsr   Úmypy.test.configr   Úmypy.test.datar   r	   Úmypy.test.helpersr
   r   Ú
executabler2   Úcompilere   r   r   rQ   r    r   r   ú<module>rr      sg   ðñ
õ #ã 	Û Û 	Û Û 
Ý 'å Ý )Ý *ß 8ß Eð �~‰~€ØˆR�Z‰ZÐ*Ó+€
ô[˜Iô [óEôPGr   