Current File : //opt/imh-python/lib/python2.7/test/test_gzip.pyc
�
��Wc@s�dZddlZddlmZddlZddlZddlZejd�ZdZ	dZ
dejfd��YZe
d	�Zed
kr�ede�ndS(s!Test script for the gzip module.
i����N(ttest_supporttgzipsy  int length=DEFAULTALLOC, err = Z_OK;
  PyObject *RetVal;
  int flushmode = Z_FINISH;
  unsigned long start_total_out;

s�/* zlibmodule.c -- gzip-compatible data compression */
/* See http://www.gzip.org/zlib/
/* See http://www.winimage.com/zLibDll for Windows */
tTestGzipcBseZejZd�Zd�Zdd�Zejd��Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCstj|j�dS(N(Rtunlinktfilename(tself((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pytsetUpscCstj|j�dS(N(RRR(R((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttearDownstbcCs�t|�j�}tj|jd|��}|j|�}WdQX|j|t|��tj|jd|��}|j|j�|�WdQXdS(Ntwtr(	t
memoryviewttobytesRtGzipFileRtwritetassertEqualtlentread(Rtdatatmodetb_datatftl((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pytwrite_and_read_back!scCstj}y|jtj�Wn$ttfk
rC|jd�nX||_tj	|d��}|j
td�WdQXtj	|d��!}|j|j
�td�WdQXt|d��B}tj	d|dd��!}|j|j
�td�WdQXWdQXdS(Ns"Requires unicode filenames supporttwbi2trbtfileobjR(RtTESTFN_UNICODEtencodetTESTFN_ENCODINGtUnicodeErrort	TypeErrortskipTestRRR
Rtdata1RRtopen(Rtunicode_filenameRtfobj((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_unicode_filename)s		 cCs�tj|jd��[}|jtd�|j�|j�ttd�rbtj	|j��n|j
�WdQX|j
�dS(NRi2tfsync(RR
RRR!tflushtfilenothasattrtosR&tclose(RR((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyt
test_write:s

cCs|jttd��dS(Ni2(RRR!(R((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_write_memoryviewKscCs�tj|jd��]}|jt��|jd�WdQX|jt��|jdg�WdQX|jt�WdQXtj|jd��}|j|j	�t�WdQXdS(NRuÿiR(
RR
RtassertRaisestUnicodeEncodeErrorRRR!RR(RR((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_write_incompatible_typeNscCsL|j�tj|jd��}|j�}WdQX|j|td�dS(NR
i2(R,RR
RRRR!(RRtd((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyt	test_read[s
cCsL|j�tj|jd��}|j�}WdQX|j|td�dS(NtrUi2(R,RR
RRRR!(RRR1((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_read_universal_newlinesbs
c	Cs�|j�tj|jd�}|j�|jt��|jd�WdQX|jt��|jd�WdQX|jt��|j	�WdQXtj|jd�}|j�|jt��|j
d�WdQX|jt��|j�WdQXdS(NR
iiR	t(R,RR
RR+R.t
ValueErrorRtseekttellRR'(RR((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_io_on_closed_objectis


cCs�|j�tj|jd��}|jtd�WdQXtj|jd��}|j�}WdQX|j|tdtd�dS(NtabiRi2(	R,RR
RRtdata2RRR!(RRR1((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_appends
cCs�tj|jdd��}|jd�WdQXxEtdd�D]4}tj|jdd��}|jd�WdQXq>Wtj|jd��7}d}x'|jd	�}||7}|s�Pq�q�WWdQX|j|dd
�dS(NRi	taii�R:RR5i i�(RR"RRtrangeRR(RRtitzgfiletcontentstztxt((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_many_append�s
cCsz|j�tj|jd��8}tj|�� }g|D]}|^q;}WdQXWdQX|j|dtjt	��dS(NRi2(
R,RR
RtiotBufferedReaderRR!t
splitlinestTrue(RRR
tlinetlines((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_buffered_reader�s

%cCs�|j�tj|jd��a}d}xQ|j|�}|rQ|dkrQPn|jt|�|k�|dd}q+WWdQXdS(NRiii2(R,RR
Rtreadlinet
assertTrueR(RRtline_lengthtL((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyt
test_readline�s
cCs||j�tj|jd��}|j�}WdQXtj|jd��-}x#|jd�}|gkrOPqOqOWWdQXdS(NRi�(R,RR
Rt	readlines(RRRN((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_readlines�s
cCs�|j�tj|j���}x�|j�}|j�}|sDPn|j�}|j|�t|�dkrxd}nt|�}|j|�}|j	|| |�|j|�q"WWdQXdS(Ni
(
R,RR
RR8RKR7RRR(RRtoldpostline1tnewpostamounttline2((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_seek_read�s

	cCso|j�tj|j��6}|jd�|jddd�|jd�}WdQX|j|tdd!�dS(Ni
twhenceiii(R,RR
RRR7RR!(RRty((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_seek_whence�s

cCsYtj|jd��>}x4tddd�D] }|j|�|jd�q+WWdQXdS(NR	iiisGZ
(RR
RR>R7R(RRtpos((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_seek_write�s
cCsB|j�tj|jd��}|j|jjd�WdQXdS(NR
R(R,RR
RRt	myfileobjR(RR((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyt	test_mode�s
c	Cs_xXdD]P}tj|j|��3}|jt|d��|j|j|j�WdQXqWdS(NRRtname(swbsrb(RR
RRLR)RR_(RRR((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_1647484�s
c	Cs�d}tj|jdd|��}|jt�WdQXtj|j��L}|j�}|j|t�|jt|d��|j|j	|�WdQXdS(Ni�[R	tmtime(
RR
RRR!RRRLR)Ra(RRatfWritetfReadtdataRead((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyt
test_mtime�scCs�d}tj|jdd|��}|jt�WdQXt|jd��x}|jd�}|j|d�|jd�}|j|d�|jd�}|j|d�|jd	�}|j|tj	d
|��|jd�}|j|d�|jd�}	|j|	d�|jj
d
�d}
|jt|
��}|j||
�|jt
j|j�jd�|jd	�}|j|d�|jd	�}
|j|
tj	d
tt���WdQXdS(Ni�[R	RaRis�isis<iss�sLatin-1tis��d�(RR
RRR!R"RRtstructtpackRRR7R*tstattst_size(RRaRbRctidBytestcmBytet	flagsBytet
mtimeBytestxflBytetosBytetexpectedt	nameBytest
crc32Bytest
isizeBytes((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyt
test_metadata�s0 cCs�tj|jd��}|jd�WdQXtj|jd�}|j�y|�WdQXWntk
rnnX|jd�y*tj|jd��}ddWdQXWntk
r�nX|jd�dS(NRtxxxRs4__enter__ on a closed file didn't raise an exceptioniis 1 // 0 didn't raise an exception(RR
RRR+R6tfailtZeroDivisionError(RR((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_with_open%s 




c
Cs�tj|jd��}|jtd�WdQXt|jd��}|jdd�WdQXtj|jd��*}|j�}|j|tdd�WdQXdS(NRi2R:RfRsIncorrect data in file(RR
RRR!R"RR(RRR1((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_zero_padded_file:scCsrtj|jtjtjB�}tj|d��;}tjd|dd��}|j|j	d�WdQXWdQXdS(NRRRR	R5(
R*R"RtO_WRONLYtO_CREATtfdopenRR
RR_(RtfdRtg((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_fileobj_from_fdopenFscCsDd}tjdtj|���}|j|j�d�WdQXdS(Ns��cQ�ExtraI-.2�MxRtTest(RR
RDtBytesIORR(RtgzdataR((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyttest_read_with_extraNs( t__name__t
__module__RtTESTFNRRRRtrequires_unicodeR%R,R-R0R2R4R9R<RCRJRORQRWRZR\R^R`ReRuRyRzR�R�(((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyRs6						
				
						
				
	-			cCstjt�dS(N(Rtrun_unittestR(tverbose((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyt	test_mainVst__main__R�(t__doc__tunittestttestRR*RDRgt
import_moduleRR!R;tTestCaseRtNoneR�R�RG(((sg/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_gzip.pyt<module>s�?