Your IP : 216.73.217.32
3
��2az � @ s^ d dl Z d dlZd dlZd dlZd dlmZmZ d dlmZ d dl m
Z
G dd� dej�ZdS )� N)�Popen�PIPE)�support)�assert_python_okc @ sT e Zd ZdZejd�Zejd�Zdd� Zdd� Z dd � Z
d
d� Zdd
� Zdd� Z
dS )�TestToolz�
[["blorpie"],[ "whoops" ] , [
], "d-shtaeou",
"d-nthiouh",
"i-vhbjkhnth", {"nifty":87}, {"morefield" : false,"field"
:"yes"} ]
a. [
[
"blorpie"
],
[
"whoops"
],
[],
"d-shtaeou",
"d-nthiouh",
"i-vhbjkhnth",
{
"nifty": 87
},
{
"field": "yes",
"morefield": false
}
]
a. [
[
"blorpie"
],
[
"whoops"
],
[],
"d-shtaeou",
"d-nthiouh",
"i-vhbjkhnth",
{
"nifty": 87
},
{
"morefield": false,
"field": "yes"
}
]
c
C sf t jddf}t|tttd��}|j| jj� �\}}W d Q R X | j|j� | j j� j� � | j|d� d S )Nz-mz json.tool)�stdin�stdout�stderr� )
�sys�
executabler r Zcommunicate�data�encode�assertEqual�
splitlines�expect)�self�args�proc�out�err� r �./opt/alt/python36/lib64/python3.6/test_tool.py�test_stdin_stdout? s
zTestTool.test_stdin_stdoutc
C s: t j}t|d�� }| jtj|� |j| j� W d Q R X |S )N�w)r �TESTFN�open�
addCleanup�os�remove�writer
)r �infile�fpr r r �_create_infileF s
zTestTool._create_infilec C sP | j � }tdd|�\}}}| j|d� | j|j� | jj� j� � | j|d� d S )Nz-mz json.toolr r
)r# r r r r r )r r! �rcr r r r r �test_infile_stdoutM s
zTestTool.test_infile_stdoutc
C s� | j � }tjd }tdd||�\}}}| jtj|� t|d��}| j|j � | j
� W d Q R X | j|d� | j|d� | j|d� d S )Nz.outz-mz json.tool�rr r
)r# r r r r r r r r �readr )r r! Zoutfiler$ r r r"