HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_zlib.cpython-37.opt-1.pyc
B

��g!��@sBddlZddlmZddlZddlZddlZddlZddlmZm	Z	m
Z
e�d�Ze�
ee��d�d�Ze�
ee��d�d�ZGdd	�d	ej�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�ZGdd�de�ZGdd�deej�ZGdd�deej�Zdefdd�Zdefdd�ZdZGdd�d�Ze dk�r>e�!�dS)�N)�support)�
bigmemtest�_1G�_4G�zlib�copyzrequires Compress.copy()zrequires Decompress.copy()c@seZdZdd�ZdS)�VersionTestCasecCs|�tjdtjd�dS)Nr)�assertEqualr�ZLIB_RUNTIME_VERSIONZZLIB_VERSION)�self�r�*/usr/local/lib/python3.7/test/test_zlib.py�test_library_versionsz$VersionTestCase.test_library_versionN)�__name__�
__module__�__qualname__rrrrr
rsrc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�ChecksumTestCasecCs0|�t�d�t�dd��|�t�dd��dS)N�rsabcl��)r	r�crc32�
assertTrue)rrrr
�test_crc32start sz ChecksumTestCase.test_crc32startcCs@|�t�dd�d�|�t�dd�d�|�t�dd�d�dS)Nrr�i�)r	rr)rrrr
�test_crc32empty$sz ChecksumTestCase.test_crc32emptycCs0|�t�d�t�dd��|�t�dd��dS)Nrrsabcl��)r	r�adler32r)rrrr
�test_adler32start)sz"ChecksumTestCase.test_adler32startcCs@|�t�dd�d�|�t�dd�d�|�t�dd�d�dS)Nrrri�)r	rr)rrrr
�test_adler32empty-sz"ChecksumTestCase.test_adler32emptycCs�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�dd�d�|�t�d�t�dd��|�t�d�t�dd��dS)Nspenguinrl !�Kri���Ci��i��)r	rrr)rrrr
�
test_penguins2szChecksumTestCase.test_penguinscCsTd}|�t�|�d�|�t�d�d�|�t�||�d�|�t�d�d�dS)Nsabcdefghijklmnopl�@u(sspami=��Cl
*i�O)r	rrr)r�foorrr
�test_crc32_adler32_unsigned;s
z,ChecksumTestCase.test_crc32_adler32_unsignedcCsHd}d}|�t�|�|�|�t�|�|�|�t�d�t�d��dS)Nsabcdefghijklmnopl�@u(sspam)r	�binasciirr)rrZcrcrrr
�test_same_as_binascii_crc32Cs
z,ChecksumTestCase.test_same_as_binascii_crc32N)
rrrrrrrrrr rrrr
rs	rc@s&eZdZeedddd�dd��ZdS)�ChecksumBigBufferTestCase�rF)�size�memuseZdry_runcCs4dtd}|�t�|�d�|�t�|�d�dS)NsnyanriM"B>l�a
)rr	rrr)rr#�datarrr
�test_big_bufferNsz)ChecksumBigBufferTestCase.test_big_bufferN)rrrrrr&rrrr
r!Lsr!c@sBeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zej	dd��Z
d
S)�ExceptionTestCasecCs|�tjtjdd�dS)NsERROR�
)�assertRaisesr�error�compress)rrrr
�
test_badlevelWszExceptionTestCase.test_badlevelcCs�|�ttj�|�ttj�|�ttj�|�ttj�xXdddddgfD]D}|�ttj|�|�ttj|�|�ttj|�|�ttj|�qJWdS)N�*��abcr)r)�	TypeErrorrrrr+�
decompress)r�argrrr
�test_badargs]szExceptionTestCase.test_badargscCs6|�ttjdtjd�|�ttjdtjtjd�dS)Nrr)r)�
ValueErrorr�compressobj�DEFLATED�	MAX_WBITS)rrrr
�test_badcompressobjhsz%ExceptionTestCase.test_badcompressobjcCs|�ttjd�dS)N���)r)r4r�
decompressobj)rrrr
�test_baddecompressobjosz'ExceptionTestCase.test_baddecompressobjcCs,|�tt��jd�|�tt��jd�dS)Nrr9)r)r4rr:�flush)rrrr
�test_decompressobj_badflushssz-ExceptionTestCase.test_decompressobj_badflushc	Cs�|�td��t�ddtjd�WdQRX|�td��t���dtjd�WdQRX|�td��t���tjd�WdQRXdS)Nz
int too larger�r)�assertRaisesRegex�
OverflowErrorrr1�sys�maxsizer:r<)rrrr
�
test_overflowxs zExceptionTestCase.test_overflowN)rrrr,r3r8r;r=rZcpython_onlyrCrrrr
r'Usr'c@seZdZdd�Zdd�ZdS)�BaseCompressTestCasecsLd�d��fdd�td�D��}||t|�d}z||�Wdd}XdS)Nircs"g|]}t�d����d��qS)��little)�randomZgetrandbits�to_bytes)�.0�i)�_1Mrr
�
<listcomp>�szBBaseCompressTestCase.check_big_compress_buffer.<locals>.<listcomp>r(r)�join�range�len)rr#Z
compress_funcr%r)rKr
�check_big_compress_buffer�sz.BaseCompressTestCase.check_big_compress_buffercCs^d|}zt�|d�}Wdd}X||�}z*|�t|�|�|�t|�d��d�Wdd}XdS)N�xrr)rr+r	rO�strip)rr#Zdecompress_funcr%�
compressedrrr
�check_big_decompress_buffer�sz0BaseCompressTestCase.check_big_decompress_bufferN)rrrrPrTrrrr
rD�srDc@s�eZdZdd�Zdd�Zdd�Zdd�Zeed	d
d�dd
��Z	eed	dd�dd��Z
eedd�dd��Zdd�Z
e�ejdkd�eeddd�dd���ZdS)�CompressTestCasecCs t�t�}|�t�|�t�dS)N)rr+�HAMLET_SCENEr	r1)r�xrrr
�test_speech�s
zCompressTestCase.test_speechc	Csdtjtdd�}|�t�|�t�|�t��tjtdd�WdQRX|�tj|tjtjd�t�dS)N�)�level)r%rZ)�wbits�bufsize)	rr+rVr	r1r)r0r7�DEF_BUF_SIZE)rrWrrr
�
test_keywords�s
zCompressTestCase.test_keywordscCsTtd}t�|�}|�t�t|��|�x&|t|�fD]}|�t�|�|�q6WdS)N�)rVrr+r	�	bytearrayr1)rr%rWZobrrr
�test_speech128�s

