HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/test_tools/__pycache__/test_pindent.cpython-310.opt-2.pyc
o

�i�!�@s�	ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
e
�Gdd�dej�ZedkrEe��dSdS)	�N)�support)�	os_helper)�assert_python_ok)�
scriptsdir�skip_if_missingc@sreZdZej�ed�Zdd�Zdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�PindentTestsz
pindent.pyc	Cszt|��/}t|��}|�|��|���Wd�n1swYWd�dSWd�dS1s6wYdS�N)�open�assertEqual�	readlines)�selfZfn1Zfn2�f1�f2�r�9/usr/local/lib/python3.10/test/test_tools/test_pindent.py�assertFileEqualsP�zPindentTests.assertFileEqualcGs^tjtj|jf|tjtjdd��}|�|�\}}Wd�n1s#wY|�|�|S)NT)�stdin�stdout�universal_newlines)�
subprocess�Popen�sys�
executable�script�PIPE�communicateZassertIsNone)r�source�args�proc�out�errrrr�pindents��
zPindentTests.pindentcCsd�dd�|��D��dS)N�
css�|]}|��VqdSr)�lstrip)�.0�linerrr�	<genexpr>"s�z+PindentTests.lstriplines.<locals>.<genexpr>)�join�
splitlines)r�datarrr�lstriplines!szPindentTests.lstriplinesc	Cs"d|_t����~}tj�|d�}t|j��}|��}Wd�n1s$wYt|d��
}|�	|�Wd�n1s>wYt
|jd|�\}}}|�|d�|�|d�|d}|�tj�
|��t|��}|�|��|�Wd�n1s}wYt|��}|��}	Wd�n1s�wYt|	dd�|�|�|	d�|�|�|�|d�|	�t
|jd|�\}}}|�|d�|�|d�t|��}|�|��|	�Wd�n1s�wYt|��}|�|��|�Wd�n1s�wY|�|�}
t|d��
}|�	|
�Wd�n	1�swYt
|jd|�\}}}|�|d�|�|d�t|��}|�|��|
�Wd�n	1�sPwYt|��}|��}Wd�n	1�siwYt|dd�|�|�|
d�|�Wd�dS1�s�wYdS)	Nz_test.py�w�-d��~�exec�-c�-r)ZmaxDiffrZtemp_dir�os�pathr'r	r�read�writerr
Z
assertTrue�exists�compiler!r*)rZ	directoryZ	data_path�f�closed�rcrr Zbackup�clean�brokenZindentedrrr�
test_selftest$s`
��
�

�
�
�
�
�

�$�zPindentTests.test_selftestc	CsP|�|�|d�|�|�|�|d�|�|�|�}|�|�|dddd�|�dS)Nr0r,r1�-e�-s�4)r
r!r*�rr;r9r<rrr�pindent_testOs
zPindentTests.pindent_testcC�$t�d�}t�d�}|�||�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�dedentrB�rr;r9rrr�test_statementsUs

AMzPindentTests.test_statementscCrC)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
            rDrGrrr�test_multilevel�s



zPindentTests.test_multilevelc	Cs�t�d�}t�d�}|�|�|d�|�|�|�|d�|�|�|�}|�|�|dddd�|�t�d	�}t�d
�}|�|�|d�|�|�|�|d�|�|�|�}|�|�|d�|�dS)Nz\            if a:
                     if b:
                              pass
            z�            if a:
                     if b:
                              pass
                     # end if
            # end if
            r0r,r1r>r?�9zD            if a:
            	if b:
            		pass
            zo            if a:
            	if b:
            		pass
            	# end if
            # end if
            )rErFr
r!r*rArrr�test_preserve_indentss





z"PindentTests.test_preserve_indentscCs@t�d�}t�d�}|�|�|d�|�|�|�|d�|�dS)Nz�            class\
            \
             A:
               def            \
            f:
                  pass
            z�            class\
            \
             A:
               def            \
            f:
                  pass
               # end def f
            # end class A
            r0r,)rErFr
r!rGrrr�test_escaped_newline"s

	z!PindentTests.test_escaped_newlinecCrC)Nz4            if a:

                pass
            zI            if a:

                pass
            # end if
            rDrGrrr�test_empty_line:s

zPindentTests.test_empty_linecCrC)Nz#            if a: pass
            z8            if a: pass
            # end if
            rDrGrrr�test_onelineHs

zPindentTests.test_onelineN)�__name__�
__module__�__qualname__r2r3r'rrrr!r*r=rBrHrIrKrLrMrNrrrrrs	+"r�__main__)r2rZunittestrrE�testrZtest.supportrZtest.support.script_helperrZtest.test_toolsrrZTestCaserrO�mainrrrr�<module>s"D