ML itdZddlmZddlZddlZddlZddlZddlmZm Z ddl m Z m Z ddl mZmZmZ ddlZddlZej(ZgdZGdd e Zd d Zdd Zdd Zy#e$rdZY5wxYw)zsTest cases for the command line. To begin we test that "mypy [/]" always recurses down the whole tree. ) annotationsN)PREFIX test_temp_dir)DataDrivenTestCase DataSuite)assert_string_arrays_equalcheck_test_output_filesnormalize_error_messages)z cmdline.testzcmdline.pyproject.test reports.testz envvars.testceZdZeZdZddZy)PythonCmdlineSuiteTctAtjj|jdk(rt j ddgt|jzD]}t||y)Nr z$Cannot import lxml. Is it installed?) lxmlospathbasenamefilepytestskipsortedoutput2test_python_cmdline)selftestcasesteps [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mypy/test/testcmdline.pyrun_casezPythonCmdlineSuite.run_case(sY  ?C&!1!122 0D $ / 0N)rrreturnNone)__name__ __module__ __qualname__ cmdline_filesfiles native_seprrrr r $s EJ0rr c D |jJdd}tjjt|}t |dd5}|j D]}|j|d dddt|j d}t|j dkDrt|j dnd}|jd d |vr|jd d |vr|jd d|vr|jdd|vr|jdtddg}tjj} | jddtjjtjj!td} t"| d<tjj%| r| dxxtj&| zz cc<tjjt|xsd} |D cgc]1} | j)dtjj!| 3}} t+j,||zt*j.t*j.| | } | j1\}}| j2}t5|dj7Dcgc]}|j9d}}t5|dj7Dcgc]}|j9d}}dtjvr.t;|D] \}}|j=ds|||dz=ntj>||j@rE|s|r4tCd|jDrd|znd|dj||zfztG||y|jHrtK||z}|rdnd}||k7r|jd ||dk(r |jLn|jD|}|Dcgc]%}|j)d!tjNzd'}}tQ||d"jS|jT|jV|jDrd|zndy#1swYxYwcc} wcc}wcc}wcc}w)#Nztest was not properly set upz _program.pywutf8)encoding rrz--show-tracebackz--error-summaryz--no-error-summaryz--show-error-codesz--hide-error-codesz--disallow-empty-bodiesz--allow-empty-bodiesz--no-force-union-syntaxz--force-union-syntaxz-mmypyCOLUMNSpypath PYTHONPATHz$CWD)stdoutstderrcwdenvz PYCHARM_HOSTEDzpydev debugger: z6Expected zero status and empty stderr%s, got %d and %sz on step %dz== Return code: tmpzInvalid output ({}, line {}){}),old_cwdrrjoinropeninputwrite parse_argslen parse_cwdappend python3_pathenvironcopypopabspathrisdirpathsepreplace subprocessPopenPIPE communicate returncodestr splitlinesrstrip enumerate startswithremove output_filesAssertionErrorrr normalize_outputr outputseprformatrline)rrprogram program_pathrsargs custom_cwdfixedr6 extra_pathr5argprocessoutberrbresultouterrposr\obvious_result expected_outs rrr/s    'G)GG 'G77<< w7L lC& 1!T !A JJ!Bx  !! hnnQ' (D14X^^1Dq1H8>>!,-dJKK"#$ ()4' () , *+ , *+ 4 (E **// CGGItbggoomR4R*RR cttjd|}|sgS|jdjS)zParse the first line of the program for the command line. This should have the form # cmd: mypy For example: # cmd: mypy pkg/ z# cmd: mypy (.*)$r)rematchgroupsplitr\ms rr?r?ys4 $d+A  771:   rcXtjd|}|r|jdSdS)zParse the second line of the program for the command line. This should have the form # cwd: For example: # cwd: main/subdir z # cwd: (.*)$rN)rorprqrss rrArAs) &A1771:$$r)rrrintr r!)r\rPr z list[str])r\rPr z str | None)__doc__ __future__rrrorKsysmypy.test.configrrmypy.test.datarrmypy.test.helpersrr r r ImportErrorr executablerCr%r rr?rAr(rrrs #  28 ~~ [ 00G T" %e DsA$$A.-A.