zCompressTestCase.test_speech128cCs*t�t�}|�tjdtj|dd��dS)NzAError -5 while decompressing data: incomplete or truncated streamr9)rr+rVr?r*r1)rrWrrr
�test_incomplete_stream�s
z'CompressTestCase.test_incomplete_streamirY)r#r$cCsdd�}|�||�dS)NcSst�|d�S)Nr)rr+)�srrr
�<lambda>�rz;CompressTestCase.test_big_compress_buffer.<locals>.<lambda>)rP)rr#r+rrr
�test_big_compress_buffer�sz)CompressTestCase.test_big_compress_buffer�cCs|�|tj�dS)N)rTrr1)rr#rrr
�test_big_decompress_buffer�sz+CompressTestCase.test_big_decompress_bufferrcCs.td}t�|d�}|�t�|d|�|�dS)Nr(rr>)rVrr+r	r1)rr#r%rSrrr
�test_large_bufsize�sz#CompressTestCase.test_large_bufsizecCs0td}t�|d�}|�t�|dt��|�dS)Nr(rr>)rVrr+r	r1�	CustomInt)rr%rSrrr
�test_custom_bufsize�sz$CompressTestCase.test_custom_bufsizelzrequires 64bit platform�dr"cCs:d|}z"t�|d�}|�t�|�|�Wdd}}XdS)NrQr)rr+r	r1)rr#r%�comprrr
�test_64bit_compress�s
z$CompressTestCase.test_64bit_compressN)rrrrXr^rarbrrrergrrhrj�unittest�
skipUnlessrArBrmrrrr
rU�s
	rUc@s�eZdZdd�Zdd�Zdd�Zdd�Zd]d
