Your IP : 216.73.217.129


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_cmd.cpython-35.opt-2.pyc



���]u�@s�ddlZddlZddlZddlZddlZddlmZGdd�dej�ZGdd�dej	�Z
ddd�Zd	d
�Ze
dkr�dejkr�ed
�n&dejkr�e�j�ne�dS)�N)�supportc@speZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�samplecmdclasscCstd�dS)NzHello from preloop)�print)�self�r�-/opt/alt/python35/lib64/python3.5/test_cmd.py�preloop�szsamplecmdclass.preloopcCstd�dS)NzHello from postloop)r)rrrr�postloop�szsamplecmdclass.postloopcGstd�dS)Nz#This is the completedefault methode)r)rZignoredrrr�completedefault�szsamplecmdclass.completedefaultcCstd�dS)Nzcomplete command)r)rrrr�complete_command�szsamplecmdclass.complete_commandcCsdS)Nr)r�srrr�do_shell�szsamplecmdclass.do_shellcCs�|j�}t|�dkr,td�dSydd�|D�}Wn tk
retd�dSYnXt|d|d�dS)N�z*** invalid number of argumentscSsg|]}t|��qSr)�int)�.0�irrr�
<listcomp>�s	z)samplecmdclass.do_add.<locals>.<listcomp>z*** arguments should be numbersr�)�split�lenr�
ValueError)rr�lrrr�do_add�s


	zsamplecmdclass.do_addcCstd�dS)Nzhelp text for add)r)rrrr�help_add�s
zsamplecmdclass.help_addcCsdS)NTr)r�argrrr�do_exit�szsamplecmdclass.do_exitN)�__name__�
__module__�__qualname__rr	r
rr
rrrrrrrrs{rc@sWeZdZGdd�dej�ZGdd�de�Zdd�Zdd�Zd	S)
�TestAlternateInputc@s(eZdZdd�Zdd�ZdS)zTestAlternateInput.simplecmdcCst|d|j�dS)N�file)r�stdout)r�argsrrr�do_print�sz%TestAlternateInput.simplecmd.do_printcCsdS)NTr)rr"rrr�do_EOF�sz#TestAlternateInput.simplecmd.do_EOFN)rrrr#r$rrrr�	simplecmd�sr%c@seZdZdd�ZdS)zTestAlternateInput.simplecmd2cCstdd|j�dS)Nz*** Unknown syntax: EOFr T)rr!)rr"rrrr$�sz$TestAlternateInput.simplecmd2.do_EOFN)rrrr$rrrr�
simplecmd2�sr&cCs`tjd�}tj�}|jd|d|�}d|_|j�|j|j�d�dS)Nzprint test
print test2�stdinr!Fz(Cmd) test
(Cmd) test2
(Cmd) )�io�StringIOr%�use_rawinput�cmdloop�assertMultiLineEqual�getvalue)r�input�output�cmdrrr�test_file_with_missing_final_nl�s	
z2TestAlternateInput.test_file_with_missing_final_nlcCs�tjd�}tj�}|jd|d|�}d|_|j�|j|j�d�tjd�}tj�}||_||_|j�|j|j�d�dS)Nzprint test
print test2r'r!Fz5(Cmd) test
(Cmd) test2
(Cmd) *** Unknown syntax: EOF
zprint 

z,(Cmd) 
(Cmd) 
(Cmd) *** Unknown syntax: EOF
)	r(r)r&r*r+r,r-r'r!)rr.r/r0rrr�test_input_reset_at_EOF�s	
		
z*TestAlternateInput.test_input_reset_at_EOFN)	rrrr0�Cmdr%r&r1r2rrrrr�s	rcCs1ddlm}tj||�tjt�dS)Nr)�test_cmd)�testr4rZrun_doctestZrun_unittestr)�verboser4rrr�	test_main�sr7cCs|tjd�}|jdtjtjgdddd�}|jd�|j�}td�|j	dd	d
d	d|�dS)N�traceZ
ignoredirsr�countrz4import importlib; importlib.reload(cmd); test_main()zWriting coverage results...Zshow_missingTZsummary�coverdir)
r�
import_moduleZTrace�sys�base_prefix�base_exec_prefix�run�resultsrZ
write_results)r:r8Ztracer�rrrr�
test_coverage�s

rB�__main__z-cz/tmp/cmd.coverz-i)r0r<�reZunittestr(r5rr3rZTestCaserr7rBr�argvr+rrrr�<module>s�3