python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_gzip.cpython-311.pyc

e}dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
ddlmZddlmZmZmZddlmZmZe
jdZd	Zd
ZejejdzZGdd
ejZGddejZ Gdde Z!Gdde Z"dZ#GddejZ$e%dkrej&dSdS)z!Test script for the gzip module.
N)PIPEPopen)
import_helper)	os_helper)_4G
bigmemtestrequires_subprocess)assert_python_okassert_python_failuregzipsy  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 */
z-gzdirc eZdZdZdZdZdS)UnseekableIOcdS)NFselfs B/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_gzip.pyseekablezUnseekableIO.seekable%suctjNioUnsupportedOperationrs rtellzUnseekableIO.tell(%%rctjrr)rargss  rseekzUnseekableIO.seek+rrN)__name__
__module____qualname__rrrrrrrr$sA&&&&&&&&rrc(eZdZejZdZdZdS)BaseTestc8tj|jdSrrunlinkfilenamers rsetUpzBaseTest.setUp2'''''rc8tj|jdSrr&rs rtearDownzBaseTest.tearDown5r*rN)r r!r"rTESTFNr(r)r,rrrr$r$/s:H((((((((rr$cVeZdZd5dZdZdZdZdZdZdZ	d	Z
d
Zee
dd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ d Z!d!Z"d"Z#d#Z$d$Z%d%Z&d&Z'd'Z(d(Z)d)Z*d*Z+d+Z,d,Z-d-Z.d.Z/d/Z0d0Z1d1Z2d2Z3d3Z4d4S)6TestGzipbct|}t|jd|z5}||}dddn#1swxYwY||t
|t|jd|z5}|||ddddS#1swxYwYdS)Nwr)bytesrGzipFiler(writeassertEquallenread)rdatamodeb_datafls      rwrite_and_read_backzTestGzip.write_and_read_back:s=t
]]4=#d(
3
3	q

A															CKK(((
]]4=#d(
3
3	/qQVVXXv...	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/s#AAA&)CC #C ct|jd5}|tdz||ttdr&tj	||
dddn#1swxYwY|
dS)Nwb2fsync)rr5r(r6data1flushfilenohasattrosrCcloserr=s  r
test_writezTestGzip.test_writeBs
]]4=$
/
/	1
GGEBJ
GGIII
HHJJJr7##
%$$$
GGIII																
					sBCC	Cctj|j}t|d5}|tdzdddn#1swxYwY||jtt|d5}|tdddn#1swxYwYt|5}|
}dddn#1swxYwY||tdz||jtdS)Nr2rBa3)pathlibPathr(rr5r6rDassertIsInstancenamestrr9r7)rr(r=ds    r"test_write_read_with_pathlike_filez+TestGzip.test_write_read_with_pathlike_filePs<
..
]]8S
)
)	 Q
GGEBJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 afc***
]]8S
)
)	Q
GGENNN															
]]8
$
$	A															EBJ'''afc*****s5AA#&A#%CCC1DDDc|ttdzttt	d}|dgd}||dS)NrBB)rY)shape)r?
memoryviewrDr4rangecast)rmr:s   rtest_write_memoryviewzTestGzip.test_write_memoryview_sp  EBJ!7!7888uU3ZZ(())vvcv))  &&&&&rcZ|ttdzdS)NrB)r?	bytearrayrDrs rtest_write_bytearrayzTestGzip.test_write_bytearrayes(  52:!6!677777rcf|tjdtdzdS)NI()r?arrayrDrs rtest_write_arrayzTestGzip.test_write_arrayhs,  S%"*!=!=>>>>>rct|jd5}|t5|ddddn#1swxYwY|t5|gdddn#1swxYwY|tdddn#1swxYwYt|jd5}||tddddS#1swxYwYdS)NrArb)	rr5r(assertRaises	TypeErrorr6rDr7r9rJs  rtest_write_incompatible_typez%TestGzip.test_write_incompatible_typeks]]4=$
/
/	1""9--
















""9--

















GGENNN															]]4=$
/
/	.1QVVXXu---	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.sjCACA"	"C%A"	&CB%C%B)	)C,B)	-CCC.D<<EEc|t|jd5}|}dddn#1swxYwY||tdzdS)Nr3rB)rKrr5r(r9r7rDrr=rTs   r	test_readzTestGzip.test_readxs
]]4=#
.
.	!A															E"H%%%%%sAAAc|g}d}t|jd5}	|}|snP|||t
|z
}|||g	dddn#1swxYwY|d	|tdzdS)Nrr3TrrB)rKrr5r(read1appendr8r7rjoinrD)rblocksnreadr=rTs     r
test_read1zTestGzip.test_read1s
]]4=#
.
.	2!
2GGII

