File: //usr/local/lib/python3.7/test/test_tools/__pycache__/test_pindent.cpython-37.pyc
B
"��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 d Q R X W d Q R X d S )N)�open�assertEqual� readlines)�selfZfn1Zfn2�f1�f2� r
�8/usr/local/lib/python3.7/test/test_tools/test_pindent.py�assertFileEqual s zPindentTests.assertFileEqualc G sJ t jtj| jf| t jt jdd��}|�|�\}}W d Q R X | �|� |S )NT)�stdin�stdoutZuniversal_newlines)�
subprocess�Popen�sys�
executable�script�PIPEZcommunicateZassertIsNone)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 )N)�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 d Q R X t|d��}|� |� W d Q R X t
| jd|�\}}}| �|d� | �|d� |d }| �tj�
|�� t|��}| �|�� |� W d Q R X t|��}|�� } W d Q R X t| dd� | �| �| d�|� | �| �|d�| � t
| jd|�\}}}| �|d� | �|d� t|��}| �|�� | � W d Q R X t|��}| �|�� |� W d Q R X | �|�}
t|d��}|� |
� W d Q R X t
| jd|�\}}}| �|d� | �|d� t|��}| �|�� |
� W d Q R X t|��}|�� }W d Q R X t|dd� | �| �|
d�|� W d Q R X d S ) Nz_test.py�wz-d� �~�execz-cz-r)ZmaxDiffr Ztemp_dir�os�pathr# r r �read�writer r Z
assertTrue�exists�compiler r&