d�Zdd�Zd^dd�Z	d_dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Ze�eed!�d"�d#d$��Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zee d7d8�d9d:��Z!d;d<�Z"e#d=d>��Z$e#d?d@��Z%e&dAdB��Z'e&dCdD��Z(dEdF�Z)dGdH�Z*ee+dIdJd8�dKdL��Z,ee+dIdMd8�dNdO��Z-e�e.j/dPkdQ�ee dRdSd8�dTdU���Z0e�e.j/dPkdQ�ee dRdJd8�dVdW���Z1e�e.j/dPkdQ�ee dRdXd8�dYdZ���Z2d[d\�Z3d
S)`�CompressObjectTestCasecCs�td}t�|�}xN|t|�fD]>}t��}|�|�}|��}|�tj|j�|�|||�q Wxn||ft|�t|�ffD]R\}}t�	�}	|	�
||�}
|	��}|�||
|�|�|	jt
�|�|	jt
�q|WdS)Nr_)rVrr+r`r5r<r)r*r	r:r1�assertIsInstance�unconsumed_tail�bytes�unused_data)rZdatasrcZdatazipr%�co�x1�x2Zv1Zv2�dco�y1�y2rrr
�	test_pair�s

"z CompressObjectTestCase.test_pairc
	Cs�d}tj}d}d}tj}tj|||||dd�}tj|dd�}|�t��|jtd�WdQRX|�t��|j	t�t�d�WdQRX|�t�|�
�}|j	|tt�d�|�
�}	|�t|	�dS)	Nrfi��	r)rZ�methodr[�memLevel�strategy�zdict)r[r�)r%)�
max_length)
rr6�
Z_FILTEREDr5r:r)r0r+rVr1r<rOr	)
rrZr}r[r~rru�dorW�yrrr
r^�s&z$CompressObjectTestCase.test_keywordscCspd}tj}d}d}tj}t�|||||�}|�t�}|��}t�|�}	|	�||�}
|	��}|�	t|
|�dS)Nrfi�r|)
rr6r�r5r+rVr<r:r1r	)rrZr}r[r~rrurvrwrxryrzrrr
�test_compressoptionss

z+CompressObjectTestCase.test_compressoptionsc		Cs�td}t��}g}x4tdt|�d�D] }|�|�|||d���q&W|�|���d�|�}t�	�}|�
d�|��}|��}|�|||�dS)Nr_r�r)rVrr5rNrO�appendr+r<rMr:r1r	)	rr%ru�bufsrJ�combufrxryrzrrr
�test_compressincrementals 
z/CompressObjectTestCase.test_compressincrementalFNr��@c
	Csp|pt}|d}t��}g}x4tdt|�|�D] }|�|�||||���q.W|�|���d�|�}	t�	|	�}
|�
|
t�|�||
�t�
�}g}x\tdt|	�|�D]H}|�|�	|	|||���|�d|jdt|j��|�d|j�q�W|�r|�|���n&x$|�	d�}|�r*|�|�nP�qW|�d|jdt|j��|�d|j�|�|d�|��dS)Nr_rrz"(A) uct should be b'': not %d longz"(B) uct should be b'': not %d long)rVrr5rNrOr�r+r<rMr1rqrsr	r:rrrt)
rr<�source�cx�dcxr%rur�rJr�Zdecombufrx�chunkrrr
�test_decompinc*s> 




z%CompressObjectTestCase.test_decompinccCs|jdd�dS)NT)r<)r�)rrrr
�test_decompincflushSsz*CompressObjectTestCase.test_decompincflushc	Cs�|pt}|d}t��}g}x4tdt|�|�D] }|�|�||||���q.W|�|���d�|�}|�	|t�
|�d�t��}	g}|}
xD|
r�|	�
|
|�}|�t|�|kdt|�|f�|�|�|	j
}
q�W|�|	���|�	|d�|�d�dS)Nr_rrzcompressed data failurezchunk too big (%d>%d)zWrong data retrieved)rVrr5rNrOr�r+r<rMr	r1r:�assertFalserr)rr�r�r�r%rur�rJr�rx�cbr�rrr
�test_decompimaxVs* 