a   Q  5111
2		2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	
&))52:66666sA)B//B36B3)sizememusecttd}tt	j|d}|||tdS)Nry
compresslevelrkfileobjr;)rcompressrDr5rBytesIOr7r9)rrz
compressedr=s    rtest_read_largezTestGzip.test_read_larges^]]5]::
MM"*Z"8"8tMDDu-----rc|t|jd}|j}||j|||j|	t5|ddddn#1swxYwY|	t5|ddddn#1swxYwY|	t5|
dddn#1swxYwYt|jd}|j}||j|||j|	t5|ddddn#1swxYwY|	t5|ddddS#1swxYwYdS)Nr3ryrr2r)rKrr5r(rassertFalseclosedrI
assertTruerl
ValueErrorr9rrr6rE)rr=rs   rtest_io_on_closed_objectz!TestGzip.test_io_on_closed_objects
	
MM$---)(((				'''


z
*
*		
FF1III															


z
*
*		
FF1III															


z
*
*		
FFHHH															
MM$---)(((				'''


z
*
*		
GGCLLL															


z
*
*		
GGIII																		sZCCC%DDD,E

EE!HH
H(I

IIc|t|jd5}|t
dzdddn#1swxYwYt|jd5}|}dddn#1swxYwY||tdzt
dzzdS)NabrkrB)	rKrr5r(r6data2r9r7rDrps   rtest_appendzTestGzip.test_appends0
]]4=$
/
/	 1
GGEBJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ]]4=$
/
/	1A															U2X%(344444s#AA#&A#
B++B/2B/cDt|jdd5}|ddddn#1swxYwYt	ddD]P}t|jdd5}|ddddn#1swxYwYQt|jd5}d}	|d
}||z
}|sn	dddn#1swxYwY||ddS)NrA	arrrkrryi saaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)rr5r(r6r]r9r7)rr=izgfilecontentsztxts      rtest_many_appendzTestGzip.test_many_appends]]4=$
2
2	a
GGDMMM															q#		At}dA66
!

















]]4=$
/
/	#6H
#{{4((D "U
##	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#	
8,,,,,s5AAAB$$B(	+B(	"C??DDc&t|jd5}|tdzdddn#1swxYwYt|jd5}||tdzdddn#1swxYwY|t5t|jdddddS#1swxYwYdS)NxbrBrk)	rr5r(r6rDr7r9rlFileExistsErrorrJs  rtest_exclusive_writezTestGzip.test_exclusive_writes
]]4=$
/
/	 1
GGEBJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 
]]4=$
/
/	31QVVXXurz222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3



/
/	/	/MM$-...	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/s5AAA61B33B7:B7!DD

D
cr|t|jd5}t	j|5}d|D}dddn#1swxYwYdddn#1swxYwY||dtdzdS)Nrkcg|]}|Srr).0lines  r
<listcomp>z1TestGzip.test_buffered_reader.<locals>.<listcomp>s,,,$,,,rrBTkeepends)	rKrr5r(rBufferedReaderr7rD
splitlines)rr=r3liness    rtest_buffered_readerzTestGzip.test_buffered_readers&	

]]4=$
/
/	-1"1%%
-,,!,,,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	
U%5%5t%5%D%D DEEEEEs5A:

A#A:#A'	'A:*A'	+A::A>A>cB|t|jd5}d}	||}|s|dkrn/|t
||k|dzdz}M	ddddS#1swxYwYdS)NrkrryrB)rKrr5r(readlinerr8)rr=line_lengthLs    r
test_readlinezTestGzip.test_readlines]]4=$
/
/	51K
5JJ{++4[A--uA+ 5666*Q"4	
5/4		5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5sABBBcv|t|jd5}|}dddn#1swxYwYt|jd5}	|d}|gkrn	ddddS#1swxYwYdS)Nrkry)rKrr5r(	readlines)rr=rs   rtest_readlineszTestGzip.test_readliness+]]4=$
/
/	1

A															]]4=$
/
/	"1
"KK$$77E
"!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"s#AAAB..B25B2c&|t|j5}	|}|}|sn|}||t|dkrd}nt|}||}|	|d||||	ddddS#1swxYwYdS)Nry
)
rKrr5r(rrrr8r9r7)rr=oldposline1newposamountline2s       rtest_seek_readzTestGzip.test_seek_reads3]]4=
)
)
	Q


#evu::b==FF ZZFv  ww777v
$	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	sCDD

D
cd|t|j5}|d|dd|d}dddn#1swxYwY||tdddS)Nrry)whence)rKrr5r(r9rr7rD)rr=ys   rtest_seek_whencezTestGzip.test_seek_whence
s]]4=
)
)	Q
FF2JJJ
FF2aF   r

