File: //opt/cppython/lib/python3.8/test/test_tools/__pycache__/test_pindent.cpython-38.pyc
U
1D�g�! � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl
mZmZ e� G dd� dej
�Zedkr|e�� dS ) z4Tests for the pindent script in the Tools directory.� N)�support)�assert_python_ok)�
scriptsdir�skip_if_missingc @ sr e Zd Zej�ed�Zdd� Zdd� Z dd� Z
dd � Zd
d� Zdd
� Z
dd� Zdd� Zdd� Zdd� Zdd� ZdS )�PindentTestsz
pindent.pyc
C s@ t |��.}t |��}| �|�� |�� � W 5 Q R X W 5 Q R X d S �N)�open�assertEqual� readlines)�selfZfn1Zfn2�f1�f2� r �;/opt/cppython/lib/python3.8/test/test_tools/test_pindent.py�assertFileEqual s zPindentTests.assertFileEqualc G sJ t jtj| jf| t jt jdd��}|�|�\}}W 5 Q R X | �|� |S )NT)�stdin�stdout�universal_newlines)�
subprocess�Popen�sys�
executable�script�PIPE�communicateZassertIsNone)r �source�args�proc�out�errr r r �pindent s �
zPindentTests.pindentc C s d� dd� |�� D ��d S )N�
c s s | ]}|� � V qd S r )�lstrip)�.0�liner r r � <genexpr>! s z+PindentTests.lstriplines.<locals>.<genexpr>)�join�
splitlines)r �datar r r �lstriplines s zPindentTests.lstriplinesc
C sP d | _ t�� ��6}tj�|d�}t| j��}|�� }W 5 Q R X t|d��}|� |� W 5 Q R X t
| jd|�\}}}| �|d� | �|d� |d }| �tj�
|�� t|��}| �|�� |� W 5 Q R X t|��}|�� } W 5 Q R X t| dd� | �| �| d�|� | �| �|d�| � t
| jd|�\}}}| �|d� | �|d� t|��}| �|�� | � W 5 Q R X t|��}| �|�� |� W 5 Q R X | �|�}
t|d��}|� |
� W 5 Q R X t
| jd|�\}}}| �|d� | �|d� t|��}| �|�� |
� W 5 Q R X t|��}|�� }W 5 Q R X t|dd� | �| �|
d�|� W 5 Q R X d S ) Nz_test.py�w�-d� �~�exec�-c�-r)ZmaxDiffr Ztemp_dir�os�pathr&