z&CompressObjectTestCase.test_decompimaxc	CsJtd}t��}g}x4tdt|�d�D] }|�|�|||d���q&W|�|���d�|�}|�	|t�
|�d�t��}g}|}xT|r�dt|�d}	|�
||	�}
|�t|
�|	kdt|
�|	f�|�|
�|j
}q�W|r�|�|���nBx@|
�r0|�
d|	�}
|�t|
�|	kdt|
�|	f�|�|
�q�W|�	|d�|�d	�dS)
Nr_rr�rzcompressed data failurerr(zchunk too big (%d>%d)zWrong data retrieved)rVrr5rNrOr�r+r<rMr	r1r:r�rr)rr<r%rur�rJr�rxr�r�r�rrr
�test_decompressmaxlenqs6 


z,CompressObjectTestCase.test_decompressmaxlencCs|jdd�dS)NT)r<)r�)rrrr
�test_decompressmaxlenflush�sz1CompressObjectTestCase.test_decompressmaxlenflushcCs,t��}|�t|jdd�|�d|j�dS)Nrr9)rr:r)r4r1r	rr)rrxrrr
�test_maxlenmisc�sz&CompressObjectTestCase.test_maxlenmisccCsHtd}|�t|�tj�t�|d�}t��}|�|�|t	j
�|�dS)Nr(r)rVZ
assertGreaterrOrr]r+r:r	r1rArB)rr%rSrxrrr
�test_maxlen_large�s
z(CompressObjectTestCase.test_maxlen_largecCs>td}t�|d�}t��}|�|�|t��|dd��dS)Nr(rrk)rVrr+r:r	r1ri)rr%rSrxrrr
�test_maxlen_custom�sz)CompressObjectTestCase.test_maxlen_customcCs:d}t��}|�|d�}||�|j�7}|�|jd�dS)Ns
x�KLJMrr)rr:r1rrr	)rZcdatarxZddatarrr
�test_clear_unconsumed_tail�s
z1CompressObjectTestCase.test_clear_unconsumed_tailcCsddddg}tdd�tj�d�D��}|dkr8|�d	�d
d�|D�}td}x�|D]�}x�td
�D]�}yDt�|�}|�|dd��}|�	|�}|�|dd��}	|�	�}
Wnt
d�||���YnX|�t�
d�|||	|
g��|d||f�~qbWqTWdS)NZ
Z_NO_FLUSH�Z_SYNC_FLUSHZZ_FULL_FLUSHZZ_PARTIAL_FLUSHcss|]}t|�VqdS)N)�int)rI�vrrr
�	<genexpr>�sz6CompressObjectTestCase.test_flushes.<locals>.<genexpr>�.)rrf�rYZZ_BLOCKcSs g|]}tt|�rtt|��qSr)�hasattrr�getattr)rI�optrrr
rL�sz7CompressObjectTestCase.test_flushes.<locals>.<listcomp>rEr(i�z!Error for flush mode={}, level={}rz*Decompress failed: flush mode=%i, level=%i)�tuplerr
�splitr�rVrNr5r+r<�print�formatr	r1rM)rZsync_optZverr%�syncrZ�obj�a�b�c�drrr
�test_flushes�s.




z#CompressObjectTestCase.test_flushesr�zrequires zlib.Z_SYNC_FLUSHc	Cs�ddl}t�tj�}t��}y|��}Wn:tk
rby|��}Wntk
r\|}YnXYnX|�d�t	dd|d�}|�
|�}|�tj�}|�
||�}|�||d�dS)NrriD)�	generatorz17K random source doesn't match)rGrr5�Z_BEST_COMPRESSIONr:ZWichmannHill�AttributeErrorZRandom�seed�genblockr+r<r�r1r	)	rrGrurx�genr%�first�secondZexpandedrrr
�test_odd_flush�s 

