Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/test_mailcap.cpython-34.pyo

�
f f$�@sddlZddlZddlZddlZddlZejjd�Zi
idd6dd6dd6d	d
6gd6idd
6dd
6gd6idd6dd6dd6dd
6gd6idd
6gd6idd6dd
6idd6dd
6gd6idd
6gd6idd6dd6dd6d d
6gd!6id"d#6dd
6d$d
6gd%6id&d
6gd'6id(d
6gd)6id*d
6gd+6id,d-6d.d
6gd/6id&d
6gd06Z	Gd1d2�d2ej
�ZGd3d4�d4ej
�ZGd5d6�d6ej
�Z
d7d8�Zed9kre�ndS):�Nzmailcap.txtz
moviemaker %s�composez""/usr/lib/Zmail/bitmaps/movie.xbm"z
x11-bitmapz"Movie"�descriptionzmovieplayer %s�viewzapplication/x-movie�Z
copiousoutputz?echo "This is \"%t\" but        is 50 \% Greek to me" \; cat %sz
application/*zaudiocompose %s�editz"An audio fragment"zshowaudio %szaudio/basiczmpeg_play %sz
video/mpeg�
needsterminalzps-to-terminal %szidraw %szapplication/postscriptzxdvi %szapplication/x-dviz
extcompose %s�composetypedz4"A reference to data stored in an external location"zQshowexternal %s %{access-type} %{name} %{site}     %{directory} %{mode} %{server}zmessage/external-bodyz?test "`echo     %{charset} | tr '[A-Z]' '[a-z]'`"  = iso-8859-8�testz)shownonascii iso-8859-8 -e richtext -p %sz
text/richtextz
display %szimage/x-xwindowdumpz/usr/local/bin/showaudio %tzaudio/*z
animate %szvideo/*z
"cat %s | lp"�printzshowframe %szapplication/framez	image/rgbc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�HelperFunctionTestc
Cs�tj�}|j|t�x|D]}|j|t�q#Wtjj��Z}d|krt|djt	j
�}n.ddg}t	j
j|�|d<tj�}WdQX|j||�dS)N�MAILCAPSz/testdir1/.mailcapz/testdir2/mailcap)
�mailcap�listmailcapfiles�assertIsInstance�list�strr	�support�EnvironmentVarGuard�split�os�pathsep�join�assertEqual)�selfZmcfiles�m�envZenv_mailcaps�r�6/opt/alt/python34/lib64/python3.4/test/test_mailcap.py�test_listmailcapfiles9s
z(HelperFunctionTest.test_listmailcapfilesc	Cs;ttd��}tj|�}WdQX|j|t�dS)N�r)�open�MAILCAPFILEr
Zreadmailcapfile�assertDictEqual�MAILCAPDICT)r�mcf�drrr�test_readmailcapfileLsz'HelperFunctionTest.test_readmailcapfilecCs�idd6idd6g}tjtd�}|j||�d}idd6dd6dd	6d
d6g}tjtd|�}|j||�dS)Nzmpeg_play %srz
animate %sz
video/mpegrzaudiocompose %srz"An audio fragment"rzshowaudio %szaudio/basic)r
�lookupr#ZassertListEqual)rZexpectedZactual�keyrrr�test_lookupRs

zHelperFunctionTest.test_lookupc
Cs�dddg}dddgdfdddgdfdddgd	fd
ddgdfdddgd
fddd|gdfd
dd|gdfg}x/|D]'}|jtj|d�|d�q�WdS)Nzid=1znumber=2ztotal=3rzaudio/*zfoo.txtzecho foozecho %szecho foo.txtzecho %tzecho audio/*zecho \%tz
echo %{total}zecho 3r�)rr
Zsubst)r�plistZ
test_casesZtcrrr�
test_substas
zHelperFunctionTest.test_substN)�__name__�
__module__�__qualname__rr&r)r,rrrrr7src@s(eZdZdd�Zdd�ZdS)�GetcapsTestc
CsBtjj��-}t|d<tj�}|j|t�WdQXdS)Nr)r	rrr!r
�getcapsr"r#)rr�capsrrr�test_mock_getcapsss
zGetcapsTest.test_mock_getcapscCs�tj�}|j|t�tj�}dd�|D�}|r�xn|j�D]M\}}|j|t�|j|t�x|D]}|j|t�q�WqNWn|ji|�dS)NcSs(g|]}tjj|�r|�qSr)r�path�exists)�.0r$rrr�
<listcomp>�s	z3GetcapsTest.test_system_mailcap.<locals>.<listcomp>)	r
r1r�dictr�itemsrrr)rr2ZmailcapfilesZexistingmcfiles�k�v�errr�test_system_mailcap|s
zGetcapsTest.test_system_mailcapN)r-r.r/r3r=rrrrr0qs	r0c@sOeZdZdd�Zejejdkd�dd��Zdd�Z	d	S)
�
FindmatchTestc	Cs�t}d}ddddddg}idd	6dd
6dd6d
d6}idd6}idd6}idd6dd6dd6dd6}idgid&f|dgid'f|dgididd6ff|dd	gid|ff|dd
gid|ff|ddgid|ff|ddgid(f|dgi|d6d||ff|dd
gi|d6d||ff|dgidd 6|d6d|ff|d!gi|d6d"|ff|d#gi|d$6d%|ffg}|j|�dS))Nzfoo.txtzaccess-type=defaultz	name=johnzsite=python.orgzdirectory=/tmpzmode=fooz
server=barzaudiocompose %srrz"An audio fragment"rzshowaudio %srz/usr/local/bin/showaudio %tz
animate %sz
extcompose %srz4"A reference to data stored in an external location"rrzQshowexternal %s %{access-type} %{name} %{site}     %{directory} %{mode} %{server}z
video/mpegzfoo/barzmpeg_play /dev/nullzmpeg_play %szaudio/basiczaudiocompose /dev/nullZfoobarzvideo/*�filenamer(zaudio/*z /usr/local/bin/showaudio audio/*zmessage/external-bodyr+z?showexternal /dev/null default john python.org     /tmp foo bar)NN)NN)NN)r#�
_run_cases)	r�cZfnamer+Zaudio_basic_entryZaudio_entryZvideo_entryZ
message_entry�casesrrr�test_findmatch�sH	



#
		
	
zFindmatchTest.test_findmatch�posixz!Requires 'test' command on systemcCsviidd6gd6idd6gd6}|ddgididd6ff|ddgidfg}|j|�dS)Nztest 1 -eq 1r	z	test/passztest 1 -eq 0z	test/fail)NN)r@)rr2rBrrr�	test_test�s
"zFindmatchTest.test_testcCs=x6|D].}|jtj|d|d�|d�qWdS)Nrr*�)rr
Z	findmatch)rrBrArrrr@�s
zFindmatchTest._run_casesN)
r-r.r/rC�unittestZ
skipUnlessr�namerEr@rrrrr>�s1'r>cCstjjttt�dS)N)r	rZrun_unittestrr0r>rrrr�	test_main�srI�__main__)r
rZshutilZtest.supportr	rGrZfindfiler!r#ZTestCaserr0r>rIr-rrrr�<module>sL




:J