Current File : //opt/imh-python/lib/python2.7/test/test_tools.pyc
�
��Wc@sQdZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
ej�r�ejd��nejjejjejjejje���d�Zejjed�Zdejfd	��YZd
ejfd��YZd�Zed
krMej�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(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((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pyttest_noargsscCs?t|jd�\}}}|j|d�|j|d�dS(Ns-ht(RRtassertEqualt
assertGreater(Rtrctoutterr((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pyt	test_help"s(	t__name__t
__module__tostpathtjoint
scriptsdirRRR(((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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(topenR
t	readlines(Rtfn1tfn2tf1tf2((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pytassertFileEqual+scGs]tjtj|jf|dtjdtjdt�}|j|�\}}|j|�|S(Ntstdintstdouttuniversal_newlines(	t
subprocesstPopentsyst
executableRtPIPEtTruetcommunicatetassertIsNone(RtsourcetargstprocR
R((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pytpindent/s	
cCs!djd�|j�D��dS(Ns
css|]}|j�VqdS(N(tlstrip(t.0tline((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pys	<genexpr>9s(Rt
splitlines(Rtdata((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pytlstriplines8sc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(tNonetmaxDiffRRRRRRtreadtwriteRR
t
assertTruetexiststcompileR,R2(Rt	directoryt	data_pathtftclosedRR
Rtbackuptcleantbrokentindented((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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(R
R,R2(RRBR@RC((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pytpindent_testfscCs2tjd�}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
            (ttextwraptdedentRG(RRBR@((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pyttest_statementsls
?	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
            (RHRIRG(RRBR@((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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
            (RHRIR
R,R2(RRBR@RC((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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(RHRIR
R,(RRBR@((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pyttest_escaped_newline9s	
	cCs2tjd�}tjd�}|j||�dS(Ns4            if a:

                pass
            sI            if a:

                pass
            # end if
            (RHRIRG(RRBR@((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pyttest_empty_lineQs
		cCs2tjd�}tjd�}|j||�dS(Ns#            if a: pass
            s8            if a: pass
            # end if
            (RHRIRG(RRBR@((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pyttest_oneline_s
		(RRRRRRRRR,R2RERGRJRKRMRNRORP(((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pyR(s					+		�		"		cCs<tjgt�j�D]}t|t�r|^q�dS(N(Rtrun_unittesttglobalstvaluest
isinstancettype(tobj((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pyt	test_mainjst__main__(t__doc__RR#tunittesttshutilR!t	sysconfigttempfileRHttestRttest.script_helperRRtis_python_buildtSkipTestRRtdirnamet__file__tbasepathRtTestCaseRRRWRtmain(((sh/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_tools.pyt<module>s*
0	�C