z%CompressObjectTestCase.test_odd_flushcCs6t�tj�}|�|���t��}|�|��d�dS)Nr)rr5r�rr<r:r	)rrurxrrr
�test_empty_flush�sz'CompressObjectTestCase.test_empty_flushcCs�t}|��}t�|�d�|�}tj|d�}|�|�|��}tj	|d�}|�
|�|�|��|�t�	�}|�tj
|j|�dS)Nr)r�)rVr�rGZshufflerMrr5r+r<r:r	r1r)r*)r�hZwordsr�ruZcdrxrrr
�test_dictionary�s

z&CompressObjectTestCase.test_dictionarycCs�tjtd�}tjtd�}tdd�}|�|�|�tj�}|�|dd��|�tj�}|�|dd��|�tj�}|�|�|�|�|�|�|�|dd��|�|�|�|dd��dS)N)r�i�i�rki����)	rr5rVr:r+r<r�r	r1)rrur�Zpiece�d0�d1Zd2rrr
�test_dictionary_streamingsz0CompressObjectTestCase.test_dictionary_streamingcCsfd}|�t�|�d�|�tjtj|dd��t��}|�|dd��}||��7}|�|d�dS)Nsx�K���Esfoo���)r	rr1r)r*r:r<)rrWrxr�rrr
�!test_decompress_incomplete_streamsz8CompressObjectTestCase.test_decompress_incomplete_streamcCsld}t��}|�|j�|�|dd��|�|j�|�|dd��|�|j�|��|�|j�dS)Nsx�K���Er�)rr:r��eofr1rr<)rrWrxrrr
�test_decompress_eof(sz*CompressObjectTestCase.test_decompress_eofcCsNd}t��}|�|j�|�|dd��|�|j�|��|�|j�dS)Nsx�K���Er�)rr:r�r�r1r<)rrWrxrrr
�%test_decompress_eof_incomplete_stream3sz<CompressObjectTestCase.test_decompress_eof_incomplete_streamc
Csd}d}t�|�}||}x�dD]�}x�ddt|�t|�fD]�}t��}d}x�tdt|�|�D]r}	|	t|�krz|�|jd�|dkr�||�||	|	|��7}|�|jd�q\||�|j||	|	|�|�7}q\W||�	�7}|�
|j�|�||�|�|jd�|�|j|�q:Wq WdS)Nsabcdefghijklmnopqrstuvwxyzs
0123456789)ri�rrfrr)rr+rOr:rNr	rtr1rrr<rr�)
rr�Z	remainderr�rW�maxlen�steprxr%rJrrr
�test_decompress_unused_data<s*

 z2CompressObjectTestCase.test_decompress_unused_datacCs\d}tjtj|d�}|�|�|��}tjtj|d�}|�|�|��}|�||�dS)Nsabcdefghijklmnopqrstuvwxyz)r[r�)rr5r7r+r<r:r1r	)rr�rurlrx�uncomprrr
�#test_decompress_raw_with_dictionaryWsz:CompressObjectTestCase.test_decompress_raw_with_dictionarycCsNd}d}t�|�}t��}|�|d�~t�|�}|�|��|dd��dS)NsabcdefghijklmnopqrstuvwxyzsQWERTYUIOPASDFGHJKLZXCVBNMr)rr+r:r1r	r<)rZinput1Zinput2r%rxrrr
�test_flush_with_freed_input_s

