Current File : //opt/imh-python/lib/python2.7/test/test_zipfile.pyc
�
��Wc@s�yddlZWnek
r)eZnXddlZddlZddlZddlZddlZddlZddl	Z	ddl
m
Z
ddlmZddl
mZm
Z
mZddl	mZddlmZmZmZmZmZmZmZmZyeje�Wneefk
r4eZnXedZedZd	Zd
dfdd
fddfddfgZ d�Z!de	j"fd��YZ#de	j"fd��YZ$de	j"fd��YZ%de	j"fd��YZ&de	j"fd��YZ'de	j"fd��YZ(eed�d e	j"fd!��Y�Z)d"e	j"fd#��YZ*d$e	j"fd%��YZ+d&�Z,e-d'kr�e,�ndS((i����N(tStringIO(t
TemporaryFile(trandinttrandomtgetrandbits(t
skipUnless(tTESTFNtTESTFN_UNICODEtTESTFN_ENCODINGtrun_unittesttfindfiletunlinktrmtreetcheck_warningst2tdi�t	_ziptest1t
1q2w3e4r5tsziptest2dir/_ziptest2t
qawsedrftgs!ziptest2dir/ziptest3dir/_ziptest3t
azsxdcfvgbs-ziptest2dir/ziptest3dir/ziptest4dir/_ziptest3t
6y7u8i9o0pcCs+ttjdd|td|�f��S(Ns%0*xii(tbytest	bytearraytfromhexR(tsize((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytgetrandbytes&stTestsWithSourceFilecBs<eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zeed�d��Zeed�d��Zeed�d��Zeed�d��Zeed�d��Zeed�d��Zeed�d��Zeed�d��Zd�Zd�Zd�Z d�Z!d�Z"d �Z#eed�d!��Z$d"�Z%d#�Z&d$�Z'd%�Z(ee)d&�d'��Z*d(�Z+d)�Z,d*�Z-d+�Z.d,�Z/d-�Z0d.�Z1d/�Z2RS(0cCstgtt�D]}d|t�f^q
|_dj|j�d|_ttd��}|j|j�WdQXdS(Ns&Zipfile test line %d. random float: %fs
twb(	txrangetFIXEDTEST_SIZERtline_gentjointdatatopenRtwrite(tselftitfp((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytsetUp*s
,cCsUtj|d|��:}|jtd�|jtt�|jd|j�WdQXdS(Ntwsanother.nametstrfile(tzipfiletZipFileR"RtwritestrR (R#tftcompressiontzipfp((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytmake_test_archive3sc	Cs�|j||�tj|d|���}|j|jt�|j�|j|jd�|j�|j|jd�|j�t�}tj	}z|t_	|j
�Wd|t_	X|j�}|j�}|jt
|�d�|jd|d�|jd|d�|jd|d�|d	j�\}}	}
}|j|d�|jtj|	d
��|jtj|
d��|j|tt
|j���|j�}|jt
|�d�|jt|�|jd|�|jd|�|j�}
g|
D]}|j^q�}|jt
|�d�|jt|�|jd|�|jd|�x*|
D]"}|j|jt
|j��q`WxUtddfD]D}|j|�}|j|j|�|j|jt
|j��q�W|j�WdQXdS(
Ntrsanother.nameR(is	File NameitModifiedtSizeis%Y-%m-%ds%H:%M:%Si(R/R)R*tassertEqualtreadRR Rtsyststdouttprintdirtgetvaluet
splitlinestlentassertIntsplitt
assertTruettimetstrptimetstrtnamelisttinfolisttfilenamet	file_sizetgetinfottestzip(R#R,R-R.R%R6t	directorytlinestfntdatettime_RtnamestinfosR$tnmtinfo((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytzip_test:sP			

  cCs7x0tt�t�fD]}|j|tj�qWdS(N(tTESTFN2RRRPR)t
ZIP_STORED(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_storedtsc	Cs|j||�tj|d|���}g}|jt��:}x0trr|jd�}|sbPn|j|�qCWWdQXg}|jd��:}x0tr�|jd�}|s�Pn|j|�q�WWdQX|jdj	|�|j
�|jdj	|�|j
�WdQXdS(NR0isanother.namet(R/R)R*R!RtTrueR4tappendR3RR (	R#R,R-R.tzipdata1tzipopen1t	read_datatzipdata2tzipopen2((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt
zip_open_testxs$		cCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR\R)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_open_stored�sc
CsItjtdtj��]}|jdd�tdtf��|jdd�WdQX|j|j�dgd�WdQXtjtd���}|j	�}d}x6|D].}|j
|��}||j�7}WdQXq�W|j|dkp�|d	k�d}x!|D]}||j|�7}qW|j|dkp;|d	k�WdQXdS(
NR'tnametfooRTtbariR0tfoobartbarfoo(
R)R*RQRRR+R
tUserWarningR3RARBR!R4R=(R#R.RMR ROR,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_open_via_zip_info�s #

cCs�|j||�tj|d|��}}g}|jt��C}x9tr{|jtdd��}|skPn|j|�qCWWdQX|j	dj
|�|j�WdQXdS(NR0iiRT(R/R)R*R!RRUR4RRVR3RR (R#R,R-R.RWRXRY((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytzip_random_open_test�s	cCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRReR)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_random_open_stored�scCs�t�}ddd}tj|dtj��}|jt|�WdQXd}tj|d��=}|jtd��"}x|D]}||7}qWWdQXWdQX|j||jdd	��dS(
Nsa
iiR'RTR0trUs
s
(	RR)R*RRR+RR!R3treplace(R#R,R R.tdata2tzipopentline((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_universal_readaheads�s	
c
Cs�|j||�tj|d��u}|jt��]}d}xMtr�|j�}|s\Pn||7}|jd�}|sPn||7}q@WWdQXWdQX|j||j	�dS(NR0RTid(
R/R)R*R!RRUtreadlineR4R3R (R#R,R-R.RjR R4((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytzip_readline_read_test�s	
c
Cs{|j||�tj|d��S}|jt��;}x1|jD]&}|j�}|j||d�qAWWdQXWdQXdS(NR0s
(R/R)R*R!RRRmR3(R#R,R-R.RjRktlinedata((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytzip_readline_test�sc
Cs�|j||�tj|d��b}|jt��J}|j�}x4t|j|�D] \}}|j||d�qVWWdQXWdQXdS(NR0s
(	R/R)R*R!Rt	readlinestzipRR3(R#R,R-R.tzotziplinesRktzipline((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytzip_readlines_test�sc	Cso|j||�tj|d��G}x=t|j|jt��D] \}}|j||d�qAWWdQXdS(NR0s
(R/R)R*RrRR!RR3(R#R,R-R.RkRu((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytzip_iterlines_test�s(cCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRnR)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_readline_read_stored�scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRpR)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_readline_stored�scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRvR)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_readlines_storedscCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRwR)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_iterlines_storedss
requires zlibcCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRPR)tZIP_DEFLATED(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt
test_deflatedscCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR\R)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_open_deflatedscCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRReR)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_random_open_deflatedscCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRnR)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_readline_read_deflatedscCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRpR)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_readline_deflated scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRvR)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_readlines_deflated%scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRwR)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_iterlines_deflated*scCs�tjtdtj��}|jdd�WdQXtjtdtj��Q}|jd��9}|j|jd�d�|j|jd�d�WdQXWdQXdS(	s>Check for cases where compressed data is larger than original.R'R(t12NR0it1R(R)R*RQR|R+R!R3R4(R#R.topenobj((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_low_compression/scCsotjtdtj��}|jtd�WdQXtjtdtj�� }|j|j�dg�WdQXdS(NR's	/absoluteR0tabsolute(R)R*RQRRR"RR3RA(R#R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_absolute_arcnames<sc	Cs�tjtdtj��}|jtt�WdQXtjtdtj��6}|jd|j�|j|j	�tdg�WdQXdS(s&Test appending to an existing zipfile.R'NtaR((
R)R*RQRRR"RR+R R3RA(R#R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_append_to_zip_fileCs
c
Cs�dd}ttd��}|j|�WdQXtjtdtj��}|jtt�WdQXttd��N}|jt|��tj|d�� }|j	|j
�tg�WdQXWdQXdS(s9Test appending to an existing file that is not a zipfile.sI am not a ZipFile!i
RNR�trbR0(R!RQR"R)R*RRRtseekR:R3RA(R#R R,R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_append_to_non_zip_fileLs
c	Cs�tjtdtj��}|jtt�WdQXttd��}|jd�WdQXtjtd��}|j|tj�WdQXdS(NR'R�s
R0(R)R*RQRRR"RR!tassertIsInstance(R#R.R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_ignores_newline_at_end\sc	Cs�tjtdtj�� }d|_|jtt�WdQXttd��}|jd�WdQXtjtd��-}|j|tj�|j	|jd�WdQXdS(NR'sthis is a commentR�sabcdef
R0(
R)R*RQRRtcommentR"RR!R�R3(R#R.R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt)test_ignores_stuff_appended_past_commentsds	cCsctjtd��K}|jt�ttd��&}|j|jt�|j��WdQXWdQXdS(s`Check that calling ZipFile.write without arcname specified
        produces the expected result.R'R0N(R)R*RQR"RR!R3R4(R#R.tfid((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_write_default_namens
cCs�tjtd��}}|jtdtj�|jtdtj�|jd�}|jd�}|j|j	tj�|j|j	tj�WdQXdS(sUCheck that files within a Zip archive can have different
        compression options.R'tstoremet	deflatemeN(
R)R*RQR"RRRR|RER3t
compress_type(R#R.tsinfotdinfo((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_per_file_compressionvsc	Csftjtdd��}|jdd�WdQXtjtdd��}|jt|jt�WdQXdS(s]Check that trying to call write() on a readonly ZipFile object
        raises a RuntimeError.tmodeR'ssomefile.txttbogusNR0(R)R*RQR+tassertRaisestRuntimeErrorR"R(R#R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_write_to_readonly�sc
Cs$tjtdtj��.}x$tD]\}}|j||�q"WWdQXtjtd���}x�tD]�\}}|j|�}tjj	tj
�|�}tjj|�}|j||�t
|d��}|j||j��WdQXtj|�qdWWdQXttjj	tj
�d��dS(NR'R0R�tziptest2dir(R)R*RQRRtSMALL_TEST_DATAR+textracttostpathRtgetcwdtnormpathR3R!R4tremoveR(R#R.tfpathtfdatatwrittenfiletcorrectfileR�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_extract�sc
Cs�tjtdtj��.}x$tD]\}}|j||�q"WWdQXtjtd��~}|j�xjtD]b\}}tjj	tj
�|�}t|d��}|j||j
��WdQXtj|�qnWWdQXttjj	tj
�d��dS(NR'R0R�R�(R)R*RQRRR�R+t
extractallR�R�RR�R!R3R4R�R(R#R.R�R�toutfileR�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_extract_all�s
cCsK|jtjj|��t|d��}|j|j�|�WdQXdS(NR�(R=R�R�tisfileR!R3R4(R#RCtcontentR,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt
check_file�ss1No Unicode filesystem semantics on this platform.c	Cs�dtjjt�g}d}tjtdtj��(}x|D]}|j||�q@WWdQXtjtd���}xw|D]o}|j	|�}tjj
tj�|�}tjj|�}|j
||�|j||�tj|�q|WWdQXdS(Nufoo.txtsTest for unicode filenameR'R0(R�R�tbasenameRR)R*RQRRR+R�RR�R�R3R�R�(R#tfnamesR�R.tfnameR�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_extract_unicode_filenames�s

c
Cs�d1d2d3d4d5d6d7d8g}tjjd
kry|jd9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKg�n|jdLdMdNg�xI|D]A\}}d%|j�}tjtd&tj��5}tj	�}||_
dO|_|j||�WdQX|j
tjd)�}tjjd*d+d,�}tjj||jd)��}tjtd-��3}|j||�}	|j|	|d.d/|�WdQX|j||�td*�tjtd-��}|j|�WdQX|j||�td*�tjjtj�|jd)��}tjtd-��0}|j|�}	|j|	|d.d/|�WdQX|j||�t|jd)�d0�tjtd-��}|j�WdQX|j||�t|jd)�d0�tjt�q�WdS(PNs
../foo/barsfoo/bars
foo/../bars
foo/../../bars
foo/bar/..s./../foo/bars/foo/bars/foo/../bars/foo/../../bars\s
..\foo\bars..\/foo\/barsfoo/\..\/barsfoo\/../\bars	C:foo/bars
C:/foo/barsC://foo/bars
C:\foo\bars//conky/mountpoint/foo/bars\\conky\mountpoint\foo\bars///conky/mountpoint/foo/barsconky/mountpoint/foo/bars\\\conky\mountpoint\foo\bars//conky//mountpoint/foo/bars\\conky\\mountpoint\foo\bars//?/C:/foo/bars\\?\C:\foo\barsC:/../C:/foo/bars
C_/foo/barsa:b\c<d>e|f"g?h*isb/c_d_e_f_g_h_is../../foo../../ba..rs	foo/ba..rs	//foo/barsfoo../ba..rs
foo/..\barRaR'i�it/ttargettsubdirtsubsubR0tmsgs
extract %ri(s
../foo/barsfoo/bar(s
foo/../barsfoo/bar(s
foo/../../barsfoo/bar(s
foo/bar/..sfoo/bar(s./../foo/barsfoo/bar(s/foo/barsfoo/bar(s/foo/../barsfoo/bar(s/foo/../../barsfoo/bar(s
..\foo\barsfoo/bar(s..\/foo\/barsfoo/bar(sfoo/\..\/barsfoo/bar(sfoo\/../\barsfoo/bar(s	C:foo/barsfoo/bar(s
C:/foo/barsfoo/bar(sC://foo/barsfoo/bar(s
C:\foo\barsfoo/bar(s//conky/mountpoint/foo/barsfoo/bar(s\\conky\mountpoint\foo\barsfoo/bar(s///conky/mountpoint/foo/barsconky/mountpoint/foo/bar(s\\\conky\mountpoint\foo\barsconky/mountpoint/foo/bar(s//conky//mountpoint/foo/barsconky/mountpoint/foo/bar(s\\conky\\mountpoint\foo\barsconky/mountpoint/foo/bar(s//?/C:/foo/barsfoo/bar(s\\?\C:\foo\barsfoo/bar(sC:/../C:/foo/bars
C_/foo/bar(sa:b\c<d>e|f"g?h*isb/c_d_e_f_g_h_i(s../../foo../../ba..rs	foo/ba..r(s	//foo/barsfoo/bar(s../../foo../../ba..rsfoo../ba..r(s
foo/..\bars
foo/..\bari�(R�R�tseptextendtencodeR)R*RQRRtZipInfoRCt
external_attrR+RhRR<R�R3R�RR�R�R�(
R#t	hacknamestarcnamet	fixednameR�R.tzinfot
targetpathR�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_extract_hackers_arcnames�s�	

		

$cCs�tjtd�}|jdddtj�trM|jdddtj�n|jd�}|j|j	tj�tr�|jd�}|j|j	tj�ndS(NR'sa.txtshello worldR�sb.txt(
R)R*RQR+RRtzlibR|RER3R�(R#R.RO((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_writestr_compressionscCsQ|j||�tj|d��)}|jd�}|j|jd�WdQXdS(NR0R(i�ii�(R/R)R*RER3R�(R#R,R-R.R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytzip_test_writestr_permissions+scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_writestr_permissions4scCs�tjtd��G}x=tD]5\}}|j||�|j|jdk	d�qWWdQX|j|jdkd�tjtd�� }|j|jdk	d�WdQX|j|jdkd�dS(s8Check that the zipfile is closed after the 'with' block.R'szipfp is not openNszipfp is not closedR0(R)R*RQR�R+R=R%tNone(R#R.R�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt
test_close8s#cCs�tjtd��.}x$tD]\}}|j||�qWWdQXy+tjtd��}tj��WdQXWn-tjk
r�|j|jdkd�nXdS(sWCheck that the zipfile is closed if an exception is raised in the
        'with' block.R'NR0szipfp is not closed(	R)R*RQR�R+t
BadZipfileR=R%R�(R#R.R�R�tzipfp2((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_close_on_exceptionDscCsEtjtd�tjtd��}|jt|jt�WdQXdS(NiR'(ii(	R�tutimeRR)R*RQR�t
ValueErrorR"(R#R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_add_file_before_1980QscCstt�tt�dS(N(RRRQ(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttearDownWs
(3t__name__t
__module__R&R/RPRSR\R]RdReRfRlRnRpRvRwRxRyRzR{RR�R}R~RR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RR�R�R�R�R�R�R�R�R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR)s\				:									
	
					
						
							Q						
	tTestZip64InSmallFilescBszeZd�Zd�Zd�Zd�Zd�Zd�Zee	d�d��Z
d�Zd	�Zd
�Z
d�ZRS(cCs�tj|_tj|_dt_dt_d�tdt�D�}dj|�|_t	t
d��}|j|j�WdQXdS(Ni�i	css|]}d|VqdS(sTest of zipfile line %d.N((t.0R$((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pys	<genexpr>fsis
R(R)tZIP64_LIMITt_limittZIP_FILECOUNT_LIMITt_filecount_limittrangeRRR R!RR"(R#RR%((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR&`s		c	Cs>tj|d|��#}|jtj|jtd�WdQXdS(NR'sanother.name(R)R*R�tLargeZipFileR"R(R#R,R-R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytlarge_file_exception_testnsc	CsAtj|d|��&}|jtj|jd|j�WdQXdS(NR'sanother.name(R)R*R�R�R+R (R#R,R-R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytlarge_file_exception_test2sscCsJxCtt�t�fD],}|j|tj�|j|tj�qWdS(N(RQRRR�R)RRR�(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_large_file_exceptionxsc
Cs9tj|d|dt��:}|jtd�|jtt�|jd|j�WdQXtj|d|���}|j|jt�|j�|j|jd�|j�|j|jd�|j�t	�}t
j}z|t
_|j�Wd|t
_X|j
�}|j�}|jt|�d�|jd|d�|jd	|d�|jd
|d�|dj�\}}	}
}|j|d�|jtj|	d��|jtj|
d
��|j|tt|j���|j�}|jt|�d�|jt|�|jd|�|jd|�|j�}
g|
D]}|j^qE}|jt|�d�|jt|�|jd|�|jd|�x*|
D]"}|j|jt|j��q�WxUtddfD]D}|j|�}|j|j|�|j|jt|j��q�W|j�WdQXdS(NR't
allowZip64sanother.nameR(R0is	File NameiR1R2is%Y-%m-%ds%H:%M:%Si(R)R*RUR"RR+R R3R4RR5R6R7R8R9R:R;R<R=R>R?R@RARBRCRDRERF(R#R,R-R.R%R6RGRHRIRJRKRRLRMR$RNRO((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRP}sV			

  cCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRPR)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRS�ss
requires zlibcCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRPR)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR}�scCsutjtdtjdt��}|jtd�WdQXtjtdtj�� }|j|j�dg�WdQXdS(NR'R�s	/absoluteR0R�(	R)R*RQRRRUR"RR3RA(R#R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR��s
cCstjtdddt�}d|_d}x4t|�D]&}|jd|d|dd	�q7W|jt|j	��|�|j
�tjtdd
�}|jt|j	��|�xCt|�D]5}|jd|�}|j|d|dd	�q�W|j
�dS(NR�R'R�idisfoo%08ds%dii9R0(R)R*RRUtdebugR�R+R3R:RAtcloseR4(R#tzipftnumfilesR$tzipf2R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_too_many_files�s	$
 cCs�tjtdddt�}d|_d}x4t|�D]&}|jd|d|dd	�q7W|jt|j	��|�|j
