403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/test_tools/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/test_tools/__pycache__/test_pindent.cpython-36.pyc
3

�w2_�!�@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZe�Gdd�dej
�Zedkr|ej�dS)	z4Tests for the pindent script in the Tools directory.�N)�support)�assert_python_ok)�
scriptsdir�skip_if_missingc@sreZdZejjed�Zdd�Zdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�PindentTestsz
pindent.pycCs@t|��.}t|��}|j|j�|j��WdQRXWdQRXdS)N)�open�assertEqual�	readlines)�selfZfn1Zfn2�f1�f2�r
�A/opt/alt/python36/lib64/python3.6/test/test_tools/test_pindent.py�assertFileEqualszPindentTests.assertFileEqualc	GsJtjtj|jf|tjtjdd��}|j|�\}}WdQRX|j|�|S)NT)�stdin�stdoutZuniversal_newlines)�
subprocess�Popen�sys�
executable�script�PIPEZcommunicateZassertIsNone)r
�source�args�proc�out�errr
r
r�pindents

zPindentTests.pindentcCsdjdd�|j�D��dS)N�
css|]}|j�VqdS)N)�lstrip)�.0�liner
r
r�	<genexpr>!sz+PindentTests.lstriplines.<locals>.<genexpr>)�join�
splitlines)r
�datar
r
r�lstriplines szPindentTests.lstriplinescJCsPd|_tj���6}tjj|d�}t|j��}|j�}WdQRXt|d��}|j	|�WdQRXt
|jd|�\}}}|j|d�|j|d�|d}|jtjj
|��t|��}|j|j�|�WdQRXt|��}|j�}	WdQRXt|	dd�|j|j|	d�|�|j|j|d�|	�t
|jd|�\}}}|j|d�|j|d�t|��}|j|j�|	�WdQRXt|��}|j|j�|�WdQRX|j|�}
t|d��}|j	|
�WdQRXt
|jd|�\}}}|j|d�|j|d�t|��}|j|j�|
�WdQRXt|��}|j�}WdQRXt|dd�|j|j|
d�|�WdQRXdS)	Nz_test.py�wz-d��~�execz-cz-r)ZmaxDiffrZtemp_dir�os�pathr#rr�read�writerrZ
assertTrue�exists�compilerr&)r
Z	directoryZ	data_path�f�closedZrcrrZbackup�clean�brokenZindentedr
r
r�
test_selftest#sL






zPindentTests.test_selftestcCsP|j|j|d�|�|j|j|d�|�|j|�}|j|j|dddd�|�dS)Nz-cz-dz-rz-ez-s�4)rrr&)r
r3r2r4r
r
r�pindent_testNs
zPindentTests.pindent_testcCs$tjd�}tjd�}|j||�dS)Na:            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
            a`            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
            )�textwrap�dedentr7)r
r3r2r
r
r�test_statementsTs
?LzPindentTests.test_statementscCs$tjd�}tjd�}|j||�dS)Nz�            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!'
            aJ            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
            )r8r9r7)r
r3r2r
r
r�test_multilevel�s
	zPindentTests.test_multilevelcCs�tjd�}tjd�}|j|j|d�|�|j|j|d�|�|j|�}|j|j|dddd�|�tjd	�}tjd
�}|j|j|d�|�|j|j|d�|�|j|�}|j|j|d�|�dS)Nz\            if a:
                     if b:
                              pass
            z�            if a:
                     if b:
                              pass
                     # end if
            # end if
            z-cz-dz-rz-ez-s�9zD            if a:
            	if b:
            		pass
            zo            if a:
            	if b:
            		pass
            	# end if
            # end if
            )r8r9rrr&)r
r3r2r4r
r
r�test_preserve_indents�s 

z"PindentTests.test_preserve_indentscCs@tjd�}tjd�}|j|j|d�|�|j|j|d�|�dS)Nz�            class\
            \
             A:
               def            \
            f:
                  pass
            z�            class\
            \
             A:
               def            \
            f:
                  pass
               # end def f
            # end class A
            z-cz-d)r8r9rr)r
r3r2r
r
r�test_escaped_newline!s
z!PindentTests.test_escaped_newlinecCs$tjd�}tjd�}|j||�dS)Nz4            if a:

                pass
            zI            if a:

                pass
            # end if
            )r8r9r7)r
r3r2r
r
r�test_empty_line9s
zPindentTests.test_empty_linecCs$tjd�}tjd�}|j||�dS)Nz#            if a: pass
            z8            if a: pass
            # end if
            )r8r9r7)r
r3r2r
r
r�test_onelineGs
zPindentTests.test_onelineN)�__name__�
__module__�__qualname__r+r,r#rrrrr&r5r7r:r;r=r>r?r@r
r
r
rrs	+"r�__main__)�__doc__r+rZunittestrr8ZtestrZtest.support.script_helperrZtest.test_toolsrrZTestCaserrA�mainr
r
r
r�<module>sD

Youez - 2016 - github.com/yon3zu
LinuXploit