z2CompressObjectTestCase.test_flush_with_freed_inputr)r#r$cCsFtd}t�|d�}t��}|�|d�|�|�|�|dd��dS)Nr(r)rVrr+r:r1r	r<)rr#�inputr%rxrrr
�test_flush_large_lengthks
z.CompressObjectTestCase.test_flush_large_lengthcCsHtd}t�|d�}t��}|�|d�|�|�t��|dd��dS)Nr(r)rVrr+r:r1r	r<ri)rr�r%rxrrr
�test_flush_custom_lengthts
z/CompressObjectTestCase.test_flush_custom_lengthc	Cs�t}tttd���d�}t�tj�}g}|�|�|��|�	�}|dd�}|�|�|��|�|�
��d�|�}|�|�|��|�|�
��d�|�}|�t�
|�||�|�t�
|�||�dS)N�asciir)rVrs�str�swapcaserr5r�r�r+rr<rMr	r1)	rZdata0Zdata1Zc0�bufs0Zc1�bufs1�s0�s1rrr
�test_compresscopy{s

z(CompressObjectTestCase.test_compresscopycCs,t��}|�t�|��|�t|j�dS)N)rr5r+rVr<r)r4r)rr�rrr
�test_badcompresscopy�s
z+CompressObjectTestCase.test_badcompresscopyc	Cs�t}t�|�}|�|t�t��}g}|�|�|dd���|��}|dd�}|�|�|dd���d�	|�}|�|�|dd���d�	|�}|�
||�|�
||�dS)N� r)rVrr+rqrsr:r�r1rrMr	)	rr%rlr�r�r�r�r�r�rrr
�test_decompresscopy�s


z*CompressObjectTestCase.test_decompresscopycCs6t�t�}t��}|�|�|��|�t|j�dS)N)	rr+rVr:r1r<r)r4r)rr%r�rrr
�test_baddecompresscopy�s


z-CompressObjectTestCase.test_baddecompresscopyc
CsLxFttjd�D]4}|�ttjf��t�t�tj	�|�WdQRXqWdS)Nr)
rN�pickle�HIGHEST_PROTOCOLr)r0�
PicklingError�dumpsrr5r�)r�protorrr
�test_compresspickle�sz*CompressObjectTestCase.test_compresspicklec
CsHxBttjd�D]0}|�ttjf��t�t��|�WdQRXqWdS)Nr)	rNr�r�r)r0r�r�rr:)rr�rrr
�test_decompresspickle�sz,CompressObjectTestCase.test_decompresspickleirYcs&t�d���fdd�}|�||�dS)Nrcs��|����S)N)r+r<)rc)r�rr
rd�rzACompressObjectTestCase.test_big_compress_buffer.<locals>.<lambda>)rr5rP)rr#r+r)r�r
re�s
z/CompressObjectTestCase.test_big_compress_bufferrfcs$t����fdd�}|�||�dS)Ncs��|����S)N)r1r<)rc)r�rr
rd�rzCCompressObjectTestCase.test_big_decompress_buffer.<locals>.<lambda>)rr:rT)rr#r1r)r�r
rg�sz1CompressObjectTestCase.test_big_decompress_bufferlzrequires 64bit platformrkr"cCsbd|}t�d�}t��}z4|�|�|��}|�|�|��}|�||�Wdd}}}XdS)NrQr)rr5r:r+r<r1r	)rr#r%rur�rlr�rrr
rm�s
z*CompressObjectTestCase.test_64bit_compresscCsfd}d|}t�|�|}t��}z0|�|�|��}|�||j�|�||�Wdd}}}XdS)NsabcdefghijklmnoprQ)rr+r:r1r<r	rt)rr#r%Zunusedrlr�r�rrr
�test_large_unused_data�sz-CompressObjectTestCase.test_large_unused_datar�cCsbd|}t��}z>t�|d�}|�|d�|��}|�||�|�|jd�Wdd}}}XdS)NrQrrr)rr:r+r1r<r	rr)rr#r%r�rlr�rrr
�test_large_unconsumed_tail�sz1CompressObjectTestCase.test_large_unconsumed_tailc
	Cs�tj�dd�d�d�}t|�dkr0|�d�n|d��sDd|d<ttt|��}|dk}tj	dd	d