tj��|jd|d
�WdQX|jt|j	��|�|j�tjtdddt�}d|_|jt|j	��|�|j
tj��|jd|d
�WdQX|jt|j	��|�|j�tjtdddt
�}d|_|jt|j	��|�d}x7t||�D]&}|jd|d|dd	�q�W|jt|j	��|�|j�tjtdd
�}|jt|j	��|�xCt|�D]5}|jd|�}|j|d|dd	�qGW|j�dS(NR�R'R�idi	sfoo%08ds%dii9RTR�iR0(R)R*RtFalseR�R�R+R3R:RAR�R�R�RUR4(R#R�R�R$t	numfiles2R�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_too_many_files_append�s>	$
	
	$
 cCs0|jt_|jt_tt�tt�dS(N(R�R)R�R�R�RRRQ(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR�s
(R�R�R&R�R�R�RPRSRR�R}R�R�R�R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR�\s					>				$tPyZipFileTestscBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs�tj|tj�s%|jd�ntjj|d�}y-tj|tjtjB�}tj	|�Wnt
k
r�|jd�nXt|�dS(Ns/requires write access to the installed locationstest_zipfile.try(R�taccesstW_OKtskipTestR�RR!tO_WRONLYtO_CREATR�t	ExceptionR(R#R�RCtfd((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytrequiresWriteAccess
s
c	Cs�|jtjjt��tjt�d���}t}|jd�sU|jd�rb|d }n|j	|�tjj
|�}|j||j��|j
|d|j�kp�|d|j�k�WdQXtjt�d���}t}|jd	�r
|d }n|j	|d�ddtjj
|�f}|j||j��|j
|d|j�kp{|d|j�k�WdQXdS(
NR's.pycs.pyoi����totcttestpackages%s/%s(s.pycs.pyo(R�R�R�tdirnamet__file__R)t	PyZipFileRtendswithtwritepyR�tassertNotInRAR=(R#R.RItbn((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_write_pyfiles&


cCs�ddl}tjj|j�}|j|�tjt�d��^}|j	|�|j
�}|jd|kpzd|k�|jd|kp�d|k�WdQXdS(Ni����R'semail/__init__.pyosemail/__init__.pycsemail/mime/text.pyosemail/mime/text.pyc(temailR�R�R�R�R�R)R�RR�RAR=(R#R�t
packagedirR.RL((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_write_python_package/s


cCs;tjt�zttjjtd�d��}|jd�WdQXttjjtd�d��}|jd�WdQXttjjtd�d��}|jd�WdQXtjt	�d�}|j
t�|j�}|jd|kp�d	|k�|jd
|kpd|k�|j
d|�Wdtt�XdS(Nsmod1.pyR's
print(42)
smod2.pysprint(42 * 42)
smod2.txtsbla bla bla
smod1.pycsmod1.pyosmod2.pycsmod2.pyo(R�tmkdirRQR!R�RR"R)R�RR�RAR=R�R(R#R%R.RL((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_write_python_directory?s
!!!
c
Csjtjt�d��O}ttd��}|jd�WdQX|jt|jt�t	j
t�WdQXdS(NR's!most definitely not a python file(R)R�RR!RR"R�R�R�R�R�(R#R.R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_write_non_pyfileVs
(R�R�R�R�RRR(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR�	s
				t
OtherTestscBs�eZidej6dej6Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zeed�d��Zd�Zd�Z eed�d��Z!d�Z"d�Z#eed�d��Z$d �Z%d!�Z&d"�Z'd#�Z(d$�Z)RS(%sxPK ��;:r��afilehello,AworldPK ��;:r���afilePK3/s|PKn}=FAKEnafile�H���W(�/�Iɠ=PKn}=FAKEn�afilePK33cCs�tjtd��D}|jdd�|jdd�|j|j�djt�WdQXtjtd��;}|j|j	djd�|j|j	djd�WdQXdS(	NR'ufoo.txtsTest for unicode filenameuö.txtiR0sfoo.txti(
R)R*RR+R�RBRCtunicodeR3tfilelist(R#tzf((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_unicode_filenamests#cCs�tjjt�r"tjt�nd}d}y/tjtd��}|j||�WdQXWntk
r}|j	d�nX|j
tjjt��tjtd�� }|j|j|�|�WdQXdS(Nstestfile.txts#hello, world. this is some content.R�s1Could not append data to a non-existent zip file.R0(
R�R�texistsRRR)R*R+tIOErrortfailR=R3R4(R#RCR�R((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt(test_create_non_existent_file_for_append~s
cCsSttd��}|jd�WdQXytjt�}Wntjk
rNnXdS(NR'sthis is not a legal zip file
(R!RR"R)R*R�(R#R%R((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_close_erroneous_file�scCs�ttd��}|jd�WdQXtjt�}|j|�ttd��$}tj|�}|j|�WdQXt�}|jd�tj|�}|j|�|jdd�tj|�}|j|�dS(s;Check that is_zipfile() correctly identifies non-zip files.R'sthis is not a legal zip file
NR�i(	R!RR"R)t
is_zipfiletassertFalseR=RR�(R#R%tchk((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_is_zip_erroneous_file�s
	
cCs�tj�}tj|dd��}|jdd�WdQX|j�}xFtt|��D]2}tj|| �}|jtj	tj|�qYWdS(sCCheck that zipfiles with missing bytes at the end raise BadZipFile.R�R'sfoo.txtsO, for a Muse of Fire!N(
tiotBytesIOR)R*R+R8R�R:R�R�(R#R%R�tzipfiledatatN((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_damaged_zipfile�scCs�tjtdd��}|jdd�WdQXtjt�}|j|�ttd��?}tj|�}|j|�|jdd�|j�}WdQXt	�}|j
|�tj|�}|j|�|jdd�tj|�}|j|�dS(s7Check that is_zipfile() correctly identifies zip files.R�R'sfoo.txtsO, for a Muse of Fire!NR�i(R)R*RR+RR=R!R�R4RR"(R#R�RR%tzip_contents((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_is_zip_valid_file�s 

	

cCs|jttjt�dS(N(R�RR)R*R(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt%test_non_existent_file_raises_IOError�scCssttd��}WdQX|jtjtjt�ttd��}|jd�WdQX|jtjtjt�dS(NR's
short file(R!RR�R)R�R*R"(R#R,R%((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt!test_empty_file_raises_BadZipFile�sc	Cs�t�}tj|dd��}|jdd�WdQX|jt|jd�|jt|jd�|jt|j�|jt|jdd�tt	d��*}|j
d�|jt|j
t	�WdQXdS(	s?Verify that testzip() doesn't swallow inappropriate exceptions.R�R'sfoo.txtsO, for a Muse of Fire!Ns	bogus.txtR�szipfile test data(RR)R*R+R�R�R4R!RFRR"(R#R R�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt#test_closed_zip_raises_RuntimeError�s	
cCs|jttjtd�dS(s>Check that bad modes passed to ZipFile constructor are caught.tqN(R�R�R)R*R(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_bad_constructor_modesc
Csvtjtdd��}|jdd�WdQXtjtdd��-}|jd�|jt|jdd�WdQXdS(s7Check that bad modes passed to ZipFile.open are caught.R�R'sfoo.txtsO, for a Muse of Fire!NR0R(R)R*RR+R4R�R�R!(R#R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_bad_open_modes

cCs�tjtdd��u}|jdd�|jd��M}x-tt�D]}|j|jd�d�qGW|j|j�d�WdQXWdQXdS(ssCheck that calling read(0) on a ZipExtFile object returns an empty
        string and doesn't advance file pointer.R�R'sfoo.txtsO, for a Muse of Fire!iRTN(	R)R*RR+R!RRR3R4(R#R�R,R$((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt
test_read0sc	Cs;tjtdd�� }|jt|jdd�WdQXdS(sqCheck that attempting to call open() for an item that doesn't
        exist in the archive raises a RuntimeError.R�R'sfoo.txtR0N(R)R*RR�tKeyErrorR!(R#R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_open_non_existent_itemscCs |jttjtdd�dS(sMCheck that bad compression methods passed to ZipFile.open are
        caught.R'i����N(R�R�R)R*R(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_bad_compression_mode scCsDd}tjtj|�d��}|jt|jd�WdQXdS(NsfPK.�C�@xPK..�C�@�xPK/!R0tx(R)R*RRR�tNotImplementedErrorR!(R#R R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_unsupported_compression%scCsKtjtdd��0}|jdd�|j|j�dg�WdQXdS(sLCheck that a filename containing a null byte is properly
        terminated.R�R'sfoo.txtqqqsO, for a Muse of Fire!sfoo.txtN(R)R*RR+R3RA(R#R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_null_byte_in_filename0scCsP|jtjd�|jtjd�|jtjd�|jtjd�dS(sACheck that ZIP internal structure sizes are calculated correctly.ii.i8iN(R3R)tsizeEndCentDirtsizeCentralDirtsizeEndCentDir64tsizeEndCentDir64Locator(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_struct_sizes7scCstjtdd��*}|j|jd�|jdd�WdQXtjtdd��}|j|jd�WdQXd}tjtdd�� }||_|jdd�WdQXtjtdd��}|j|j|�WdQXdjgtd�D]}d|dd
^q��}tjtdd�� }||_|jdd�WdQXtjtdd��}|j|j|�WdQXtjtdd��=}tdt	f��|d|_WdQX|jdd�WdQXtjtdd��}|j|j|�WdQXdS(s8Check that comments on the archive are handled properly.R�R'RTsfoo.txtsO, for a Muse of Fire!NR0s9Bravely taking to his feet, he beat a very brave retreat.iis%dii
toopsii��(
R)R*RR3R�R+RRR
Rc(R#R�R�R$tcomment2((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt
test_comments>s.	4	cCsltjtdtj�� }|j|j�d|_WdQXtjtd��}|j|jd�WdQXdS(NR�sthis is a commentR0(R)R*RRRRRR�R3(R#R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt$test_change_comment_in_empty_archivebs
c	Cs�tjtdtj��}|jdd�WdQXtjtdtj�� }|j|j�d|_WdQXtjtd��}|j|jd�WdQXdS(NR'sfoo.txtsO, for a Muse of Fire!R�sthis is a commentR0(	R)R*RRRR+R=RR�R3(R#R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt'test_change_comment_in_nonempty_archiveiscCsN|j|}tjtj|�dd��}|jd|j��WdQXdS(s>Tests that files with bad CRCs return their name from testzip.R�R0tafileN(tzips_with_bad_crcR)R*RRR3RF(R#R-tzipdataR�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytcheck_testzip_with_bad_crcrs
!cCs|jtj�dS(N(R5R)RR(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt test_testzip_with_bad_crc_storedzss
requires zlibcCs|jtj�dS(N(R5R)R|(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt"test_testzip_with_bad_crc_deflated}scCs#|j|}tjtj|�dd�� }|jtj|jd�WdQXtjtj|�dd��8}|jdd��}|jtj|j�WdQXWdQXtjtj|�dd��Z}|jdd��?}d|_	|jtj��x|jd�rq�WWdQXWdQXWdQXdS(sFTests that files with bad CRCs raise a BadZipfile exception when read.R�R0R2Ni(
R3R)R*RRR�R�R4R!t
MIN_READ_SIZE(R#R-R4R�tcorrupt_file((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytcheck_read_with_bad_crc�s
!!"!	cCs|jtj�dS(N(R:R)RR(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_read_with_bad_crc_stored�scCs|jtj�dS(N(R:R)R|(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_read_with_bad_crc_deflated�scCs�x�d	D]�}|d}t|�}tjtj�d|��W}|jd|�|jdd��,}|j|�}|jt	|�|�WdQXWdQXqWdS(
Nii�iii@R'R_R0(ii�iii@(
RR)R*RRR+R!R4R3R:(R#R-t	test_sizeRDtjunkR�R%tbuf((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytcheck_read_return_size�s

cCs|jtj�dS(N(R@R)RR(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_read_return_size_stored�scCs|jtj�dS(N(R@R)R|(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_read_return_size_deflated�scCs�tjtdd��}WdQXy#tjtdd�}|j�Wn!tjk
rd|jd�nXtjtdd��}WdQXy#tjtdd�}|j�Wn|jd�nXdS(NR�R'R0s+Unable to create empty ZIP file in 'w' modeR�s+Unable to create empty ZIP file in 'a' mode(R)R*RR�R�R(R#R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_empty_zipfile�scCs8ttd��}WdQX|jtjtjtd�dS(NR'R0(R!RR�R)R�R*(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_open_empty_file�sc
Cs|jttjdd�dS(Nt	seventiesi�ii(i�iiiii(R�R�R)R�(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_create_zipinfo_before_1980�s	cCsAd}tjtj|�d��}|j|j��WdQXdS(s>If an extra field in the header is less than 4 bytes, skip it.snPK���@����abcAPK���@������abcPK3%R0N(R)R*RRtassertIsNoneRF(R#R4R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt#test_zipfile_with_short_extra_field�scCstt�tt�dS(N(RRRQ(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR��s
(*R�R�R)RRR|R3R	R
RRRRRRRRRR R"R#R&R'R,R/R0R1R5R6RR�R7R:R;R<R@RARBRCRDRFRHR�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR^sJ
	
	
											
							$													tDecryptionTestscBsfeZdZdZdZdZddZd�Zd�Zd�Z	d	�Z
eed
�d��Z
RS(s�Check that ZIP decryption works. Since the library does not
    support encryption at the moment, we use a pre-generated encrypted
    ZIP file.s�PKn�i.#y�?&test.txt��gly|�-�=�y�r�Z}Lg���|�䋺�)���lPKn�i.#y�?& ��test.txtPK6Ls�PK	�}38xu��zeroUT	֋�Gڋ�GUx���<M�a�X�Y&�{oEם���PKxu��PK	�}38xu��
��zeroUT֋�GUxPK?[szipfile.py encryption testticCs~ttd��}|j|j�WdQXtjtd�|_ttd��}|j|j�WdQXtjtd�|_	dS(NRR0(
R!RR"R R)R*RrRQRitzip2(R#R%((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR&�scCs8|jj�tjt�|jj�tjt�dS(N(RrR�R�RRRKRQ(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR�s


cCs6|jt|jjd�|jt|jjd�dS(Nstest.txttzero(R�R�RrR4RK(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_no_passwordscCsV|jjd�|jt|jjd�|jjd�|jt|jjd�dS(Ntperlstest.txtRL(RrtsetpasswordR�R�R4RK(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_bad_passwordss
requires zlibcCsb|jjd�|j|jjd�|j�|jjd�|j|jjd�|j�dS(Ntpythonstest.txtt12345RL(RrROR3R4tplainRKtplain2(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_good_passwords(R�R�t__doc__R RiRSRTR&R�RMRPRR�RU(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRI�s	
				tTestsWithRandomBinaryFilescBs�eZd�Zd�Zd�Zd�Zd�Zeed�d��Z	d�Z
d�Zeed�d	��Zd
�Z
d�Zeed�d��ZRS(
cCsntdd�dtdd�}djd�t|�D��|_ttd��}|j|j�WdQXdS(Nii@iiRTcss1|]'}tjdt�tdd��VqdS(s<fi���i�N(tstructtpackRR(R�R$((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pys	<genexpr>"sR(RRRR R!RR"(R#t	datacountR%((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR& s
 cCstt�tt�dS(N(RRRQ(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR�)s
cCsBtj|d|��'}|jtd�|jtt�WdQXdS(NR'sanother.name(R)R*R"R(R#R,R-R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR/-scCs�|j||�tj|d|��d}|jt�}|jt|�t|j��|j||j�|j|jd�|j�WdQXdS(NR0sanother.name(R/R)R*R4RR3R:R (R#R,R-R.ttestdata((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRP3scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRRPR)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRS=ss
requires zlibcCs:x3tt�tj�fD]}|j|tj�qWdS(N(RQRRRRPR)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR}AscCsV|j||�tj|d|��+}g}|jt��:}x0trr|jd�}|sbPn|j|�qCWWdQXg}|jd��:}x0tr�|jd�}|s�Pn|j|�q�WWdQXdj|�}	|j	t
|	�t
|j��|j	|	|j�dj|�}
|j	t
|
�t
|j��|j	|
|j�WdQXdS(NR0isanother.nameRT(R/R)R*R!RRUR4RVRR3R:R (R#R,R-R.RWRXRYRZR[t	testdata1t	testdata2((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR\Fs,		cCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR\R)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR]cscCs:x3tt�tj�fD]}|j|tj�qWdS(N(RQRRRR\R)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR~gscCs�|j||�tj|d|���}g}|jt��C}x9tr{|jtdd��}|skPn|j|�qCWWdQXdj	|�}|j
t|�t|j��|j
||j�WdQXdS(NR0iiRT(
R/R)R*R!RRUR4RRVRR3R:R (R#R,R-R.RWRXRYR[((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRels	cCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRReR)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRf}scCs:x3tt�tj�fD]}|j|tj�qWdS(N(RQRRRReR)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR�s(R�R�R&R�R/RPRSRR�R}R\R]R~ReRfR(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRWs					
					s
requires zlibtTestsWithMultipleOpenscBsheZed��Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�ZRS(
cCs*dtd�|_dtd�|_dS(Nt111i't222(Rtdata1Ri(tcls((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt
setUpClass�scCsKtj|dtj��-}|jd|j�|jd|j�WdQXdS(NR'tonesttwos(R)R*R|R+RaRi(R#R,R.((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR/�scCs�|jt�tjtdd���}|jd��]}|jd��E}|jd�}|jd�}||j�7}||j�7}WdQXWdQX|j||�|j||j�WdQXdS(NR�R0Rdi�(R/RQR)R*R!R4R3Ra(R#R�tzopen1tzopen2RaRi((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_same_file�s
cCs�|jt�tjtdd���}|jd��]}|jd��E}|jd�}|jd�}||j�7}||j�7}WdQXWdQX|j||j�|j||j�WdQXdS(NR�R0RdRei�(	R/RQR)R*R!R4R3RaRi(R#R�RfRgRaRi((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_different_file�s
cCs�|jt�tjtdd���}|jd��]}|jd�}|jd��6}|jd�}||j�7}||j�7}WdQXWdQX|j||j�|j||j�WdQXdS(NR�R0Rdi�Re(	R/RQR)R*R!R4R3RaRi(R#R�RfRaRgRi((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_interleaved�s
cCs�|jt�d}}z{tjtd��%}|jd�}|jd�}WdQX|jd�}|jd�}||j�7}||j�7}Wd|r�|j�n|r�|j�nX|j||j	�|j||j
�dS(NR0RdRei�(R/RQR�R)R*R!R4R�R3RaRi(R#RfRgR�RaRi((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_read_after_close�s 


c
Cs�tjtdtj��T}|jd|j�|jd|j�|jd��}|jd�}WdQXWdQX|j	||jd �tjtd��%}|jd�}|jd�}WdQX|j	||j�|j	||j�dS(NR'RdRei�R0(
R)R*RQR|R+RaRiR!R4R3(R#R�RfRaRi((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_read_after_write�scCs�tjtdtj��R}|jd|j�|jd��'}|jd�|jd|j�WdQXWdQXtjtd��%}|jd�}|jd�}WdQX|j	||j�|j	||j�dS(NR'Rdi�ReR0(
R)R*RQR|R+RaR!R4RiR3(R#R�RfRaRi((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_write_after_read�s
c
Cs�|jt�tjtdd��C}x9td�D]+}|jd�|jd��}WdQXq2WWdQXttj��}|j	|j
�d�WdQXdS(NR�R0idRd(R/RQR)R*R�R4R!R�tdevnullt
assertLesstfileno(R#R�R$RfR,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_many_opens�s

cCstt�dS(N(RRQ(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR��s(
R�R�tclassmethodRcR/RhRiRjRkRlRmRqR�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR^�s		
	
			
		tTestWithDirectorycBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCstjt�dS(N(R�RRQ(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR&�scCs�tjtd���}|jt�WdQX|jtjjtjj	td���|jtjjtjj	tdd���|jtjj
tjj	tddd���dS(Ns
zipdir.zipR�tbR�(R)R*R
R�RQR=R�R�tisdirRR
(R#R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_extract_dir�s
(+cCs*tjtjjtd��|j�dS(NR�(R�RR�RRQRv(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt
test_bug_6050sc
Cs�tjjtd�}tj|�tj|�jd@}tjt	d���}|j
|�|jd}|j|j
jd��|j|j|d>dB�|j
|d�|jd}|j|j
d	�|j|j|d>dB�WdQXtjt	d
���}|jd}|j|j
jd��|j|j|d>dB�|jd}|j|j
d	�|j|j|d>dB�tjjtd�}tj|�|j|�|jtjjtjj|d���|jttj|��d�WdQXdS(
NR$i��R'is/x/ityisy/R0R�i(R�R�RRQRtstattst_modeR)R*RR"RR=RCR�R3R�R�RuR:tlistdir(R#tdirpathR�R�R�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_write_dirs0



!



(c
CsEtjtjjtd��tjtd��J}|jdd�|j	d}|j
|jd�|j
|jd�WdQXtjtd���}|j	d}|j
|jjd��|j
|jd
�tjjtd	�}tj|�|j|�|j
tjjtjj|d���|j
tj|�dg�WdQXdS(NR$R'sx/RTii�AiR0R�i�Ai�Ai�Ai�A(R�RR�RRQR)R*RR+RR3RCR�R=R�R�RuR{(R#R�R�R�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_writestr_dir"s



(cCs-tt�tjjt�r)tt�ndS(N(RRQR�R�R
RR(R#((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR�3s
(R�R�R&RvRwR}R~R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRs�s					tUniversalNewlineTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
eed�d
��Zeed�d��Zeed�d��Zeed�d��Zeed�d��Zd�ZRS(cCs�gtt�D]}d|^q
|_d|_ii|_|_x�t|j�D]s\}}|j|j�||j|<dt|f|j|<t	|j|d��}|j
|j|�WdQXqRWdS(NsTest of zipfile line %d.s
s
s
s%s-%dR(s
s
s
(RRRtsepstarcdatatarcfilest	enumerateRRR!R"(R#R$tntsR�((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR&:s#	cCsLtj|d|��1}x'|jj�D]}|j||�q(WWdQXdS(NR'(R)R*R�tvaluesR"(R#R,R-R.RI((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR/Esc
Cs�|j||�tj|d��e}x[|jj�D]J\}}|j|d��}|j�}WdQX|j|j||�q5WWdQXdS(NR0Rg(	R/R)R*R�titemsR!R4R3R�(R#R,R-R.R�RIR%R4((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt	read_testKsc	Cs�|j||�tj|d�}x�|jj�D]�\}}|j|d��]}d}xMtr�|j�}|sxPn||7}|jd�}|s�Pn||7}q\WWdQX|j	||j
d�q2W|j�dS(NR0RgRTis
(R/R)R*R�R�R!RURmR4R3R�R�(	R#R,R-R.R�RIRjR R4((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytreadline_read_testUs 	
c	Cs�|j||�tj|d��v}xl|jj�D][\}}|j|d��;}x1|jD]&}|j�}|j||d�q`WWdQXq5WWdQXdS(NR0Rgs
(	R/R)R*R�R�R!RRmR3(	R#R,R-R.R�RIRjRkRo((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt
readline_testlsc
Cs�|j||�tj|d���}x{|jj�D]j\}}|j|d��}|j�}WdQXx4t|j|�D] \}}	|j	|	|d�q{Wq5WWdQXdS(NR0Rgs
(
R/R)R*R�R�R!RqRrRR3(
R#R,R-R.R�RIR%RtRkRu((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytreadlines_testwsc	Cs�|j||�tj|d��y}xo|jj�D]^\}}|j|d��>}x4t|j|�D] \}}|j||d�qiWWdQXq5WWdQXdS(NR0Rgs
(	R/R)R*R�R�R!RrRR3(	R#R,R-R.R�RIR�RkRu((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pytiterlines_test�scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_read_stored�scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRx�scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRy�scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyRz�scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)RR(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR{�ss
requires zlibcCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyttest_read_deflated�scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR��scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR��scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR��scCs7x0tt�t�fD]}|j|tj�qWdS(N(RQRRR�R)R|(R#R,((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR��scCsEx*|jj�D]\}}tj|�qWtt�tt�dS(N(R�R�R�R�RRRQ(R#R�RI((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR��s
(R�R�R&R/R�R�R�R�R�R�RxRyRzR{RR�R�R�R�R�R�R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyR9s$			
				
					c
Cs&tttttttttt	�	dS(N(
R	RR�RR�RIR^RsRRW(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt	test_main�s	t__main__(.R�tImportErrorR�R�RR5R>RXR)tunittestRttempfileRRRRRttest.test_supportRRRR	R
RRR
R�tUnicodeErrort	TypeErrorRQt	TESTFNDIRRR�RtTestCaseRR�R�RRIRWR^RsRR�R�(((sj/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_zipfile.pyt<module>sV

:


				��5�U��<hpA