Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 13.59.90.114
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_tools.pyo
�
@��cc@s�dZddlZddlZddlZddlZddlZddlmZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZmZe	j�r�ejd��nejjejjejjejje���d�Zejjed�Zd	ejfd
��YZdejfd��YZd
ejfd��YZdejfd��YZd�Zedkr�ej �ndS(s�Tests for scripts in the Tools directory.

This file contains regression tests for some of the scripts found in the
Tools directory of a Python checkout or tarball, such as reindent.py.
i����N(tStringIO(ttest_support(tassert_python_okttemp_dirs'test irrelevant for an installed PythontToolstscriptst
ReindentTestscBs/eZejjed�Zd�Zd�ZRS(sreindent.pycCst|j�dS(N(Rtscript(tself((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_noargs!scCs?t|jd�\}}}|j|d�|j|d�dS(Ns-ht(RRtassertEqualt
assertGreater(Rtrctoutterr((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyt	test_help$s(	t__name__t
__module__tostpathtjoint
scriptsdirRR	R(((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyRs	tPindentTestscBs�eZejjed�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�ZRS(s
pindent.pycCsJt|��8}t|��#}|j|j�|j��WdQXWdQXdS(N(topenRt	readlines(Rtfn1tfn2tf1tf2((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pytassertFileEqual-scGs]tjtj|jf|dtjdtjdt�}|j|�\}}|j|�|S(Ntstdintstdouttuniversal_newlines(	t
subprocesstPopentsyst
executableRtPIPEtTruetcommunicatetassertIsNone(RtsourcetargstprocRR((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pytpindent1s	
cCs!djd�|j�D��dS(Ns
css|]}|j�VqdS(N(tlstrip(t.0tline((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pys	<genexpr>;s(Rt
splitlines(Rtdata((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pytlstriplines:scCs�d|_t���}tjj|d�}t|j��}|j�}WdQXt|d��}|j	|�WdQXt
|jd|�\}}}|j|d�|j|d�|d}|jtjj
|��t|��}|j|j�|�WdQXt|��}|j�}	WdQXt|	dd�|j|j|	d�|�|j|j|d�|	�t
|jd|�\}}}|j|d�|j|d�t|��}|j|j�|	�WdQXt|��}|j|j�|�WdQX|j|�}
t|d��}|j	|
�WdQXt
|jd|�\}}}|j|d�|j|d�t|��}|j|j�|
�WdQXt|��}|j�}WdQXt|dd�|j|j|
d�|�WdQXdS(	Ns_test.pytws-dR
t~texecs-cs-r(tNonetmaxDiffRRRRRRtreadtwriteRRt
assertTruetexiststcompileR-R3(Rt	directoryt	data_pathtftclosedR
RRtbackuptcleantbrokentindented((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyt
test_selftest=sL	
cCsp|j|j|d�|�|j|j|d�|�|j|�}|j|j|dddd�|�dS(Ns-cs-ds-rs-es-st4(RR-R3(RRCRARD((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pytpindent_testhscCs2tjd�}tjd�}|j||�dS(Ns:            if a:
                pass

            if a:
                pass
            else:
                pass

            if a:
                pass
            elif:
                pass
            else:
                pass

            while a:
                break

            while a:
                break
            else:
                pass

            for i in a:
                break

            for i in a:
                break
            else:
                pass

            try:
                pass
            finally:
                pass

            try:
                pass
            except TypeError:
                pass
            except ValueError:
                pass
            else:
                pass

            try:
                pass
            except TypeError:
                pass
            except ValueError:
                pass
            finally:
                pass

            with a:
                pass

            class A:
                pass

            def f():
                pass
            s`            if a:
                pass
            # end if

            if a:
                pass
            else:
                pass
            # end if

            if a:
                pass
            elif:
                pass
            else:
                pass
            # end if

            while a:
                break
            # end while

            while a:
                break
            else:
                pass
            # end while

            for i in a:
                break
            # end for

            for i in a:
                break
            else:
                pass
            # end for

            try:
                pass
            finally:
                pass
            # end try

            try:
                pass
            except TypeError:
                pass
            except ValueError:
                pass
            else:
                pass
            # end try

            try:
                pass
            except TypeError:
                pass
            except ValueError:
                pass
            finally:
                pass
            # end try

            with a:
                pass
            # end with

            class A:
                pass
            # end class A

            def f():
                pass
            # end def f
            (ttextwraptdedentRH(RRCRA((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_statementsns
?	L	cCs2tjd�}tjd�}|j||�dS(Ns�            def foobar(a, b):
                if a == b:
                    a = a+1
                elif a < b:
                    b = b-1
                    if b > a: a = a-1
                else:
                    print 'oops!'
            sJ            def foobar(a, b):
                if a == b:
                    a = a+1
                elif a < b:
                    b = b-1
                    if b > a: a = a-1
                    # end if
                else:
                    print 'oops!'
                # end if
            # end def foobar
            (RIRJRH(RRCRA((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_multilevel�s
			cCstjd�}tjd�}|j|j|d�|�|j|j|d�|�|j|�}|j|j|dddd�|�tjd	�}tjd
�}|j|j|d�|�|j|j|d�|�|j|�}|j|j|d�|�dS(Ns\            if a:
                     if b:
                              pass
            s�            if a:
                     if b:
                              pass
                     # end if
            # end if
            s-cs-ds-rs-es-st9sD            if a:
            	if b:
            		pass
            so            if a:
            	if b:
            		pass
            	# end if
            # end if
            (RIRJRR-R3(RRCRARD((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_preserve_indentss 		%		cCsZtjd�}tjd�}|j|j|d�|�|j|j|d�|�dS(Ns�            class\
            \
             A:
               def            \
            f:
                  pass
            s�            class\
            \
             A:
               def            \
            f:
                  pass
               # end def f
            # end class A
            s-cs-d(RIRJRR-(RRCRA((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_escaped_newline;s	
	cCs2tjd�}tjd�}|j||�dS(Ns4            if a:

                pass
            sI            if a:

                pass
            # end if
            (RIRJRH(RRCRA((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_empty_lineSs
		cCs2tjd�}tjd�}|j||�dS(Ns#            if a: pass
            s8            if a: pass
            # end if
            (RIRJRH(RRCRA((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_onelineas
		(RRRRRRRRR-R3RFRHRKRLRNRORPRQ(((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyR*s					+		�		"		tFixcidTestscBs5eZd�Zd�Zd�Zdddd�ZRS(cCs]d}d}|j||�}d}d}|j|djd|d|d|d	|��dS(
Nsint xx = "xx\"xx"[xx];
sint xx = 'x\'xx' + xx;
sint yy = "xx\"xx"[yy];
sint yy = 'x\'xx' + yy;
s01
< {old1}> {new1}{new1}2
< {old2}> {new2}{new2}told1told2tnew1tnew2(t
run_scripttassertMultiLineEqualtformat(RRSRTtoutputRURV((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_parse_stringsms		cCs2|jdddd	dd�}|j|d�dS(
Nt	substfiles
xx yy
*aa bb
R+s-ct-tinputs4/* xx altered */
int xx;
/* aa unaltered */
int aa;
s�1
< /* xx altered */
> /* yy altered */
/* yy altered */
2
< int xx;
> int yy;
int yy;
/* aa unaltered */
4
< int aa;
> int bb;
int bb;
(s-cR](RWRX(RRZ((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_alter_comments~s			c	Cstjtj�|jtjtj�tjjtjd�}t|d��}|j	d�WdQXttjjtjd�d��}|j	d�WdQXtjjt
d�}tj��}|jdtjf�}WdQX|j
|dj|�d	|j��dS(
Nsfile.cR4sint xx;
sfile.pysxx = 'unaltered'
s	fixcid.pyR+s{}:
1
< int xx;
> int yy;
s
stderr: %s(RtmkdirRtTESTFNt
addCleanuptrmtreeRRRR:Rtcaptured_stderrRWRXRYtgetvalue(Rt
c_filenametfileRtstderrRZ((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_directory�s$	R
R]sxx yy
c
Cstjd}t|d��}|j|�WdQX|jtj|�dd|gt|�}tjj	t
d�}tjtd|��|tjtdt
|���Ztj��G}ytj|dd�Wn&tk
r�}	|j|	jd	�nXWdQXWdQXWdQX|j�S(
Ns.substR4s	fixcid.pys-stargvRtrun_namet__main__i(RRaRR:RbtunlinktlistRRRRt	swap_attrR$Rtcaptured_stdouttrunpytrun_patht
SystemExitRtcodeRe(
RR^R+R\t
substfilenameRgRjRRZtexit((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyRW�s
)(R](RRR[R_RiRW(((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyRRls			tLllTestscBsAeZejjed�Zeje	ed�d�d��Z
RS(slll.pytsymlinksRequires symlink supportc
Cstj�}tj�}|jtj|�|jtj|�tjj|d�}tjj|d�}xX||f||ffD]>\}}t|d�j	�tj
|tjj|d��q�Wt|j||�\}}}	|j
|djd|d|d|d	|��dS(
Ntfoo1tfoo2R4Rxs3{dir1}:
symlink -> {fn1}

{dir2}:
symlink -> {fn2}
tdir1Rtdir2R(ttempfiletmkdtempRbRRcRRRRtcloseRxRRRRY(
RR{R|RRtfntdirR
RR((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyttest_lll_multiple_dirs�s%#		(RRRRRRRtunittestt
skipUnlessthasattrR�(((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyRw�scCs<tjgt�j�D]}t|t�r|^q�dS(N(Rtrun_unittesttglobalstvaluest
isinstancettype(tobj((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyt	test_main�sRl(!t__doc__RRqR$R�tshutilt	cStringIORR"t	sysconfigR}RIttestRttest.script_helperRRtis_python_buildtSkipTestRRtdirnamet__file__tbasepathRtTestCaseRRRRRwR�Rtmain(((s6/usr/local/python-2.7/lib/python2.7/test/test_tools.pyt<module>s2
0	�CT	
© 2025 GrazzMean