�}|�
t�|��}|�
t�|d	�t�|r�|�
t�|d�t�|�
t�|d�t�|�tjd��t�|d
�WdQRXtjdd�}|�
|�|�t�tjd
d�}|�tjd��|�|�WdQRXtj	ddd
�}|�
t�|��}|�
t�|d�t�|�
t�|d	�t�|�r�|�
t�|d�t�|�
t�|d�t�tjdd�}|�
|�|�t�tj	ddd
�}|�
t�|��}|�
t�|d�t�tjdd�}|�
|�|�t�tj	ddd
�}|�
t�|��}|�
t�|d�t�|�
t�|d�t�tjdd�}|�
|�|�t�tj	ddd
�}|�
t�|��}	|�
t�|	d�t�|�
t�|	d�t�t�d�}|�
|�|	�t�dS)N�-rrr�r"�0r9)rrfrYr�r>)rZr[�/zinvalid window size�)r[r|�)i�i�����)rr
r�rOr��	isnumericr��mapr�r5r+rVr<r	r1r?r*r:)
rr�Zsupports_wbits_0ruZzlib15rxZzlib9Z	deflate15Zdeflate9Zgziprrr
�
test_wbits�s\
z!CompressObjectTestCase.test_wbits)FNr�r�)Nr�r�)F)4rrrr{r^r�r�r�r�r�r�r�r�r�r�r�r�rnror�rr�r�r�r�r�r�r�r�r�r�rrr�r��requires_Compress_copyr�r��requires_Decompress_copyr�r�r�r�rrergrArBrmr�r�r�rrrr
rp�sT
)

 		 !


			
rpicsj|dk	r|�|�|j�||ks(|dkr,|}t�}x2td||�D]"}|t�fdd�t|�D��7}q@W|S)zDlength-byte stream of random data from a seed (in step-byte blocks).Nrfrc3s|]}�dd�VqdS)r�Nr)rIrW)�randintrr
r�>szgenblock.<locals>.<genexpr>)r�r�rsrN)r��lengthr�r�ZblocksrJr)r�r
r�5s
"r�cs4|dk	r��|�|�d����fdd�t|�D�S)z=Return a list of number lines randomly chosen from the sourceN�
csg|]}�����qSr)�choice)rI�n)r��sourcesrr
rLHsz choose_lines.<locals>.<listcomp>)r�r�rN)r�Znumberr�r�r)r�r�r
�choose_linesCs

r�s�
LAERTES

       O, fear me not.
       I stay too long: but here my father comes.

       Enter POLONIUS

       A double blessing is a double grace,
       Occasion smiles upon a second leave.

LORD POLONIUS

       Yet here, Laertes! aboard, aboard, for shame!
       The wind sits in the shoulder of your sail,
       And you are stay'd for. There; my blessing with thee!
       And these few precepts in thy memory
       See thou character. Give thy thoughts no tongue,
       Nor any unproportioned thought his act.
       Be thou familiar, but by no means vulgar.
       Those friends thou hast, and their adoption tried,
       Grapple them to thy soul with hoops of steel;
       But do not dull thy palm with entertainment
       Of each new-hatch'd, unfledged comrade. Beware
       Of entrance to a quarrel, but being in,
       Bear't that the opposed may beware of thee.
       Give every man thy ear, but few thy voice;
       Take each man's censure, but reserve thy judgment.
       Costly thy habit as thy purse can buy,
       But not express'd in fancy; rich, not gaudy;
       For the apparel oft proclaims the man,
       And they in France of the best rank and station
       Are of a most select and generous chief in that.
       Neither a borrower nor a lender be;
       For loan oft loses both itself and friend,
       And borrowing dulls the edge of husbandry.
       This above all: to thine ownself be true,
       And it must follow, as the night the day,
       Thou canst not then be false to any man.
       Farewell: my blessing season this in thee!

LAERTES

       Most humbly do I take my leave, my lord.

LORD POLONIUS

       The time invites you; go; your servants tend.

LAERTES

       Farewell, Ophelia; and remember well
       What I have said to you.

OPHELIA

       'Tis in my memory lock'd,
       And you yourself shall keep the key of it.

LAERTES

       Farewell.
c@seZdZdd�ZdS)ricCsdS)Nrkr)rrrr
�__int__�szCustomInt.__int__N)rrrr�rrrr
ri�sri�__main__)"rnZtestrrr�rGrAZtest.supportrrr�
import_modulerror�r5r�r:r�ZTestCaserrr!r'�objectrDrUrpr�r�rVrir�mainrrrr
�<module>s<
.	-AWG