A																
E"R%L)))))sABB	Bct|jd5}tdddD],}|||d-	ddddS#1swxYwYdS)Nr2rrWsGZ
)rr5r(r]rr6)rr=poss   rtest_seek_writezTestGzip.test_seek_writes
]]4=#
.
.	!!QR((
!
!s    
!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!s?A..A25A2c|t|jd5}||jjddddn#1swxYwYtj|jt|jd5}||jjdddddS#1swxYwYdS)Nr3rkxr)	rKrr5r(r7	myfileobjr;rr'rJs  r	test_modezTestGzip.test_modes:
]]4=#
.
.	5!Q[-t444	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5'''
]]4=#
.
.	5!Q[-t444	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5s#!A""A&)A&&!CCCcdD]}}t|j|5}|t	|d||j|jdddn#1swxYwY~dS)N)rArkrR)rr5r(rrGr7rR)rr;r=s   rtest_1647484zTestGzip.test_1647484&s 	8	8Dt}d33
8q6 2 2333  777
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8	8	8sAA55A9	<A9	c:|t|jd5}|t|jd||jj|jddddS#1swxYwYdS)NrkrR)	rKrr5r(rrGrr7rRrJs  rtest_paddedfile_getattrz TestGzip.test_paddedfile_getattr,s
]]4=$
/
/	<1OOGAIv66777QY^T];;;	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<sABBBc0d}t|jd|5}|tdddn#1swxYwYt|j5}|t
|d||j|	}|
|t|
|j|ddddS#1swxYwYdS)N[r2mtimer)rr5r(r6rDrrGassertIsNonerr9r7)rrfWritefReaddataReads     r
test_mtimezTestGzip.test_mtime2sg
]]4=#u]
=
=	 LL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 
]]4=
)
)	1UOOGE733444ek***zz||HXu---U[%000	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1s$AAA6BDDDc
pd}t|jd|5}|tdddn#1swxYwYt|jd5}|d}||d|d}||d	|jd	d
z}d}n#t$rd}d
}YnwxYw|d}||||d}	||	tjd
||d}
||
d|d}||d|t|}||||
tj|jjdz
|d}
||
d|d}||tjd
ttddddS#1swxYwYdS)Nrr2rrkryzLatin-1rrZz<irYsd)rr5r(r6rDopenr9r7encodeUnicodeEncodeErrorstructpackr8rrHstatst_size)rrrridBytescmByteexpectedname
expectedflags	flagsByte
mtimeBytesxflByteosByte	nameBytes
crc32Bytes
isizeBytess               r
test_metadatazTestGzip.test_metadata=s
]]4=#u]
=
=	 LL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 $-
&
&+	H%jjmmGWk222ZZ]]FVW---
(#}33I>>H '

%
(
(
(" '



(

1

IY
666AJZT5)A)ABBBjjmmGWg...ZZ]]FVW---

3|#4#455IY555
JJrwt}--59:::AJZ)9:::AJZT3u::)F)FGGGW+	H+	H+	H+	H+	H+	H+	H+	H+	H+	H+	H+	H+	H+	H+	H+	H+	H+	HsIAAA,AJ+C$#J+$C52J+4C55F)J++J/2J/cPtj|_|dSr)rTESTFN_ASCIIr(rrs rtest_metadata_ascii_namez!TestGzip.test_metadata_ascii_nameps$!.
rcgd}d}|D]\}}}||5t|jd|}|5|t
dddn#1swxYwYt
|jd5}|||d}|	||dddn#1swxYwYdddn#1swxYwYdS)N))fastry)bestrr)tradeoffrrYr2r}rkry)
subTestrr5r(r6rDrrr9r7)	rcases	xflOffsetrRlevelexpectedXflByterrrs	         rtest_compresslevel_metadataz$TestGzip.test_compresslevel_metadatats



	.3	?	?*T5/d##
?
?t}cOO((LL'''((((((((((((((($-..?%JJy)))#jjmmG$$Wo>>>???????????????	
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?	?	?sZ%C4	A0$C40A44C47A48C4ACC4C!!C4$C!%C44C8	;C8	cTt|jd5}|ddddn#1swxYwYt|jd}|	|5	dddn#1swxYwY|dn#t$rYnwxYw	t|jd5}ddzdddn#1swxYwY|ddS#t$rYdSwxYw)NrAsxxxrkz4__enter__ on a closed file didn't raise an exceptionryrz1/0 didn't raise an exception)rr5r(r6rIfailrZeroDivisionErrorrJs  rtest_with_openzTestGzip.test_with_opens
]]4=$
/
/	1
GGFOOO															MM$-..					N


















IILMMMM			D		7t}d33
q!
















II566666!			DD	s}AA
AB4BB4BB4BB44
CC D%C7+D7C;;D>C;?D
D'&D'ct|jd5}|tdzdddn#1swxYwYt|jd5}|ddddn#1swxYwYt|jd5}|}||tdzdddddS#1swxYwYdS)NrArBrs2rkzIncorrect data in file)rr5r(r6rDrr9r7rps   rtest_zero_padded_filezTestGzip.test_zero_padded_files
]]4=$
/
/	 1
GGEBJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 $-
&
&	"!
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"]]4=$
/
/	F1AQ
,DEEE	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	Fs5AAA+B

BB84C99C=C=cj|ttjtdSr)r
issubclassrBadGzipFileOSErrorrs rtest_gzip_BadGzipFile_exceptionz(TestGzip.test_gzip_BadGzipFile_exceptions'
4#3W==>>>>>rcVt|jd5}|tdzdddn#1swxYwYt|jd5}|tj|jddddS#1swxYwYdS)NrArBr3)	rr(r6rDrr5rlrr)rfiles  rtest_bad_gzip_filezTestGzip.test_bad_gzip_files!
$-
&
&	#$JJurz"""	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#
]]4=#
.
.	@$d.???	@	@	@	@	@	@	@	@	@	@	@	@	@	@	@	@	@	@s#AAA+&BB"%B"ctdz}t}t|d5}||dddn#1swxYwY|}t|}t|d5}|||ddddS#1swxYwYdS)NrBrArrk)rDrrr5r6getvaluer7r9)runcompressedbufr=rs     rtest_non_seekable_filezTestGzip.test_non_seekable_files=rznn
]]3T]
2
2	"a
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"\\^^
:&&
]]3T]
2
2	5aQVVXX|444	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5s#AAA!)CCCc	tdz}t|jd5}||dddn#1swxYwYd}t|jd5}d|_d}|D]g}||}|dkrnI||t|||t|z
}h||dd||t|ddddS#1swxYwYdS)	NrrAc3:K	tdddD]}|V)NTrBr)r])ns rsizesz!TestGzip.test_peek.<locals>.sizess6
q"b))AGGGG
rrk!rrd)
rDrr5r(r6max_read_chunkpeekr7r9r8)rr
r=rrwrss       r	test_peekzTestGzip.test_peekss{
]]4=$
/
/	"1
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"			
]]4=$
/
/
	71!AEUWW
 
 FF1II88E  A333QQVVC[[#...UC$5$5666
	7
	7
	7
	7
	7
	7
	7
	7
	7
	7
	7
	7
	7
	7
	7
	7
	7
	7s$A

AA;CEEEctdzdd}|t|jd5}tj|d5}|	|
|dddn#1swxYwYddddS#1swxYwYdS)NrBasciiTrr3encoding)rDdecoderrKrr5r(r
TextIOWrapperr7r)rrr=ts    rtest_textio_readlineszTestGzip.test_textio_readliness7##G,,777FF
]]4=#
.
.	7!!!g666
7!  666
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7	7s6&C
=)B2&C
2B6	6C
9B6	:C

