Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/lib2to3/tests/test_main.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ejjejj
e�d�Zejjed�Zdejfd��YZedkr�j
�ndS(i�N(tmaintdataspy2_test_grammar.pytTestMaincBsqeZeejd�s'd
d�Znd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�ZRS(tassertNotRegexcCs]ddl}t|d�s-|j|�}n|j|�rY|jd|j|f�ndS(Ni�tsearchsregexp %s MATCHED text %r(trethasattrtcompileRtfailtpattern(tselfttexttregexptmsgR((s-/sys/lib/python2.7/lib2to3/tests/test_main.pyRs
cCs
d|_dS(N(tNonettemp_dir(R
((s-/sys/lib/python2.7/lib2to3/tests/test_main.pytsetUpscCs*tjj2|jr&tj|j�ndS(N(tloggingtrootthandlersRtshutiltrmtree(R
((s-/sys/lib/python2.7/lib2to3/tests/test_main.pyttearDown"s
	cCsmtj}tj}tj}|t_|t_|t_ztjd|�SWd|t_|t_|t_XdS(Ns
lib2to3.fixes(tsyststdintstdouttstderrR(R
targst
in_capturetout_captureterr_capturet
save_stdintsave_stdouttsave_stderr((s-/sys/lib/python2.7/lib2to3/tests/test_main.pytrun_2to3_capture(s								cCs�tjd�}tj�}tjd�|�}tj�}|jdg|||�}|j|d�|j�}|jd|k�|jd|j�k�dS(Nuprint 'nothing'
print u'über'
tasciit-is-print 'nothing's9WARNING: couldn't encode <stdin>'s diff for your terminal(tStringIOtcodecst	getwriterR"tassertEqualtgetvaluet
assertTrue(R
tinput_streamtouttout_encterrtrettoutput((s-/sys/lib/python2.7/lib2to3/tests/test_main.pyttest_unencodable_diff6s	cCsDtj�|_tjj|jd�|_tjj|jd�|_tj|j�tj|j�g|_	t
tjj|jd�d�j�|j	jd�t
jt|j�|j	jtjjt��tjj|jd�|_tjj|jd�|_t
|jd��}|jd�WdQX|j	jd�dS(s5Setup a test source tree and output destination tree.tpython2_projecttpython3_projects__init__.pytws
trivial.pys#print 'I need a simple conversion.'N(ttempfiletmkdtempRtostpathtjointpy2_src_dirtpy3_dest_dirtmkdirtsetup_filestopentclosetappendRtcopytPY2_TEST_MODULEtbasenamettrivial_py2_filet
init_py2_filetwrite(R
ttrivial((s-/sys/lib/python2.7/lib2to3/tests/test_main.pytsetup_test_source_treesBs	%c	s�|j�tj�}tj�}d�|jdd�ddd|j|jgtjd�||�}|j|d�|j�}|jd	|�|jd
|j|jf|�|jt�fd�|j	D��tt
j|j���xS|j	D]H}|jdt
jj
|j|�t
jj
|j|��f|�q�jt
j�}|j|d
jd|��|j|djd|��dS(s92to3 a single directory with a new output dir and suffix.tTESTs-ns--add-suffixs--write-unchanged-filess
--no-diffss--output-dirtis implies -w.s6Output in %r will mirror the input directory %r layoutc3s|]}|�VqdS(N((t.0tname(tsuffix(s-/sys/lib/python2.7/lib2to3/tests/test_main.pys	<genexpr>fssWriting converted %s to %ssNo changes to .*/__init__\.pyt/sNo changes to .*/trivial\.pyN(RHR%R"R;R:R(R)tassertIntsetR=R7tlistdirR8R9RtescapetseptassertRegexpMatchestreplaceR(R
R,R.R/RRLRS((RMs-/sys/lib/python2.7/lib2to3/tests/test_main.pyt+test_filename_changing_on_output_single_dirUs4
"	(cCs�|j�tj�}|j|jg}td�|D��}|jddddd|jg|tjd�tj�|�}|j|d�|j�}|j	d	|j|j
f|�|j|ttj|j���d
S(s62to3 two files in one directory with a new output dir.css!|]}tjj|�VqdS(N(R7R8RC(RKRL((s-/sys/lib/python2.7/lib2to3/tests/test_main.pys	<genexpr>wss-ns-ws--write-unchanged-filess
--no-diffss--output-dirRJis6Output in %r will mirror the input directory %r layoutN(
RHR%RDRERPR"R;R(R)ROR:R7RQ(R
R.t	py2_filestexpected_filesR/R((s-/sys/lib/python2.7/lib2to3/tests/test_main.pyt*test_filename_changing_on_output_two_filesrs
	cCs�|j�tj�}|jdddd|j|jgtjd�tj�|�}|j|d�|j�}|jd|j|jf|�|jt	t
jj|j�g�t	t
j
|j���dS(	s)2to3 a single file with a new output dir.s-ns-ws
--no-diffss--output-dirRJis6Output in %r will mirror the input directory %r layoutN(RHR%R"R;RDR(R)ROR:RPR7R8RCRQ(R
R.R/R((s-/sys/lib/python2.7/lib2to3/tests/test_main.pyt,test_filename_changing_on_output_single_file�s
	!N(t__name__t
__module__RtunittesttTestCaseRRRRR"R1RHRVRYRZ(((s-/sys/lib/python2.7/lib2to3/tests/test_main.pyRs							t__main__(RR&RR7RRR%R5R]tlib2to3RR8R9tdirnamet__file__t
TEST_DATA_DIRRBR^RR[(((s-/sys/lib/python2.7/lib2to3/tests/test_main.pyt<module>s!�

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.