CCc.tj|jtjtjz}tj|d5}t|d5}	dddn#1swxYwYddddS#1swxYwYdS)NrAr2r)rHrr(O_WRONLYO_CREATfdopenrr5)rfdr=gs    rtest_fileobj_from_fdopenz!TestGzip.test_fileobj_from_fdopensWT]BK"*$<
=
=
Yr4
 
 	Aqs33
q














																		s6B
$A2&B
2A6	6B
9A6	:B

BBct|jdt	|jd5}t|d5}||jtjdddn#1swxYwYt|d5}||jtjdddn#1swxYwYt|d5}||jtjdddn#1swxYwYt|d5}||jtjdddn#1swxYwY|	t5t|ddddn#1swxYwYdddn#1swxYwYd	D]}t	|j|5}t|
5}||jtjdddn#1swxYwYdddn#1swxYwYdD]}d|vrtj|jt	|j|5}|
t5t|
}dddn#1swxYwY|5||jtjdddn#1swxYwYdddn#1swxYwYdS)NrAr+br3rr2rMrz)rkr+r)rArr)rr5r(rIrr7r;READWRITErlrrr'assertWarns
FutureWarning)rr=r(r;s    rtest_fileobj_modezTestGzip.test_fileobj_modes

dmT**00222
$-
'
'
	31qs33
4q  333
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4qs33
5q  444
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5qs33
5q  444
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5qs33
5q  444
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5"":..
3
3

ac
222
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
	3
	3
	3
	3
	3
	3
	3
	3
	3
	3
	3
	3
	3
	3
	3 	8	8DdmT**
8a]]1]--8$$QVTY777888888888888888
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8%	9	9Dd{{ ///dmT**
9a%%m4411

a
00A11111111111111199$$QVTZ888999999999999999
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9	9	9sVH%&BHB	HB	H>&C0$H0C4	4H7C4	8H&E	=H	E
	
HE
	H0&F"H"F&	&H)F&	*HG0$H0G4	4H7G4	8HHH+J&I9-J9I==JI=JJ	J	M+-L	M+LM+LM+"&MM+MM+MM++M/	2M/	c|j}	|d}n%#t$r|dYnwxYwt|d5}|tdzdddn#1swxYwYt|d5}||	tdzdddn#1swxYwYt|d5}||	tdzddddS#1swxYwYdS)Nrz%Temporary file name needs to be ASCIIrArBrk)
r(rrskipTestrr5r6rDr7r9)rstr_filenamebytes_filenamer=s    rtest_bytes_filenamezTestGzip.test_bytes_filenames}	C)0099NN!	C	C	CMMABBBBB	C
]]>4
0
0	 A
GGEBJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 
]]>4
0
0	3AQVVXXurz222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3]]<
.
.	3!QVVXXurz222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3sEAAB		B
B
/1C,,C03C01EEEctdtdzd}|t	|t
jtj|}t|}|	|
dddt
jz}||jj
|ddS)	z-Decompressed data buffering should be limitedrg>Arr}r-ryz)Excessive amount of data was decompressedN)rrint
assertLessr8rDEFAULT_BUFFER_SIZErr5r7r9assertLessEqual_bufferrawr)rbombdecomp
max_decomps    rtest_decompress_limitedz TestGzip.test_decompress_limited
s}}USXX-Q}??D		2#9:::z$t,,Q/////
V^/4466
7	9	9	9	9	9rcttfD]}dD]}tj|g|R}|t|tttj	|d5}||
|dddn#1swxYwYdS)Nr)ry)r)rrkr)rDrrrr7typer4r5rrr9)rr:rdatacr=s     r
test_compresszTestGzip.test_compresssEN	5	5D.
5
5
d2T222  ee444]]2:e+<+<4]HH5A$$QVVXXt444555555555555555
5	5	5s=)B22B69B6c	d}ttfD]}dD]}|||5tj|g|Rd|i}|t
|tttj
|d5}|d||j|dddn#1swxYwYdddn#1swxYwYdS)NrrD)r:rrrkrry)
rDrrrrr7rEr4r5rrr9r)rrr:rrFr=s      rtest_compress_mtimezTestGzip.test_compress_mtime syEN	9	9D.
9
9\\t$\7799 M$CCCCUCCE$$T%[[%888rz%/@/@tLL9PQq			((%888999999999999999999999999999999
9	9	9s6A,C.1C	C.C
C.C
C..C25C2c`dD]}||5ttd|}ttd|}|t||t|dddn#1swxYwYdS)N)r*rr)r~rry)rrrrDassertInassertNotIn)rr
nocompressyescompresss    rtest_compress_correct_levelz$TestGzip.test_compress_correct_level+s	5	5EE**
5
5!]]5]OO
"mmE%mPP

eZ000  444	
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5	5	5sA;B""B&	)B&	cttfD]}tj}t|d5}||dddn#1swxYwY|t|	|t
|}|t||dS)NrAr)rDrrrrr5r6r7
decompressrr)rr:rr=rFs     rtest_decompresszTestGzip.test_decompress4sEN	;	;D*,,Cs66
!

















T__S\\^^<<dCCCMM$''ET__U33T::::	;	;sA""A&	)A&	ctt}|ttj|dddS)NrrrDrlEOFErrorrRrcompressed_datas  r!test_decompress_truncated_trailerz*TestGzip.test_decompress_truncated_trailer><--..(DO_SbS5IJJJJJrctt}|ttj|dddS)NrVrXs  rtest_decompress_missing_trailerz(TestGzip.test_decompress_missing_trailerBr[rcbtdz}t|dd}tt	j|5}|t|jdddn#1swxYwYtt	j|5}|	|t|||t|jddddn#1swxYwYtddD]p}tt	j|d|5}|t|jddddn#1swxYwYqdS)NrBr]r-ryrr)rDrrr5rrrlrWr9r7r8r])rr:	truncatedr=rs     rtest_read_truncatedzTestGzip.test_read_truncatedFsRxMM$'',	
]]2:i#8#8]
9
9	0Qh///	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
]]2:i#8#8]
9
9	3QQVVCII..555h222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3q"	7	7Arz)BQB-'@'@AA
7Q!!(AFA666
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7	7	7s7!BBB?AD##D'*D'5"F##F'	*F'	cd}ttj|5}||dddddS#1swxYwYdS)NscQExtraI-.2Mxr-sTest)rr5rrr7r9)rgzdatar=s   rtest_read_with_extrazTestGzip.test_read_with_extraTs<]]2:f#5#5]
6
6	0!QVVXXw///	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0s)A&&A*-A*cbt|jd5}|tdddn#1swxYwYt|jd5}|jjjddddS#1swxYwYdS)NrArk)	rrr(r6rDr=r>_fpprependrJs  rtest_prepend_errorzTestGzip.test_prepend_error\s	
YYt}d
+
+	q
GGENNN															
YYt}d
+
+	(q
IM%%'''	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(s#AAA3$B$$B(+B(ctjdgd}t||jz}ttjd5}||||||	|ddddS#1swxYwYdS)NQ)ryrrZrr2r)
rgr8itemsizerr5rrr7r6r)rqLENGTHr=s    rtest_issue44439zTestGzip.test_issue44439csK___--Q!*$
]]2:<<c]
:
:	/aQWWQZZ000QVVXXv...	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/sAB;;B?B?N)r0)5r r!r"r?rKrUr`rcrhrnrqrxrrrrrrrrrrrrrrrrrrrrrrrr
rrr"r)r2r7rBrGrIrPrSrZr^rardrhrorrrr/r/9s////
+
+
+'''888???...&&&
7
7
7ZS###..$#.8555---&///	F	F	F
5
5
5
"
"
"&***!!!555888<<<	1	1	11H1H1Hf???(777*
F
F
F???@@@555777,7779994333
9
9
9555	9	9	9555;;;KKKKKK777000(((/////rr/cDeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
S)TestOpenc tdz}t|jd5}||dddn#1swxYwYt|jd5}t|}|||dddn#1swxYwYt|jd5}|||dddn#1swxYwYt|jd5}||dddn#1swxYwYt|jd5}t|}|||dzdddn#1swxYwY|t5t|jddddn#1swxYwYtj|jt|jd5}||dddn#1swxYwYt|jd5}t|}|||ddddS#1swxYwYdS)NrBrArkrrrrDrrr(r6rRr9r7rlrrr'rr
r=	file_datas    rtest_binary_modeszTestOpen.test_binary_modesmsdrz
YYt}d
+
+	"q
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
$-
&
&	6!11IY555	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6YYt}d
+
+	5qQVVXX|444	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5YYt}d
+
+	"q
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
$-
&
&	:!11IYq(8999	:	:	:	:	:	:	:	:	:	:	:	:	:	:	:


/
/	+	+IIdmT***	+	+	+	+	+	+	+	+	+	+	+	+	+	+	+'''
YYt}d
+
+	"q
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
$-
&
&	6!11IY555	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6A

AA-AB<<CC')DD #D E))E-0E-	AGG"G!H--H14H11JJJ3ALL
Lc8tj|j}t|d5}|tdzdddn#1swxYwYt|d5}|tdddn#1swxYwYt|5}||tdzddddS#1swxYwYdS)NrArBrrN)	rOrPr(rrr6rDr7r9)rr(r=s   rtest_pathlike_filezTestOpen.test_pathlike_files<
..
YYx
&
&	 !
GGEBJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 
YYx
&
&	!
GGENNN															
YYx
 
 	3AQVVXXurz222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3s5AA#&A#B,,B03B01DDDc tdz}t|jd5}||dddn#1swxYwYt|jd5}t|}|||dddn#1swxYwYt|jd5}|||dddn#1swxYwYt|jd5}||dddn#1swxYwYt|jd5}t|}|||dzdddn#1swxYwY|t5t|jddddn#1swxYwYtj|jt|jd5}||dddn#1swxYwYt|jd5}t|}|||ddddS#1swxYwYdS)NrBr2rkr3rMrrrsrts    rtest_implicit_binary_modesz#TestOpen.test_implicit_binary_modessdrz
YYt}c
*
*	"a
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
$-
&
&	6!11IY555	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6YYt}c
*
*	5aQVVXX|444	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5YYt}c
*
*	"a
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
$-
&
&	:!11IYq(8999	:	:	:	:	:	:	:	:	:	:	:	:	:	:	:


/
/	*	*IIdmS)))	*	*	*	*	*	*	*	*	*	*	*	*	*	*	*'''
YYt}c
*
*	"a
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
$-
&
&	6!11IY555	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6	6rwctddz}|dtj}t
|jdd5}||dddn#1swxYwYt
|jd5}t
	|
d}|||dddn#1swxYwYt
|jdd5}||
|dddn#1swxYwYt
|jdd5}||dddn#1swxYwYt
|jd5}t
	|
d}|||d	zddddS#1swxYwYdS)
NrrB
wtrrkrtatrrDrreplacerHlineseprrr(r6rRr9r7rr
uncompressed_rawr=rus     rtest_text_modeszTestOpen.test_text_modess||G,,r1'//bjAA
YYt}dWY
=
=	"
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
$-
&
&	:!1188AAIY(8999	:	:	:	:	:	:	:	:	:	:	:	:	:	:	:YYt}dWY
=
=	5QVVXX|444	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5
YYt}dWY
=
=	"
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
$-
&
&	>!1188AAIY(81(<===	>	>	>	>	>	>	>	>	>	>	>	>	>	>	>	>	>	>s\ BB	B"ADDD1)E&&E*-E*F55F9<F9AH;;H?H?ctdz}|d}t|}ttj|d5}|||dddn#1swxYwYttj|d5}|||dddn#1swxYwYttj|dd5}|||ddddS#1swxYwYdS)NrBrr3rkrr)	rDrrrrrrr7r9)runcompressed_bytesuncompressed_strrr=s     rtest_fileobjzTestOpen.test_fileobjs"RZ-44W==]]#566

YYrz*--s
3
3	;qQVVXX'9:::	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;
YYrz*--t
4
4	;QVVXX'9:::	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;
YYrz*--tgY
F
F	9!QVVXX'7888	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9s6')BB #B )D		D
D
)E99E=E=c|t5tddddn#1swxYwY|t5t|jddddn#1swxYwY|t5t|jddddn#1swxYwY|t5t|jdddddn#1swxYwY|t5t|jdddddn#1swxYwY|t5t|jdd	
ddddS#1swxYwYdS)Ngw/^@wbtxbtrkzutf-8rignore)errorsr})newline)rlrmrrrr(rs rtest_bad_paramszTestOpen.test_bad_paramss


y
)
)		IIg															


z
*
*	,	,IIdmU+++	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,


z
*
*	,	,IIdmU+++	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,


z
*
*	=	=IIdmTGI<<<	=	=	=	=	=	=	=	=	=	=	=	=	=	=	=


z
*
*	<	<IIdmT(I;;;	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<


z
*
*	9	9IIdmT4I888	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9skAA	A'!BBB9!C&&C*-C*#D::D>D>#FFF3#G##G'*G'ctddz}|dtj}t
|jdd5}||dddn#1swxYwYt
|jd5}t
	|
d}|||dddn#1swxYwYt
|jdd5}||
|ddddS#1swxYwYdS)	NrrBr}r~zutf-16rrkrrrs     r
test_encodingzTestOpen.test_encodings||G,,r1'//bjAA
YYt}dXY
>
>	"!
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
$-
&
&	:!1188BBIY(8999	:	:	:	:	:	:	:	:	:	:	:	:	:	:	:YYt}dXY
>
>	5!QVVXX|444	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5s7 BB	B"ADDD1)E''E+.E+cht|jd5}|ddddn#1swxYwYt|jddd5}||dddddS#1swxYwYdS)NrAsfoobarrrr)rrfoobar)rrr(r6r7r9rJs  rtest_encoding_error_handlerz$TestOpen.test_encoding_error_handlers
YYt}d
+
+	#q
GGM"""	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#
YYt}dWXY
N
N	1QVVXXx000	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1s#AA
A1)B''B+.B+ctddz}t|jddd5}||dddn#1swxYwYt|jddd5}|||gddddS#1swxYwYdS)NrrBr~r})rrr
)rDrrrr(r6r7r)rr
r=s   rtest_newlinezTestOpen.test_newlines5||G,,r1
YYt}dWdY
K
K	"q
GGL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"
YYt}dWdY
K
K	<qQ[[]]\N;;;	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<s$A##A'*A'*CCCN)r r!r"rvryr{rrrrrrrrrrqrqls66663336668>>> 	9	9	9
9
9
9
5
5
5111<<<<<rrqcfd}|S)NcJtjfd}|S)Nctj	|i|tjS#tjwxYwr)rHmakedirsrrmtree)rkwargs	directoryfunctions  rwrapperz?create_and_remove_directory.<locals>.decorator.<locals>.wrappersUK	"""
,x000 ++++	 ++++s	3A	)	functoolswraps)rrrs` r	decoratorz.create_and_remove_directory.<locals>.decorators>		"	"	,	,	,	,	,
#	"	,rr)rrs` rcreate_and_remove_directoryrs$rc
eZdZdZedZeedZdZ	eeedZ
eedZeedZdZ
d	Zd
S)TestCommandLinesThis is a simple test with gzipcBtj5}t|d5}||jdddn#1swxYwYtjdddf}t|ttt5}|
|\}}dddn#1swxYwYdddn#1swxYwY||d|||jdS)NrAr-mr-dstdinstdoutstderrr)
rrrr5r6r:sys
executablerrcommunicaterr7)rbytes_io	gzip_filerprocouterrs       rtest_decompress_stdin_stdoutz,TestCommandLine.test_decompress_stdin_stdouts
Z\\	AXxd;;
+y	***
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+>45Dt4TBBB
Ad++H,=,=,?,?@@S
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A	A	A	A	A	A	A	A	A	A	A	A	A	A	A	A	
c"""di(((((sXC#AC#A	C#A	 5C#+CC#C	C#C	C##C'*C'cTtjtd}|tj|t|d5}||j	dddn#1swxYwYtddd|\}}}ttjtdd5}|||j	dddn#1swxYwY|
tj|||d	||d
||d
dS)Nztestgzip.gzrA)r;rrrtestgziprkrr)rHpathruTEMPDIRrexistsrrr6r:r
r7r9r)rgzipnamefprcrrgunzipeds       rtest_decompress_infile_outfilez.TestCommandLine.test_decompress_infile_outfiles7<<7711222
YYxdY
+
+	 rHHTY	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 'fdHEEC
"',,w
33T
:
:	9hX]]__di888	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	
x00111Qc"""c"""""s$4BB"B/.D))D-0D-ctdddd\}}}|d|||d||ddS)Nrrrzthisisatest.outs.filename doesn't end in .gz: 'thisisatest.out'ryr)rr7striprrrrs    r$test_decompress_infile_outfile_errorz4TestCommandLine.test_decompress_infile_outfile_error"sm,T64ARSSCJCIIKKXXXQc"""""rc:tjddf}t|ttt5}||j\}}dddn#1swxYwY||d||ddddS)Nrrrrrr)rrrrrr:r7)rrrrrs     rtest_compress_stdin_outfilez+TestCommandLine.test_compress_stdin_outfile(s~tV+
4tD
>
>
>	3$''	22HC	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	
c"""RaR+.....sAA #A c(tjtd}|dz}|tj|t
|d5}||jdddn#1swxYwYtdd|\}}}|
tj|||d||ddS)Nr.gzrArrr)rHrrurrrrr6r:r
rr7)rlocal_testgziprrrrrs       r$test_compress_infile_outfile_defaultz4TestCommandLine.test_compress_infile_outfile_default2s$gz::!E)11222
.$
'
'	 2HHTY	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 (fnEECx00111c"""c"""""s-BBBc dD]}||5tjtd}|dz}|tj|t|d5}||j	dddn#1swxYwYtdd||\}}}|tj|||d||dtj
||tj|dddn#1swxYwYdS)	N)--fast--best)compress_levelrrrArrr)rrHrrurrrrr6r:r
rr7remove)rrrrrrrrs        rtest_compress_infile_outfilez,TestCommandLine.test_compress_infile_outfileAs2	;	;N^<<
;
;!#gz!B!B)E1  !9!9:::.$//(2HHTY'''((((((((((((((( 0fnn]]Cx 8 8999  c***  c***	(###  !9!9:::
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;	;	;s7A-F	B0$F0B44F7B48B=FF	F	ctdddd\}}}|d|||ddS)Nrrrrs8error: argument --best: not allowed with argument --fastrrrLr7rs    r%test_compress_fast_best_are_exclusivez5TestCommandLine.test_compress_fast_best_are_exclusiveTsM,T68XNNC

QSVWWWc"""""rctdddd\}}}|d|||ddS)NrrrrsAerror: argument -d/--decompress: not allowed with argument --fastrrrs    r-test_decompress_cannot_have_flags_compressionz=TestCommandLine.test_decompress_cannot_have_flags_compressionYsM,T68TJJC

Z\_```c"""""rN)r r!r"r:r	rrrrrrrrrrrrrrrs-D
)
)
)! ))##*)# ###  ))//*)/! ))##*)#! ));;*);$###
#####rr__main__)'__doc__rgrrrHrOrrunittest
subprocessrrtest.supportrrrrr	test.support.script_helperr
r
import_modulerrDrrabspathr-rrrTestCaser$r/rqrrr mainrrr<module>rs5
								







""""""""&&&&&&""""""==========NNNNNNNN"}"6**		
'//)*
+
+h
6&&&&&2:&&&(((((x (((p/p/p/p/p/xp/p/p/fE<E<E<E<E<xE<E<E<P


[#[#[#[#[#h'[#[#[#|zHMOOOOOr