
    dafr                    
   d dl Z d dlZd dlmZmZmZ d dlZd dlZd dlZd dl	Z	d dl
mZ d dlZd dlmZmZ d dlmZ d dlmZmZmZ  ed      Zd dlmZmZmZmZ  G d	 d
ej6                        Z G d dej6                        Z G d d      Z G d dej6                        Z G d dej6                        Z  G d dej6                        Z!dZ"dZ#dZ$dZ%ejL                  ddgZ'dZ(ejR                  ddejL                  ejT                  ejV                  z  dgZ,dZ-ej\                  dd d!ejL                  igZ/d"Z0ejR                  d#dejb                  d$d ejL                  d#dd%gZ2d&Z3d'Z4e5d(k(  r ejl                          yy))    N)BytesIOUnsupportedOperationDEFAULT_BUFFER_SIZE)support)_4G
bigmemtest)import_module)TESTFNunlinkFakePathlzma)LZMACompressorLZMADecompressor	LZMAErrorLZMAFilec                   n   e Zd Zd Zd Zd Zd Zd'dZd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zej@                   e!e"dz   d      d                Z#ej@                   e!e"dz   d!      d"               Z$d# Z%ejL                  d$        Z'd% Z(y&)(CompressorDecompressorTestCasec                 f   | j                  t        t        g        | j                  t        t        d       | j                  t        t        d       | j                  t        t        d       | j                  t        t        d       | j                  t        t        t        j
                         | j                  t              5  t        d	d
t        j                  ig       d d d        | j                  t        t        d       | j                  t        t        d       | j                  t              5  t        t        j                  d       d d d        | j                  t              5  t        t        j                  d       d d d        | j                  t        t        t               | j                  t              5  t        t        j                  t               d d d        | j                  t              5  t        t        j                  t               d d d        t               }| j                  t        |j                         | j                  t        |j                  dd       | j                  t        |j                  d       |j                         }| j                  t        |j                  d       | j                  t        |j                         t               }| j                  t        |j                         | j                  t        |j                  dd       |j                  |       | j                  t        |j                  d       y # 1 sw Y   xY w# 1 sw Y   'xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   {xY w)Ng@format checkasdfpreset   filters   idr   r    s   qwmemlimitzzz   r   r      foo   bars   blahs   quux)assertRaises	TypeErrorr   
ValueErrorr   FORMAT_AUTOFILTER_LZMA2r   
FORMAT_RAWFILTERS_RAW_1	FORMAT_XZFORMAT_ALONEcompressflush
decompressEOFError)selflzcemptylzds       )/root/Python-3.12.4/Lib/test/test_lzma.pytest_simple_bad_argsz3CompressorDecompressorTestCase.test_simple_bad_args   s   )^R8)^DA)^2>)^FC)^Q?*nT=M=MNz* 	J!tT5F5F.G-HI	J 	)%5r:)%5Fy) 	=T__e<	= z* 	BT__yA	B 	*&6Nz* 	KDNNMJ	Kz* 	ND$5$5}M	N )S\\2)S\\66B)SYY8		*cllG<*cii0 )S^^4)S^^VVDu(CNNG<;	J 	J
	= 	=	B 	B	K 	K	N 	Ns<   M2>M?7N N N&2M<?N	NN#&N0c                 j   | j                  t        t        dg       | j                  t        t        ddig       | j                  t        t        ddig       | j                  t              5  t        t        j
                  ddg       d d d        | j                  t              5  t        t        j                  ddg       d d d        | j                  t              5  t        t        j                  ddg       d d d        y # 1 sw Y   xY w# 1 sw Y   RxY w# 1 sw Y   y xY w)	N   wobsiter   xyzzyr   r!   ́ r   r!   foo)r+   r,   r   r-   r   r/   FILTER_DELTA
FILTER_X86r8   s    r<   test_bad_filter_specz3CompressorDecompressorTestCase.test_bad_filter_specA   s
   )^j\J*n|nM*ne}oNz* 	J4+<+<Q$G#HI	Jz* 	J4+<+<Q$G#HI	Jz* 	H4??1$E#FG	H 	H		J 	J	J 	J	H 	Hs$   1D-D)D)DD&)D2c                     t               }|j                  t               | j                  t        |j                  d       y )Ns   nyan)r   r6   COMPRESSED_XZr+   r7   r8   r;   s     r<   test_decompressor_after_eofz:CompressorDecompressorTestCase.test_decompressor_after_eofL   s,     }%(CNNG<    c                 f   t        d      }| j                  t        |j                  t               t        t
        j                  d      }| j                  t        |j                  t               t        t
        j                  d      }| j                  t        |j                  t               y )N   r$   )	r   r+   r   r6   rI   r   r2   r3   COMPRESSED_ALONErJ   s     r<   test_decompressor_memlimitz9CompressorDecompressorTestCase.test_decompressor_memlimitQ   sq    -)S^^]Ct~~=)S^^]Ct004@)S^^5EFrL   c                 .   | j                  |j                         |j                  |      }| j                  |t               | j                  |j
                  |       | j                  |j                         | j                  |j                  |       y N)assertFalseeofr6   assertEqualINPUTr   
assertTrueunused_data)r8   r;   datar   rX   outs         r<   _test_decompressorz1CompressorDecompressorTestCase._test_decompressor]   sj    !nnT"e$E* +6rL   c                     t               }| j                  |t        t        j                         t               }| j                  |t
        t        j                         y rR   )r   r[   rI   r   CHECK_CRC64rO   
CHECK_NONErJ   s     r<   test_decompressor_autoz5CompressorDecompressorTestCase.test_decompressor_autoe   sA     ]D4D4DE %5tGrL   c                     t        t        j                        }| j                  |t        t        j
                         y rR   )r   r   r2   r[   rI   r]   rJ   s     r<   test_decompressor_xzz3CompressorDecompressorTestCase.test_decompressor_xzl   s(    t~~.]D4D4DErL   c                     t        t        j                        }| j                  |t        t        j
                         y rR   )r   r   r3   r[   rO   r^   rJ   s     r<   test_decompressor_alonez6CompressorDecompressorTestCase.test_decompressor_alonep   s)    t001%5tGrL   c                     t        t        j                  t              }| j	                  |t
        t        j                         y Nr   )r   r   r0   r1   r[   COMPRESSED_RAW_1r^   rJ   s     r<   test_decompressor_raw_1z6CompressorDecompressorTestCase.test_decompressor_raw_1t   )    tF%5tGrL   c                     t        t        j                  t              }| j	                  |t
        t        j                         y re   )r   r   r0   FILTERS_RAW_2r[   COMPRESSED_RAW_2r^   rJ   s     r<   test_decompressor_raw_2z6CompressorDecompressorTestCase.test_decompressor_raw_2x   rh   rL   c                     t        t        j                  t              }| j	                  |t
        t        j                         y re   )r   r   r0   FILTERS_RAW_3r[   COMPRESSED_RAW_3r^   rJ   s     r<   test_decompressor_raw_3z6CompressorDecompressorTestCase.test_decompressor_raw_3|   rh   rL   c                     t        t        j                  t              }| j	                  |t
        t        j                         y re   )r   r   r0   FILTERS_RAW_4r[   COMPRESSED_RAW_4r^   rJ   s     r<   test_decompressor_raw_4z6CompressorDecompressorTestCase.test_decompressor_raw_4   rh   rL   c           	         t               }g }t        dt        t              d      D ]G  }| j	                  |j
                         |j                  |j                  t        ||dz                 I dj                  |      }| j                  |t               | j                  |j                  t        j                         | j                  |j
                         | j                  |j                  d       y Nr   
   rL   r   rangelenrI   rS   rT   appendr6   joinrU   rV   r   r   r]   rW   rX   r8   r;   rZ   is       r<   test_decompressor_chunksz7CompressorDecompressorTestCase.test_decompressor_chunks   s     q#m,b1 	>ASWW%JJs~~mAad&;<=	> hhsme$D$4$45 #.rL   c           	         t               }g }t        dt        t              d      D ]  }| j	                  |j
                         |j                  |j                  d             |j                  |j                  d             |j                  |j                  d             |j                  |j                  t        ||dz                  dj                  |      }| j                  |t               | j                  |j                  t        j                         | j                  |j
                         | j                  |j                  d       y rv   rx   r}   s       r<   test_decompressor_chunks_emptyz=CompressorDecompressorTestCase.test_decompressor_chunks_empty   s     q#m,b1 	>ASWW%JJs~~c*+JJs~~c*+JJs~~c*+JJs~~mAad&;<=	> hhsme$D$4$45 #.rL   c                    t               }d}g }t        t              dz  }|j                  |j	                  t        d | |             | j                  |j                         | j                  t        |d         |       |j                  |j	                  d|             | j                  |j                         | j                  t        |d         |       |j                  |j	                  t        |d  |             | j                  t        |d         |       |j                  sM|j                  |j	                  d|             | j                  t        |d         |       |j                  sMdj                  |      }| j                  |t               | j                  |j                  t        j                         | j                  |j                  d       y )Nd      
max_lengthrL   )r   rz   rI   r{   r6   rS   needs_inputrU   assertLessEqualrT   r|   rV   r   r   r]   rX   )r8   r;   r   rZ   len_s        r<    test_decompressor_chunks_maxsizez?CompressorDecompressorTestCase.test_decompressor_chunks_maxsize   s    
 =!Q&

3>>-"6-7 " 9 	:)SWz2 	

3>>#*>=>)SWz2 	

3>>-"6-7 " 9 	:SR\:6 ''JJs~~cj~AB  SWz: '' hhsme$D$4$45#.rL   c                    t               }g }| j                  |j                  t        d d d      d       |j	                  |j                  dd             |j	                  |j                  t        dd d             |j	                  |j                  t        dd               | j                  dj                  |      t               y )Nr   r   r   rL   r   i      r   rU   r6   rI   r{   r|   rV   r8   r;   rZ   s      r<   test_decompressor_inputbuf_1z;CompressorDecompressorTestCase.test_decompressor_inputbuf_1   s       	ds(;34 ( 67:	<
 	

3>>#q)* 	

3>>-C"8"=> 	

3>>-"567#.rL   c                    t               }g }| j                  |j                  t        d d d      d       |j	                  |j                  d             |j	                  |j                  t        dd d             |j	                  |j                  t        dd d             |j	                  |j                  t        dd               | j                  dj                  |      t               y )N   r   r   rL   i  r   ,  r   r   s      r<   test_decompressor_inputbuf_2z;CompressorDecompressorTestCase.test_decompressor_inputbuf_2   s       	ds(;34 ( 67:	<

3>>#&' 	

3>>-C"8!<= 	

3>>-C"8!<= 	

3>>-"567#.rL   c                 T   t               }g }|j                  |j                  t        d d d             |j                  |j                  t        dd d             |j                  |j                  t        dd               | j	                  dj                  |      t               y )Nr      r   rL   )r   r{   r6   rI   rU   r|   rV   r   s      r<   test_decompressor_inputbuf_3z;CompressorDecompressorTestCase.test_decompressor_inputbuf_3   s       	

3>>-"5q9: 	

3>>-C"8!<= 	

3>>-"567#.rL   c                 p    t               }d}| j                  |t        |z   t        j                  |       y )Ns	   fooblibarrX   )r   r[   rI   r   r]   )r8   r;   extras      r<   test_decompressor_unused_dataz<CompressorDecompressorTestCase.test_decompressor_unused_data   s6     ]U%:D<L<L,1 	  	3rL   c                    t               }| j                  t        |j                  t               t        t
        j                        }| j                  t        |j                  t               t        t
        j                        }| j                  t        |j                  t               t        t
        j                  t              }| j                  t        |j                  t               y re   )r   r+   r   r6   rf   r   r2   rO   r3   rI   r0   r1   rJ   s     r<   test_decompressor_bad_inputz:CompressorDecompressorTestCase.test_decompressor_bad_input   s     )S^^5EFt~~.)S^^5EFt001)S^^]CtF)S^^]CrL   c                     t               }| j                  t        |j                  t               | j                  t        |j                  t               y rR   )r   r+   r   r6   rf   rJ   s     r<   test_decompressor_bug_28275z:CompressorDecompressorTestCase.test_decompressor_bug_28275  s8     )S^^5EF)S^^5EFrL   c                     t               }|j                  t              |j                         z   }t	               }| j                  ||t        j                         y rR   )r   r4   rV   r5   r   r[   r   r]   r8   r9   cdatar;   s       r<   test_roundtrip_xzz0CompressorDecompressorTestCase.test_roundtrip_xz  sC    U#ciik1 UD,<,<=rL   c                     t        t        j                        }|j                  t              |j                         z   }t               }| j                  ||t        j                         y rR   )	r   r   r3   r4   rV   r5   r   r[   r^   r   s       r<   test_roundtrip_alonez3CompressorDecompressorTestCase.test_roundtrip_alone  sI    T../U#ciik1 UDOO<rL   c                    t        t        j                  t              }|j	                  t
              |j                         z   }t        t        j                  t              }| j                  ||t        j                         y re   
r   r   r0   rr   r4   rV   r5   r   r[   r^   r   s       r<   test_roundtrip_rawz1CompressorDecompressorTestCase.test_roundtrip_raw"  sQ    T__mDU#ciik1tFUDOO<rL   c                    t        t        j                  t              }|j	                  t
              }||j	                  d      z  }||j	                  d      z  }||j	                  d      z  }||j                         z  }t        t        j                  t              }| j                  ||t        j                         y )Nr   rL   r   r   s       r<   test_roundtrip_raw_emptyz7CompressorDecompressorTestCase.test_roundtrip_raw_empty(  s    T__mDU#c""c""c""tFUDOO<rL   c           	      d   t               }g }t        dt        t              d      D ],  }|j	                  |j                  t        ||dz                 . |j	                  |j                                dj                  |      }t               }| j                  ||t        j                         y rv   r   ry   rz   rV   r{   r4   r5   r|   r   r[   r   r]   r8   r9   r   r~   r;   s        r<   test_roundtrip_chunksz4CompressorDecompressorTestCase.test_roundtrip_chunks2  s    q#e*b) 	6ALLeAadm45	6SYY[! UD,<,<=rL   c           	      $   t               }g }t        dt        t              d      D ]  }|j	                  |j                  t        ||dz                 |j	                  |j                  d             |j	                  |j                  d             |j	                  |j                  d              |j	                  |j                                dj                  |      }t               }| j                  ||t        j                         y rv   r   r   s        r<   test_roundtrip_empty_chunksz:CompressorDecompressorTestCase.test_roundtrip_empty_chunks<  s    q#e*b) 	,ALLeAadm45LLc*+LLc*+LLc*+		,
 	SYY[! UD,<,<=rL   c                 |    t               }| j                  |t        t        z   t        j
                  t               y )Nr   )r   r[   rI   rO   r   r]   rJ   s     r<   test_decompressor_multistreamz<CompressorDecompressorTestCase.test_decompressor_multistreamK  s4     ]5E%E $ 0 0>N 	  	PrL   r   r   )sizememusec                 *   t               }|j                  d|z        |j                         z   }t        j	                  |      }	 | j                  t        |      |       | j                  t        |j                  d            d       d }y # d }w xY w)N   xr   )r   r4   r5   r   r6   rU   rz   strip)r8   r   r9   r   ddatas        r<   test_compressor_bigmemz5CompressorDecompressorTestCase.test_compressor_bigmemR  sy     TD[)CIIK7&	SZ.ST!23Q7EDEs   AB Br   c                 
   t               }t        d|      }t        j                  |      }	 ||dz
  |z  dz   z  }t        j                  |      }|j                  |      }| j                  ||       d x}x}}y # d x}x}}w xY w)Ni      )r   minrandom	randbytesr   r4   r6   rU   )r8   r   r;   	blocksizeblockinputr   r   s           r<   test_decompressor_bigmemz7CompressorDecompressorTestCase.test_decompressor_bigmem^  s      ($/	  +	)d1f2Q67EMM%(ENN5)EUE*$((E(EED(E(EEs   AA: :Bc                 f   t        t        j                  dz         D ]z  }| j                  t              5  t        j
                  t               |       d d d        | j                  t              5  t        j
                  t               |       d d d        | y # 1 sw Y   HxY w# 1 sw Y   xY wNr   )ry   pickleHIGHEST_PROTOCOLr+   r,   dumpsr   r   )r8   protos     r<   test_picklez*CompressorDecompressorTestCase.test_picklen  s    622Q67 	8E""9- 6^-u56""9- 8-/78 8	86 68 8s   B1B'B$	'B0	c                     t        j                  t        d      }t               } |       }t	        d      D ]  }|j                           | j                   |       |z
  dd       y )Ngettotalrefcountr   r   rw   )delta)r   get_attributesysr   ry   __init__assertAlmostEqual)r8   r   r;   refs_beforer~   s        r<   &test_refleaks_in_decompressor___init__zECompressorDecompressorTestCase.test_refleaks_in_decompressor___init__u  s`    "006HI &(s 	ALLN	/1K?"MrL   c                     | j                  t        j                  t              j                  t	                     d       y NrL   )rU   r   __new__r6   bytesrF   s    r<   )test_uninitialized_LZMADecompressor_crashzHCompressorDecompressorTestCase.test_uninitialized_LZMADecompressor_crash~  s-    )112BC#EG,c	3rL   NrL   ))__name__
__module____qualname__r=   rG   rK   rP   r[   r_   ra   rc   rg   rl   rp   rt   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   skip_if_pgo_taskr   r   r   r   r   refcount_testr   r   r#   rL   r<   r   r      s   &=P	H=
G7HFHHHHH
///@/,/*/ 3DG>===>>P S3Yq) *  S3Yq)
) * 
)8 N N3rL   r   c                   B    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)"CompressDecompressFunctionTestCasec                    | j                  t        t        j                         | j                  t        t        j                  g        | j                  t        t        j                  dd       | j                  t        t        j                  dd       | j                  t        t        j                  dd       | j                  t        t        j                  dd	       | j                  t              5  t        j                  dd
dt        j
                  ig       d d d        | j                  t        t        j                         | j                  t        t        j                  g        | j                  t        t        j                  dd       | j                  t        t        j                  dd       | j                  t              5  t        j                  dt        j                  i        d d d        | j                  t              5  t        j                  dt        j                  d       d d d        | j                  t              5  t        j                  dt        	       d d d        | j                  t              5  t        j                  dt        j                  t               d d d        | j                  t              5  t        j                  dt        j                  t               d d d        y # 1 sw Y   xY w# 1 sw Y   %xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)NrL   xzr   noner   blahr   rN   r   r   r!   r"   r   g   1Ar$   r(   r'   r   r%   )r+   r,   r   r4   r-   r/   r6   r0   r1   r2   r3   rF   s    r<   test_bad_argsz0CompressDecompressFunctionTestCase.test_bad_args  s{   )T]]3)T]]B7)T]]CE)T]]CvF)T]]CG)T]]CFz* 	NMM#a49J9J2K1LMM	N 	)T__5)T__b9)T__c&I)T__cEJy) 	EOOCOD	E z* 	MOOC)OL	M z* 	8OOCO7	8z* 	OOOCON	Oz* 	JOO 1 1=  J	J 	J#	N 	N	E 	E	M 	M	8 	8	O 	O	J 	JsH   ;*L'L#'L0!L<+M"+ML #L-0L9<MMMc                    | j                  t              5  t        j                  t        d       d d d        | j                  t              5  t        j                  t        t        j
                  d       d d d        | j                  t              5  t        j                  t        t        j                  d       d d d        y # 1 sw Y   xY w# 1 sw Y   ^xY w# 1 sw Y   y xY w)NrN   r$   r   )r+   r   r   r6   rI   r2   rO   r3   rF   s    r<   test_decompress_memlimitz;CompressDecompressFunctionTestCase.test_decompress_memlimit  s    y) 	:OOMDO9	:y) 	IOO!$..4  I	I y) 	OOO$T->->  O	O 	O	: 	:	I 	I	O 	Os#   C+C+C#CC #C,c                    t         j                  t              }| j                  |t               t         j                  t
              }| j                  |t               t         j                  t        t         j                        }| j                  |t               t         j                  t
        t         j                        }| j                  |t               t         j                  t        t         j                  t              }| j                  |t               t         j                  t        t         j                  t              }| j                  |t               t         j                  t        t         j                  t              }| j                  |t               t         j                  t        t         j                  t               }| j                  |t               y re   )r   r6   rI   rU   rV   rO   r2   r3   rf   r0   r1   rk   rj   ro   rn   rs   rr   r8   r   s     r<   test_decompress_good_inputz=CompressDecompressFunctionTestCase.test_decompress_good_input  sF   .& 01&t~~>& 0$2C2CD& $//=   J& $//=   J& $//=   J& $//=   J&rL   c                    | j                  t        t        j                  t        d d        | j                  t        t        j                  t
        d d        | j                  t        t        j                  t        d d t        j                  t               | j                  t        t        j                  t        d d t        j                  t               | j                  t        t        j                  t        d d t        j                  t               | j                  t        t        j                  t        d d t        j                  t               y )N   r(   )r+   r   r   r6   rI   rO   rf   r0   r1   rk   rj   ro   rn   rs   rr   rF   s    r<    test_decompress_incomplete_inputzCCompressDecompressFunctionTestCase.test_decompress_incomplete_input  s    )T__mDS6IJ)T__6Ft6LM)T__6Ft6L!%- 	 	I)T__6Ft6L!%- 	 	I)T__6Ft6L!%- 	 	I)T__6Ft6L!%- 	 	IrL   c                    | j                  t              5  t        j                  t               d d d        | j                  t              5  t        j                  t
               d d d        | j                  t              5  t        j                  t        t        j                         d d d        | j                  t              5  t        j                  t        t        j                         d d d        | j                  t              5  t        j                  t        t        j                  t               d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   {xY w# 1 sw Y   y xY wNr   r(   )r+   r   r   r6   COMPRESSED_BOGUSrf   rO   r2   rI   r3   r0   r1   rF   s    r<   test_decompress_bad_inputz<CompressDecompressFunctionTestCase.test_decompress_bad_input  s   y) 	.OO,-	.y) 	.OO,-	.y) 	EOO,T^^OD	Ey) 	EOOM$2C2COD	Ey) 	3OOM$//$1  3	3 	3	. 	.	. 	.	E 	E	E 	E	3 	3s;   E
E*E#*E//E;
EE #E,/E8;Fc                    t         j                  t              }t         j                  |      }| j	                  |t               t         j                  t        t         j
                        }t         j                  |      }| j	                  |t               t         j                  t        t         j                        }t         j                  |      }| j	                  |t               t         j                  t        t         j                  t              }t         j                  |t         j                  t              }| j	                  |t               y re   )	r   r4   rV   r6   rU   r2   r3   r0   rr   )r8   r   r   s      r<   test_roundtripz1CompressDecompressFunctionTestCase.test_roundtrip  s    e$&&eT^^4&&eT%6%67&&eT__mLtN&rL   c                 v    t         j                  t        t        z         }| j	                  |t
        dz         y )Nr   )r   r6   rI   rO   rU   rV   r   s     r<   test_decompress_multistreamz>CompressDecompressFunctionTestCase.test_decompress_multistream  s*    0@ @A	*rL   c                 p    t         j                  t        t        z         }| j	                  |t
               y rR   r   r6   rI   r   rU   rV   r   s     r<   test_decompress_trailing_junkz@CompressDecompressFunctionTestCase.test_decompress_trailing_junk  s&    0@ @A&rL   c                 |    t         j                  t        dz  t        z         }| j	                  |t
        dz         y )Nr   r   r   s     r<   )test_decompress_multistream_trailing_junkzLCompressDecompressFunctionTestCase.test_decompress_multistream_trailing_junk  s/     14D DE	*rL   N)r   r   r   r   r   r   r   r   r   r   r   r   r#   rL   r<   r   r     s2    J:O':
I3'&+'+rL   r   c                   $    e Zd ZdZddZd Zd Zy)TempFilez=Context manager - creates a file, and deletes it on __exit__.c                      || _         || _        y rR   )filenamerY   )r8   r   rY   s      r<   r   zTempFile.__init__  s     	rL   c                     t        | j                  d      5 }|j                  | j                         d d d        y # 1 sw Y   y xY w)Nwb)openr   writerY   r8   fs     r<   	__enter__zTempFile.__enter__  s7    $--& 	!GGDII	 	 	s	   <Ac                 .    t        | j                         y rR   )r   r   )r8   argss     r<   __exit__zTempFile.__exit__  s    t}}rL   Nr   )r   r   r   __doc__r   r  r	  r#   rL   r<   r   r   
  s    GrL   r   c                      e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd 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- Z/d. Z0d/ Z1d0 Z2d1 Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z;d: Z<d; Z=d< Z>d= Z?d> Z@d? ZAd@ ZBdA ZCdB ZDyC)DFileTestCasec                 \   t        t        t                    5 }	 d d d        t        t               d      5 }	 d d d        t        t               d      5 }	 d d d        t        t               d      5 }	 d d d        y # 1 sw Y   dxY w# 1 sw Y   RxY w# 1 sw Y   @xY w# 1 sw Y   y xY w)Nwxa)r   r   rI   r  s     r<   	test_initzFileTestCase.test_init  s    gm,- 		gi% 		gi% 		gi% 		 		 		 		 		 	s.   A>B
B3B">B
BB"B+c                    t        t              }t        |t              5  t	        |      5 }| j                  |j                         t               d d d        t	        |d      5 }|j                  t               d d d        t	        |      5 }| j                  |j                         t        dz         d d d        d d d        y # 1 sw Y   wxY w# 1 sw Y   YxY w# 1 sw Y   *xY w# 1 sw Y   y xY w)Nr  r   )	r   r
   r   rI   r   rU   readrV   r  )r8   r   r  s      r<    test_init_with_PathLike_filenamez-FileTestCase.test_init_with_PathLike_filename%  s    F#h. 	6(# 2q  512(C( A(# 6q  51956	6 	62 2 6 6	6 	6sR   C+%CC+%C;C+(C6C+C	C+C	C+C(	$C++C4c                 8   t        t        t              5  t        t              5 }	 d d d        t        t        d      5 }	 d d d        t        t        d      5 }	 d d d        d d d        y # 1 sw Y   FxY w# 1 sw Y   8xY w# 1 sw Y   *xY w# 1 sw Y   y xY w)Nr  r  )r   r
   rI   r   r  s     r<   test_init_with_filenamez$FileTestCase.test_init_with_filename/  s    fm, 	&! Q&#& !&#& !	 	   	 	sP   BA,BA8BBB,A5	1B8B	=BB		BBc                    t        t              5  t        t        d      5  	 d d d        t        t        d      5  	 d d d        t        t        d      5  	 d d d        t        t        d      5  	 d d d        t        t        d      5  	 d d d        t        t        d      5  	 d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xxY w# 1 sw Y   jxY w# 1 sw Y   \xY w# 1 sw Y   NxY w# 1 sw Y   y xY w)Nrrbr  r  r  ab)r   r
   r   rF   s    r<   test_init_modezFileTestCase.test_init_mode8  s    f 	&#& &$' &#& &$' &#& &$' 	 	      	 	s   C>B6C>CC>CC>/C1C>	C&C>#C2%C>6B?	;C>C	C>C	C>C#	C>&C/	+C>2C;	7C>>Dc                 $   | j                  t        t               dD ]Y  }t        t               t        t        |      5 }	 d d d        | j	                  t
              5  t        t        |       d d d        [ y # 1 sw Y   :xY w# 1 sw Y   rxY w)N)r  xb)
addCleanupr   r
   r   r+   FileExistsError)r8   moder  s      r<   test_init_with_x_modez"FileTestCase.test_init_with_x_modeG  s|    ' 	'D6N&$' 1""?3 '&' '		' ' 's   A:B:B	B	c                    | j                  t              5  t        t        t              d       d d d        | j                  t              5  t        t        t              d       d d d        | j                  t              5  t        t        t              d       d d d        | j                  t              5  t        t        t              d       d d d        | j                  t              5  t        t        t              d       d d d        | j                  t              5  t        t        t              d       d d d        | j                  t              5  t        t        t              d       d d d        | j                  t              5  t        t        t              d       d d d        | j                  t              5  t        t        t              d	       d d d        | j                  t              5  t        t        t              d
       d d d        | j                  t              5  t        t        t              d       d d d        y # 1 sw Y   1xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   _xY w# 1 sw Y   5xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)N)r   r  r   xtzx+rxwxrtzr+wtzw+rw)r+   r-   r   r   rI   rF   s    r<   test_init_bad_modezFileTestCase.test_init_bad_modeP  s-   z* 	7W]+X6	7z* 	1W]+R0	1z* 	3W]+T2	3z* 	3W]+T2	3z* 	3W]+T2	3z* 	3W]+T2	3z* 	3W]+T2	3z* 	3W]+T2	3z* 	3W]+T2	3z* 	3W]+T2	3z* 	3W]+T2	3 	3)	7 	7	1 	1	3 	3	3 	3	3 	3	3 	3	3 	3	3 	3	3 	3	3 	3	3 	3s   II,I9;J2J)J  J-J:KK<KI),I69JJJ J*-J7:KKKK(c                     | j                  t              5  t        t               dd       d d d        | j                  t              5  t        t               dt
        j                         d d d        | j                  t              5  t        t               dt
        j                  dz          d d d        | j                  t              5  t        t        t              t
        j                         d d d        | j                  t              5  t        t        t              t
        j                         d d d        | j                  t              5  t        t        t              t
        j                         d d d        | j                  t              5  t        t        t              t
        j                         d d d        | j                  t              5  t        t        t              t
        j                         d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   JxY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr  s   asdr   r   )r+   r,   r   r   r   r   CHECK_UNKNOWNCHECK_ID_MAXr-   rI   r^   CHECK_CRC32r]   CHECK_SHA256rF   s    r<   test_init_bad_checkz FileTestCase.test_init_bad_checkh  s   y) 	3WY62	3 y) 	?WY4+=+=>	?y) 	BWY4+<+<q+@A	B z* 	DW]+4??C	Dz* 	EW]+43C3CD	Ez* 	EW]+43C3CD	Ez* 	FW]+43D3DE	Fz* 	GW]+43E3EF	G 	G!	3 	3	? 	?	B 	B	D 	D	E 	E	E 	E	F 	F	G 	Gs_   H
%H((H5)I)I)I#)I())I4H%(H25H?III%(I14I=c                    | j                  t              5  t        t               dd       d d d        | j                  t              5  t        t               dd       d d d        | j                  t              5  t        t               dd       d d d        | j                  t
              5  t        t               dd       d d d        | j                  t
              5  t        t               dd       d d d        | j                  t              5  t        t               dd       d d d        | j                  t              5  t        t        t              d	       d d d        y # 1 sw Y   GxY w# 1 sw Y    xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)
Nr  g(\@r   rw      r   irC   r   )r+   r,   r   r   r   OverflowErrorr-   rI   rF   s    r<   test_init_bad_presetz!FileTestCase.test_init_bad_preset|  sa   y) 	2WYD1	2y) 	0WYB/	0y) 	0WYB/	0}- 	0WYB/	0}- 	0WYB/	0y) 	3WYE2	3 z* 	7W]+A6	7 	7	2 	2	0 	0	0 	0	0 	0	0 	0	3 	3	7 	7sS   E2
E?>F2F&F$F0F<2E<?F	FF!$F-0F9<Gc                    | j                  t              5  t        t               ddg       d d d        | j                  t              5  t        t               dddig       d d d        | j                  t              5  t        t               dddig       d d d        | j                  t              5  t        t               dt
        j                  dd	g       d d d        | j                  t              5  t        t               dt
        j                  dd	g       d d d        | j                  t              5  t        t               dt
        j                  dd	g       d d d        y # 1 sw Y   KxY w# 1 sw Y   !xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)
Nr  r?   r   r@   r   r!   rA   r   rB   )	r+   r,   r   r   r-   r   r/   rD   rE   rF   s    r<   test_init_bad_filter_specz&FileTestCase.test_init_bad_filter_spec  s   y) 	;WYj\:	;z* 	=WYwl^<	=z* 	>WYtUm_=	>z* 	DWY%)%6%6qABD	D z* 	DWY%)%6%6qABD	D z* 	BWY%)__Q?@B	B 	B	; 	;	= 	=	> 	>	D 	D	D 	D	B 	BsG   E7FF9)F?)F))F57FFFF&)F25F>c                     | j                  t              5  t        t               dt        j
                  dt               d d d        y # 1 sw Y   y xY w)Nr     )r   r   r   )r+   r-   r   r   r   r0   r1   rF   s    r<   !test_init_with_preset_and_filtersz.FileTestCase.test_init_with_preset_and_filters  s>    z* 	6WYDOO}6	6 	6 	6s   +A

Ac                    t        t              5 }t        |      }|j                          | j	                  |j
                         |j                          | j	                  |j
                         d d d        t        t        t              5  t        t              }|j                  }|j                          | j                  |j
                         |j                          d d d        y # 1 sw Y   }xY w# 1 sw Y   y xY wrR   )
r   rI   r   closerS   closedr   r
   _fprW   )r8   srcr  fps       r<   
test_closezFileTestCase.test_close  s    ]# 	)sAGGISZZ(GGISZZ(	) fm, 	 ABGGIOOBII&GGI	 		) 	)	 	s   A"C.AC:.C7:Dc                 "   t        t        t                    }	 | j                  |j                         |j                          | j                  |j                         |j                          | j                  |j                         t        t               d      }	 | j                  |j                         |j                          | j                  |j                         y # |j                          w xY w# |j                          w xY wNr  )r   r   rI   rS   r;  r  r:  rW   r  s     r<   test_closedzFileTestCase.test_closed  s    W]+,	QXX&FFHQXX&GGI!WY$	QXX&GGI! GGI GGIs   AC'  C< 'C9<Dc                    t        t        t                    }	 | j                  t        |j
                         |j                          | j                  t        |j
                         t        t        t              5  t        t              }	 | j                  |j                         |j                  j                                | j                  |j                         t               |j                          	 d d d        | j                  t        |j
                         y # |j                          w xY w# |j                          w xY w# 1 sw Y   TxY wrR   )r   r   rI   r+   r   filenor:  r-   r   r
   rU   r<  assertIsInstanceintr  s     r<   test_filenozFileTestCase.test_fileno  s    W]+,	2AHH=GGI*ahh/fm, 	 A  QUU\\^<%%ahhj#6		 	*ahh/ GGI 		 	s0    D% >EAD:+E%D7:EEEc                 \   t        t        t                    }	 | j                  |j	                                |j                          | j                  |j	                                |j                          | j                  t        |j                         t        t               d      }	 | j                  |j	                                |j                          | j                  t        |j                         t        t              }d |_        t        |      }	 | j                  |j	                                |j                          | j                  t        |j                         y # |j                          w xY w# |j                          w xY w# |j                          w xY w)Nr  c                       y)NFr#   r#   rL   r<   <lambda>z,FileTestCase.test_seekable.<locals>.<lambda>  s    rL   )
r   r   rI   rW   seekabler  r:  r+   r-   rS   )r8   r  r=  s      r<   test_seekablezFileTestCase.test_seekable  s   W]+,	OOAJJL)FFHOOAJJL)GGI*ajj1WY$	QZZ\*GGI*ajj1m$$SM	QZZ\*GGI*ajj1# GGI GGI GGIs$   AE/ -F F /FFF+c                 N   t        t        t                    }	 | j                  |j	                                |j                          | j                  |j	                                |j                          | j                  t        |j                         t        t               d      }	 | j                  |j	                                |j                          | j                  t        |j                         y # |j                          w xY w# |j                          w xY wrA  )
r   r   rI   rW   readabler  r:  r+   r-   rS   r  s     r<   test_readablezFileTestCase.test_readable  s    W]+,	OOAJJL)FFHOOAJJL)GGI*ajj1WY$	QZZ\*GGI*ajj1 GGI GGI   AC= -D =DD$c                 N   t        t        t                    }	 | j                  |j	                                |j                          | j                  |j	                                |j                          | j                  t        |j                         t        t               d      }	 | j                  |j	                                |j                          | j                  t        |j                         y # |j                          w xY w# |j                          w xY wrA  )
r   r   rI   rS   writabler  r:  r+   r-   rW   r  s     r<   test_writablezFileTestCase.test_writable  s    W]+,	QZZ\*FFHQZZ\*GGI*ajj1WY$	OOAJJL)GGI*ajj1 GGI GGIrP  c                    t        t        t                    5 }| j                  |j	                         t
               | j                  |j	                         d       d d d        t        t        t                    5 }| j                  |j	                         t
               d d d        t        t        t              t        j                        5 }| j                  |j	                         t
               | j                  |j	                         d       d d d        t        t        t              t        j                        5 }| j                  |j	                         t
               | j                  |j	                         d       d d d        t        t        t              t        j                  t              5 }| j                  |j	                         t
               | j                  |j	                         d       d d d        t        t        t              t        j                  t              5 }| j                  |j	                         t
               | j                  |j	                         d       d d d        t        t        t              t        j                  t               5 }| j                  |j	                         t
               | j                  |j	                         d       d d d        t        t        t"              t        j                  t$              5 }| j                  |j	                         t
               | j                  |j	                         d       d d d        y # 1 sw Y   "xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   @xY w# 1 sw Y   xY w# 1 sw Y   y xY w)NrL   r   r(   )r   r   rI   rU   r  rV   rO   r   r2   r3   rf   r0   r1   rk   rj   ro   rn   rs   rr   r  s     r<   	test_readzFileTestCase.test_read  s   gm,- 	,QVVXu-QVVXs+	, g./0 	.AQVVXu-	.gm,T^^D 	,QVVXu-QVVXs+	, g./8I8IJ 	,aQVVXu-QVVXs+	, g./!__mE 	,HIQVVXu-QVVXs+	, g./!__mE 	,HIQVVXu-QVVXs+	, g./!__mE 	,HIQVVXu-QVVXs+	, g./!__mE 	,HIQVVXu-QVVXs+	, 	,/	, 	,	. 	.	, 	,	, 	,	, 	,	, 	,	, 	,	, 	,sf   AM>>%NANAN%AN2<AN?6AO0AO>NNN"%N/2N<?O	OO!c                    t        t        t                    5 }| j                  |j	                  d      d       d d d        t        t        t
                    5 }| j                  |j	                  d      d       d d d        t        t        t              t        j                        5 }| j                  |j	                  d      d       d d d        t        t        t
              t        j                        5 }| j                  |j	                  d      d       d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   txY w# 1 sw Y   y xY w)Nr   rL   r   )	r   r   rI   rU   r  rO   r   r2   r3   r  s     r<   test_read_0zFileTestCase.test_read_01  s   gm,- 	-QVVAY,	-g./0 	-AQVVAY,	-gm,T^^D 	-QVVAY,	-g./8I8IJ 	-aQVVAY,	- 	-	- 	-	- 	-	- 	-	- 	-s/   "D*"D6-"E?"E*D36D?EEc                 R   t        t        t                    5 }g }|j                  d      x}r@| j	                  t        |      d       |j                  |       |j                  d      x}r@| j                  dj                  |      t               d d d        y # 1 sw Y   y xY wNrw   rL   )
r   r   rI   r  r   rz   r{   rU   r|   rV   )r8   r  chunksresults       r<   test_read_10zFileTestCase.test_read_10;  s    gm,- 	6FFF2J&&&$$S["5f% FF2J&&& SXXf-u5	6 	6 	6s   AB/%BB&c                 @   t        t        t        dz              5 }| j                  |j	                         t
        dz         d d d        t        t        t        t        z               5 }| j                  |j	                         t
        dz         d d d        t        t        t        dz        t        j                  t              5 }| j                  |j	                         t
        dz         d d d        y # 1 sw Y   xY w# 1 sw Y   vxY w# 1 sw Y   y xY w)Nr   r      r(   )r   r   rI   rU   r  rV   rO   ro   r   r0   rn   r  s     r<   test_read_multistreamz"FileTestCase.test_read_multistreamC  s    gma/01 	2QQVVXuqy1	2gm.>>?@ 	2AQVVXuqy1	2g.23!__mE 	2HIQVVXuqy1	2 	2		2 	2	2 	2	2 	2s#   (C<+(D(D<DDDc                 :   t         j                  }t        t              t         _        	 t	        t        t        dz              5 }| j                  |j                         t        dz         d d d        |t         _        y # 1 sw Y   xY w# |t         _        w xY wNr   )	_compressionBUFFER_SIZErz   rI   r   r   rU   r  rV   )r8   saved_buffer_sizer  s      r<   )test_read_multistream_buffer_size_alignedz6FileTestCase.test_read_multistream_buffer_size_alignedL  sz     )44#&}#5 	9'-1"456 6!  51956 (9L$6 6 (9L$s#   B (B-B B
B Bc                     t        t        t        t        z               5 }| j	                  |j                         t               d d d        y # 1 sw Y   y xY wrR   r   r   rI   r   rU   r  rV   r  s     r<   test_read_trailing_junkz$FileTestCase.test_read_trailing_junkW  sB    gm.>>?@ 	.AQVVXu-	. 	. 	.s   %AAc                     t        t        t        dz  t        z               5 }| j	                  |j                         t        dz         d d d        y # 1 sw Y   y xY wra  rg  r  s     r<   #test_read_multistream_trailing_junkz0FileTestCase.test_read_multistream_trailing_junk[  sK    gma/2BBCD 	2QVVXuqy1	2 	2 	2s   (AAc                    t        t        t              5  t        t              5 }| j	                  |j                         t               | j	                  |j                         d       | j                  |j                         t               | j                  |j                         d       | j                  |j                         d       | j                  |j                         d       | j                  |j                  d       d d d        | j                  j                  d       | j                  t         |j                         | j                  t         |j                         | j                  t         |j                         | j                  t         |j                         d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)NrL   TF)r   r
   rI   r   rU   r  rV   rE  rD  rF  assertIsrN  rR  rK  r;  r+   r-   r  s     r<   test_read_from_filez FileTestCase.test_read_from_file_  s9   fm, 	6&! /Q  51  3/%%ahhj#6ajjlD1ajjlE2ajjlD1ahh./ MM!((D)j!((3j!**5j!**5j!**5	6 	6/ /	6 	6s$   GC%F7
B$G7G 	<GGc                 P   t        j                  t              }t        t        t              5  t        |      5 }| j                  |j                         t               | j                  |j                         d       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY wr   )	osfsencoder
   r   rI   r   rU   r  rV   )r8   bytes_filenamer  s      r<   'test_read_from_file_with_bytes_filenamez4FileTestCase.test_read_from_file_with_bytes_filenameo  s    V,fm, 	0.) 0Q  51  3/0	0 	00 0	0 	0s#   BAB?BB	BB%c                    t        t        t              5  t        t        d      5 }t	        |      5 }| j                  |j                         t               | j                  |j                         d       | j                  |j                         |j                                | j                  |j                         d       | j                  |j                         d       | j                  |j                         d       | j                  |j                  d       d d d        | j                  j                  d       | j                  t        |j                         | j                  t        |j                         | j                  t        |j                         | j                  t        |j                         d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY wNr  rL   TF)r   r
   rI   r  r   rU   r  rV   rD  rl  rN  rR  rK  r;  r+   r-   )r8   rawr  s      r<   test_read_from_fileobjz#FileTestCase.test_read_from_fileobjv  s_   fm, 	:fd# :sc] 3a$$QVVXu5$$QVVXs3$$QXXZ>MM!**,5MM!**,6MM!**,5MM!((E23 ahh-!!*ahh7!!*ajj9!!*ajj9!!*ajj9:	: 	:3 3: :	: 	:s;   G.G"C/G!B$G"G.GG""G+	'G..G7c                 <   t        t        t              5  t        j                  t        t        j
                        }t	        |d      5 }t        |      5 }| j                  |j                         t               | j                  |j                         d       | j                  |j                         |j                                | j                  |j                         d       | j                  |j                         d       | j                  |j                         d       | j                  |j                  d       d d d        | j                  j                  d       | j!                  t"        |j                         | j!                  t"        |j                         | j!                  t"        |j                         | j!                  t"        |j                         d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY wrt  )r   r
   rI   ro  r  O_RDONLYr   rU   r  rV   rD  rl  rN  rR  rK  r;  r+   r-   )r8   fdru  r  s       r<   $test_read_from_fileobj_with_int_namez1FileTestCase.test_read_from_fileobj_with_int_name  sr   fm, 	:-Bb$ :3c] 3a$$QVVXu5$$QVVXs3$$QXXZ>MM!**,5MM!**,6MM!**,5MM!((E23 ahh-!!*ahh7!!*ajj9!!*ajj9!!*ajj9:	: 	:3 3: :	: 	:s=   5H
HC/G:B$H)H:H?HH	HHc                     t        t        t        d d             5 }| j                  t        |j
                         d d d        y # 1 sw Y   y xY w)Nr   )r   r   rI   r+   r7   r  r  s     r<   test_read_incompletez!FileTestCase.test_read_incomplete  sA    gmDS123 	0qh/	0 	0 	0s   !AAc                 Z   t         d d }t        t        |            5 }| j                  t        |j
                         d d d        t        t        |            5 }| j                  |j                  t        t                    t               | j                  t        |j
                  d       d d d        t        d      D ]C  }t        t        |d |             5 }| j                  t        |j
                  d       d d d        E y # 1 sw Y   xY w# 1 sw Y   gxY w# 1 sw Y   hxY w)Nir      )
rI   r   r   r+   r7   r  rU   rz   rV   ry   )r8   	truncatedr  r~   s       r<   test_read_truncatedz FileTestCase.test_read_truncated  s     "$3'	gi() 	0Qh/	0gi() 	3QQVVCJ/7h2	3 r 	7A')BQ-01 7Q!!(AFFA67 7	7	0 	0	3 	3
7 7s$   !D	AD"D!	DD!D*	c                    t        t        t                    }|j                          | j	                  t
        |j                         t        t               d      5 }| j	                  t
        |j                         d d d        t        t        t                    5 }| j	                  t        |j                  t                      d d d        y # 1 sw Y   TxY w# 1 sw Y   y xY wrA  )	r   r   rI   r:  r+   r-   r  r,   floatr  s     r<   test_read_bad_argszFileTestCase.test_read_bad_args  s    W]+,		*aff-gi% 	2j!&&1	2gm,- 	:i9	: 	:	2 	2	: 	:s   !C*CCC&c                     t        t        t                    5 }| j                  t        |j
                         d d d        y # 1 sw Y   y xY wrR   )r   r   r   r+   r   r  r  s     r<   test_read_bad_datazFileTestCase.test_read_bad_data  s;    g./0 	1Ai0	1 	1 	1s   !AAc                 X   t        t        t                    5 }g }|j                         x}r$|j	                  |       |j                         x}r$| j                  dj                  |      t               | j                  |j                         d       d d d        y # 1 sw Y   y xY wr   r   r   rI   read1r{   rU   r|   rV   r8   r  blocksr[  s       r<   
test_read1zFileTestCase.test_read1  s    gm,- 	-FGGI%&%f% GGI%&%SXXf-u5QWWY,	- 	- 	-s   8B AB  B)c                     t        t        t                    5 }| j                  |j	                  d      d       d d d        y # 1 sw Y   y xY w)Nr   rL   )r   r   rI   rU   r  r  s     r<   test_read1_0zFileTestCase.test_read1_0  s>    gm,- 	.QWWQZ-	. 	. 	.s   "AAc                 \   t        t        t                    5 }g }|j                  d      x}r%|j	                  |       |j                  d      x}r%| j                  dj                  |      t               | j                  |j                         d       d d d        y # 1 sw Y   y xY wrY  r  r  s       r<   test_read1_10zFileTestCase.test_read1_10  s    gm,- 	-FGGBK'&'f% GGBK'&'SXXf-u5QWWY,	- 	- 	-s   :B"AB""B+c                 d   t        t        t        dz              5 }g }|j                         x}r$|j	                  |       |j                         x}r$| j                  dj                  |      t        dz         | j                  |j                         d       d d d        y # 1 sw Y   y xY w)Nr   rL   r  r  s       r<   test_read1_multistreamz#FileTestCase.test_read1_multistream  s    gma/01 	-QFGGI%&%f% GGI%&%SXXf-uqy9QWWY,	- 	- 	-s   8B&AB&&B/c                    t        t        t                    }|j                          | j	                  t
        |j                         t        t               d      5 }| j	                  t
        |j                         d d d        t        t        t                    5 }| j	                  t        |j                  d        d d d        y # 1 sw Y   LxY w# 1 sw Y   y xY wrA  )r   r   rI   r:  r+   r-   r  r,   r  s     r<   test_read1_bad_argsz FileTestCase.test_read1_bad_args  s    W]+,		*agg.gi% 	3j!''2	3gm,- 	8i$7	8 	8	3 	3	8 	8s   !C	"C	CCc                    t        t        t                    5 }|j                         }| j	                  t        |      d       | j                  t        j                  |             | j                  |j                         t               d d d        t        t        t                    5 }|j                  d      }| j	                  t        |      d       | j                  t        j                  |             | j                  |j                         t               d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nr   rw   )r   r   rI   peekassertGreaterrz   rW   rV   
startswithrU   r  )r8   r  r[  s      r<   	test_peekzFileTestCase.test_peek  s    gm,- 	.VVXFs6{A.OOE,,V45QVVXu-		.
 gm,- 	.VVBZFs6{A.OOE,,V45QVVXu-		. 	.	. 	.
	. 	.s   A4D+-A5D7+D47E c                     t        t               d      5 }| j                  t        |j                         d d d        y # 1 sw Y   y xY wrA  )r   r   r+   r-   r  r  s     r<   test_peek_bad_argszFileTestCase.test_peek_bad_args  s9    gi% 	2j!&&1	2 	2 	2s	   !?Ac                    t        t              5 }|j                         }d d d        t        t        t                    5 }| j                  t        t        |                   d d d        t        t        t                    5 }| j                  t        t        |                   d d d        t        t        t              t        j                        5 }| j                  t        t        |                   d d d        t        t        t              t        j                        5 }| j                  t        t        |                   d d d        t        t        t              t        j                  t              5 }| j                  t        t        |                   d d d        y # 1 sw Y   xY w# 1 sw Y   axY w# 1 sw Y   )xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY wr   )r   rV   	readlinesr   rI   assertListEquallistiterrO   r   r2   r3   rk   r0   rj   r8   r  liness      r<   test_iteratorzFileTestCase.test_iterator  sz   U^ 	"qKKME	"gm,- 	7  d1g6	7g./0 	7A  d1g6	7gm,T^^D 	7  d1g6	7g./8I8IJ 	7a  d1g6	7g./!__mE 	7HI  d1g6	7 	7	" 	"	7 	7	7 	7	7 	7	7 	7	7 	7sG   F8%G%G%G0%G+
%G78GGGG(+G47H c                    t        t              5 }|j                         }d d d        t        t        t                    5 }D ]"  }| j                  |j                         |       $ 	 d d d        y # 1 sw Y   SxY w# 1 sw Y   y xY wrR   )r   rV   r  r   rI   rU   readline)r8   r  r  lines       r<   test_readlinezFileTestCase.test_readline  sy    U^ 	"qKKME	"gm,- 	5 5  t45	5 	5	" 	"	5 	5s   A3(A?3A<?Bc                    t        t              5 }|j                         }d d d        t        t        t                    5 }| j                  |j                                d d d        y # 1 sw Y   KxY w# 1 sw Y   y xY wrR   )r   rV   r  r   rI   r  r  s      r<   test_readlineszFileTestCase.test_readlines  sj    U^ 	"qKKME	"gm,- 	7  6	7 	7	" 	"	7 	7s   A+!A7+A47B c                    t         j                  dt        d      z  d      }| j                  t	        |      t
        j                         t        t        |            }| j                  |j                  d      d       dt        z   }| j                  |j                  j                  j                         |d       y)z-Decompressed data buffering should be limited    g    >Ar7  r   r   z)Excessive amount of data was decompressedN)r   r4   rF  
assertLessrz   rb  rc  r   r   rU   r  r   r   _bufferru  tell)r8   bombdecomp
max_decomps       r<   test_decompress_limitedz$FileTestCase.test_decompress_limited	  s    }}USX-a}8D	<#;#;<'$-(Q/,,
V^^//446
7	9rL   c                 R   t               5 }t        |d      5 }|j                  t               d d d        t        j                  t              }| j                  |j                         |       d d d        t               5 }t        |dt        j                        5 }|j                  t               d d d        t        j                  t        t        j                        }| j                  |j                         |       d d d        t               5 }t        |dt        j                        5 }|j                  t               d d d        t        j                  t        t        j                        }| j                  |j                         |       d d d        t               5 }t        |dt        j                  t              5 }|j                  t               d d d        t        j                  t        t        j                  t              }| j                  |j                         |       d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   hxY w# 1 sw Y   0xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr  r   r(   )r   r   r  rV   r   r4   rU   getvaluer2   r3   r0   rj   )r8   dstr  expecteds       r<   
test_writezFileTestCase.test_write  s   Y 	7##s# q}}U+HS\\^X6		7
 Y 	7##s4>>: a}}U4>>}BHS\\^X6		7
 Y 	7##s4+<+<= }}U43D3D}EHS\\^X6		7
 Y 	7##s4??"/1 45 }}U4??-: % <HS\\^X6	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s   IIAII+I4AI+J4I8
AJ-"JJ%AJI		III(	#I++I58J	=JJJ	JJ&c           	      l   t               5 }t        |d      5 }t        dt        t              d      D ]  }|j                  t        ||dz            	 d d d        t        j                  t              }| j                  |j                         |       d d d        y # 1 sw Y   KxY w# 1 sw Y   y xY w)Nr  r   rw   )
r   r   ry   rz   rV   r  r   r4   rU   r  )r8   r  r  startr  s        r<   test_write_10zFileTestCase.test_write_10,  s    Y 	7##s# 3q"1c%j"5 3EGGE%b1233 }}U+HS\\^X6	7 	73 3	7 	7s#   B*;BAB*B'	#B**B3c                    t         d d }t         dd }t         dd  }dj                  d |||fD              }t               5 }t        |d      5 }|j	                  |       d d d        t        |d      5 }|j	                  |       d d d        t        |d      5 }|j	                  |       d d d        | j                  |j                         |       d d d        y # 1 sw Y   ~xY w# 1 sw Y   dxY w# 1 sw Y   JxY w# 1 sw Y   y xY w)NrN      rL   c              3   F   K   | ]  }t         j                  |        y wrR   r   r4   .0r  s     r<   	<genexpr>z1FileTestCase.test_write_append.<locals>.<genexpr>8       LDMM!,L   !r  r  )rV   r|   r   r   r  rU   r  )r8   part1part2part3r  r  r  s          r<   test_write_appendzFileTestCase.test_write_append4  s    etd4 de88LueU6KLLY 	7##s# q#s# q#s# qS\\^X6	7 	7   	7 	7sT   DC D4C)DC5,(DC&	"D)C2	.D5C>	:DD
c                    	 t        t        d      5 }|j                  t               | j	                  |j                         t               | j                  |j                         d       | j                  |j                         d       | j                  |j                         d       | j                  |j                  d       d d d        | j                  j                  d       | j                  t        |j
                         | j                  t        |j                         | j                  t        |j                         | j                  t        |j                         t        j                  t              }t!        t        d      5 }| j#                  |j%                         |       d d d        t'        t               y # 1 sw Y   xY w# 1 sw Y   &xY w# t'        t               w xY w)Nr  FTr  )r   r
   r  rV   rE  rD  rF  rl  rN  rR  rK  r;  r+   r-   r   r4   r  rU   r  r   )r8   r  r  s      r<   test_write_to_filezFileTestCase.test_write_to_fileB  sS   	&#& /!%%ahhj#6ajjlE2ajjlD1ajjlE2ahh./ MM!((D)j!((3j!**5j!**5j!**5}}U+Hfd# 5q  845 6N#/ /5 5 6Ns<   G' B6GCG' !G6G' GG' G$ G' 'G8c                    t        j                  t              }	 t        |d      5 }|j	                  t
               d d d        t        j                  t
              }t        t        d      5 }| j                  |j                         |       d d d        t        t               y # 1 sw Y   kxY w# 1 sw Y   %xY w# t        t               w xY w)Nr  r  )ro  rp  r
   r   r  rV   r   r4   r  rU   r  r   )r8   rq  r  r  s       r<   &test_write_to_file_with_bytes_filenamez3FileTestCase.test_write_to_file_with_bytes_filenameW  s    V,	.#. !}}U+Hfd# 5q  845 6N 5 5 6Ns9   B? B'1B? .!B3B? 'B0,B? 3B<8B? ?Cc                 L   	 t        t        d      5 }t        |d      5 }|j                  t               | j                  |j                         |j                                | j                  |j                         d       | j                  |j                         d       | j                  |j                         d       | j                  |j                  d       d d d        | j                  j                  d       | j                  t        |j                         | j                  t        |j                         | j                  t        |j                         | j                  t        |j                         d d d        t        j                  t              }t        t        d      5 }| j                  |j!                         |       d d d        t#        t               y # 1 sw Y   xY w# 1 sw Y   xxY w# 1 sw Y   2xY w# t#        t               w xY wNr  r  FTr  )r  r
   r   r  rV   rU   rD  rl  rN  rR  rK  r;  r+   r-   r   r4   r  r   )r8   ru  r  r  s       r<   test_write_to_fileobjz"FileTestCase.test_write_to_fileobjb  s|   	fd# :sc3' 31GGEN$$QXXZ>MM!**,6MM!**,5MM!**,6MM!((E23 ahh-!!*ahh7!!*ajj9!!*ajj9!!*ajj9: }}U+Hfd# 5q  845 6N#3 3: :5 5 6NsS   H G:C G-B$G:1H 4!HH -G7	2G::H?H HH H#c                    	 t        j                  t        t         j                  t         j                  z  t         j
                  z        }t        |d      5 }t        |d      5 }|j                  t               | j                  |j                         |j                                | j                  |j                         d       | j                  |j                         d       | j                  |j                         d       | j                  |j                  d       d d d        | j                  j                  d       | j!                  t"        |j                         | j!                  t"        |j                         | j!                  t"        |j                         | j!                  t"        |j                         d d d        t$        j'                  t              }t        t        d      5 }| j                  |j)                         |       d d d        t+        t               y # 1 sw Y   xY w# 1 sw Y   xxY w# 1 sw Y   2xY w# t+        t               w xY wr  )ro  r  r
   O_WRONLYO_CREATO_TRUNCr   r  rV   rU   rD  rl  rN  rR  rK  r;  r+   r-   r   r4   r  r   )r8   ry  ru  r  r  s        r<   #test_write_to_fileobj_with_int_namez0FileTestCase.test_write_to_fileobj_with_int_namex  s   	rzz!9BJJ!FGBb$ :3c3' 31GGEN$$QXXZ>MM!**,6MM!**,5MM!**,6MM!((E23 ahh-!!*ahh7!!*ajj9!!*ajj9!!*ajj9: }}U+Hfd# 5q  845 6N#3 3: :5 5 6NsV   AI I %C H3%B$I 	1I :!II 3H=	8I  I	I II I)c                    t         d d }t         dd }t         dd  }dj                  d |||fD              }	 t        t        d      5 }|j	                  |       d d d        t        t        d      5 }|j	                  |       d d d        t        t        d      5 }|j	                  |       d d d        t        t        d      5 }| j                  |j                         |       d d d        t        t               y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   jxY w# 1 sw Y   =xY w# t        t               w xY w)NrN   r  rL   c              3   F   K   | ]  }t         j                  |        y wrR   r  r  s     r<   r  z9FileTestCase.test_write_append_to_file.<locals>.<genexpr>  r  r  r  r  r  )	rV   r|   r   r
   r  r  rU   r  r   )r8   r  r  r  r  r  s         r<   test_write_append_to_filez&FileTestCase.test_write_append_to_file  s   etd4 de88LueU6KLL
	&#& !&#& !&#& !fd# 5q  845 6N   5 5 6Nsk   D/ C?D/ 2DD/ D.D/ !D#'D/ ?DD/ DD/ D D/ #D,(D/ /E c                 D   t        t               d      }|j                          | j                  t        |j
                  d       t        t        t              d      5 }| j                  t        |j
                  d       d d d        t        t               d      5 }| j                  t        |j
                  d        | j                  t        |j
                  d       | j                  t        |j
                  d       d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nr  r)   r  r*   texti  )r   r   r:  r+   r-   r  rI   r,   r  s     r<   test_write_bad_argsz FileTestCase.test_write_bad_args  s    WY$		*aggv6gm,c2 	;aj!''6:	;gi% 	7i$7i&9i#6	7 	7	; 	;	7 	7s   "D
A$D
DDc                    t        t              5 }|j                         }d d d        t               5 }t        |d      5 }|j	                         d d d        t
        j                  t              }| j                  |j                         |       d d d        y # 1 sw Y   |xY w# 1 sw Y   WxY w# 1 sw Y   y xY wrA  )	r   rV   r  r   
writelinesr   r4   rU   r  )r8   r  r  r  r  s        r<   test_writelineszFileTestCase.test_writelines  s    U^ 	"qKKME	"Y 	7##s# $qU#$}}U+HS\\^X6		7 	7	" 	"$ $	7 	7s/   BB4 B(AB4B%(B1	-B44B=c                     t        t        t                    5 }|j                  d       | j	                  |j                         t        dd         d d d        y # 1 sw Y   y xY w)Ni+  r   r   rI   seekrU   r  rV   r  s     r<   test_seek_forwardzFileTestCase.test_seek_forward  sM    gm,- 	4FF3KQVVXuST{3	4 	4 	4s   9AA$c                     t        t        t        dz              5 }|j                  t	        t
              dz          | j                  |j                         t
        dd         d d d        y # 1 sw Y   y xY w)Nr   {   )r   r   rI   r  rz   rV   rU   r  r  s     r<    test_seek_forward_across_streamsz-FileTestCase.test_seek_forward_across_streams  s\    gma/01 	4QFF3u:#$QVVXuST{3	4 	4 	4s   A	A..A7c                     t        t        t                    5 }|j                  d       |j	                  dd       | j                  |j                         t        dd         d d d        y # 1 sw Y   y xY w)Nr   i  r   i8  r   r   rI   r  r  rU   rV   r  s     r<   %test_seek_forward_relative_to_currentz2FileTestCase.test_seek_forward_relative_to_current  sZ    gm,- 	5FF3KFF4OQVVXuTU|4	5 	5 	5s   AA--A6c                     t        t        t                    5 }|j                  dd       | j	                  |j                         t        dd         d d d        y # 1 sw Y   y xY w)Nir   r  r  s     r<   !test_seek_forward_relative_to_endz.FileTestCase.test_seek_forward_relative_to_end  O    gm,- 	5FF4OQVVXuTU|4	5 	5 	5   :AA%c                     t        t        t                    5 }|j                  d       |j	                  d       | j                  |j                         t        dd         d d d        y # 1 sw Y   y xY w)Ni     r  r  s     r<   test_seek_backwardzFileTestCase.test_seek_backward  sX    gm,- 	4FF4LFF3KQVVXuST{3	4 	4 	4s   A
A,,A5c                 $   t        t        t        dz              5 }|j                  t	        t
              dz          |j                  d       | j                  |j                         t
        dd  t
        z          d d d        y # 1 sw Y   y xY w)Nr   iM  i  )r   r   rI   r  rz   rV   r  rU   r  s     r<   !test_seek_backward_across_streamsz.FileTestCase.test_seek_backward_across_streams  sl    gma/01 	<QFF3u:#$FF3KQVVXuST{U':;	< 	< 	<s   A!BBc                     t        t        t                    5 }|j                  dd       | j	                  |j                         t        dd         d d d        y # 1 sw Y   y xY w)Nijr   r  r  s     r<   "test_seek_backward_relative_to_endz/FileTestCase.test_seek_backward_relative_to_end  r  r  c                 :   t        t        t                    5 }|j                  t	        t
              dz          | j                  |j                         t	        t
                     | j                  |j                         d       d d d        y # 1 sw Y   y xY w)N)#  rL   )	r   r   rI   r  rz   rV   rU   r  r  r  s     r<   test_seek_past_endzFileTestCase.test_seek_past_end  sk    gm,- 	,FF3u:$%QVVXs5z2QVVXs+	, 	, 	,s   A/BBc                    t        t        t                    5 }|j                  d       | j	                  |j                         d       | j	                  |j                         t               d d d        y # 1 sw Y   y xY w)Nir   )r   r   rI   r  rU   r  r  rV   r  s     r<   test_seek_past_startz!FileTestCase.test_seek_past_start  s]    gm,- 	.FF3KQVVXq)QVVXu-	. 	. 	.s   AA88Bc                    t        t        t                    }|j                          | j	                  t
        |j                  d       t        t               d      5 }| j	                  t
        |j                  d       d d d        t        t        t                    5 }| j	                  t
        |j                  dd       | j	                  t        t
        f|j                  dd       | j	                  t        |j                  d        | j	                  t        |j                  d       d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nr   r  r   	   r#   s   derp)r   r   rI   r:  r+   r-   r  r,   r  s     r<   test_seek_bad_argszFileTestCase.test_seek_bad_args  s    W]+,		*affa0gi% 	5j!&&!4	5gm,- 	:j!&&!Q7y*5qvvq"Ei6i9	: 	:	5 	5	: 	:s   "D6 BE6D?Ec                    t        t        t                    5 }d}	 | j                  |j	                         |       |j                  d      }|sn|t        |      z  }C| j                  |j	                         t        t                     d d d        t        t               d      5 }t        dt        t              d      D ]=  }| j                  |j	                         |       |j                  t        ||dz           ? | j                  |j	                         t        t                     d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nr      r     )
r   r   rI   rU   r  r  rz   rV   ry   r  )r8   r  posr[  s       r<   	test_tellzFileTestCase.test_tell  s   gm,- 	3C  3/s6{"  QVVXs5z2	3 gi% 	3QE
C0 ,  3/c#c'*+, QVVXs5z2		3 	3	3 	3	3 	3s   A4D:)BE:EEc                     t        t        t                    }|j                          | j	                  t
        |j                         y rR   )r   r   rI   r:  r+   r-   r  r  s     r<   test_tell_bad_argszFileTestCase.test_tell_bad_args  s.    W]+,		*aff-rL   c                    t               }|j                  t        d      }| j                  t	        |      d       | j                  |j                         t               }|j                  t        d      }| j                  |j                         | j                  |j                         |j                  d      }| j                  t	        |      d       | j                  |j                         | j                  ||z   |       y )Nr   r   ih3  i]3  rL      )	r   r6   ISSUE_21872_DATrU   rz   rW   rT   rS   r   )r8   d1entired2out1out2s         r<   test_issue21872zFileTestCase.test_issue21872  s     2>Ve,
 
 }}_}?(  }}S!TB'f-rL   c                 8   t        j                   dg d      }t        |      |j                  z  }t        t	               d      5 }| j                  |j                  |      |       | j                  |j                         |       d d d        y # 1 sw Y   y xY w)NQ)r   r   r   r^  r   r  )arrayrz   itemsizer   r   rU   r  r  )r8   qLENGTHr  s       r<   test_issue44439zFileTestCase.test_issue44439&  su    KK_-Q!**$gi% 	/QWWQZ0QVVXv.	/ 	/ 	/s   ABBN)Er   r   r   r  r  r  r  r!  r)  r/  r3  r5  r8  r?  rB  rG  rL  rO  rS  rU  rW  r\  r_  re  rh  rj  rm  rr  rv  rz  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r#   rL   r<   r  r    sN   6'30G(7"B"6
(""0 242"2",:-62	9.26 0:":$07:1-.--8
.2757	97077*	,."	774
4
55
4<5
,.:3 .
.</rL   r  c                   H    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)OpenTestCasec                    t         j                  t        t              d      5 }| j	                  |j                         t               d d d        t               5 }t         j                  |d      5 }|j                  t               d d d        t         j                  |j                               }| j	                  |t               t         j                  |d      5 }|j                  t               d d d        t         j                  |j                               }| j	                  |t        dz         d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   fxY w# 1 sw Y   y xY w)Nr  r  r  r   )
r   r  r   rI   rU   r  rV   r  r6   r  )r8   r  bio	file_datas       r<   test_binary_modeszOpenTestCase.test_binary_modes1  s   YYw}-t4 	.QVVXu-	.Y 	3#3% 7IY.3% 7IY	2	3 	3	. 	.  	3 	3sI   %EE&2EAE&E5AE&EE	E&E#	E&&E/c                 p   t         j                  d      }|j                  dt        j                        }t
        j                  t        t              dd      5 }| j                  |j                         |       d d d        t               5 }t
        j                  |dd      5 }|j                  |       d d d        t
        j                  |j                               j                  d      }| j                  ||       t
        j                  |dd      5 }|j                  |       d d d        t
        j                  |j                               j                  d      }| j                  ||dz         d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   rxY w# 1 sw Y   y xY w)Nascii
r&  encodingr'  atr   )rV   decodereplacero  linesepr   r  r   rI   rU   r  r  r6   r  )r8   uncompresseduncompressed_rawr  r  r  s         r<   test_text_modeszOpenTestCase.test_text_modes>  s[   ||G,'//bjjAYYw}-tgYF 	5!QVVX|4	5Y 	>#3w7 &1%&7>>wGIY(893w7 &1%&7>>wGIY(81(<=	> 	>	5 	5& && &	> 	>sJ   !FF,'F9A$F,F /AF,FF	F, F)	%F,,F5c                 l   t        t              5  t        j                  t        d      5 }|j	                  t
               d d d        t        t        d      5 }t        j                  |j                               }| j                  |t
               d d d        t        j                  t        d      5 }| j                  |j                         t
               d d d        t        j                  t        d      5 }|j	                  t
               d d d        t        j                  t        d      5 }| j                  |j                         t
        dz         d d d        d d d        y # 1 sw Y   .xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   CxY w# 1 sw Y   y xY w)Nr  r  r  r   )	r   r
   r   r  r  rV   r6   r  rU   )r8   r  r  s      r<   test_filenamezOpenTestCase.test_filenameM  sE   f 	664( Afd# 3q OOAFFH5	  E23 64( 2A  51264( A64( 6A  51956	6 	6 3 32 2 6 6	6 	6s   F*E-F*:E:"F*5%F"F*<F"F*4(FF*-E7	2F*:F	?F*F	F*F	F*F'	#F**F3c                 4   t        t              }t        |      5  t        j	                  |d      5 }|j                  t               d d d        t	        |d      5 }t        j                  |j                               }| j                  |t               d d d        t        j	                  |d      5 }| j                  |j                         t               d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   axY w# 1 sw Y   *xY w# 1 sw Y   y xY w)Nr  r  )
r   r
   r   r   r  r  rV   r6   r  rU   )r8   r   r  r  s       r<   test_with_pathlike_filenamez(OpenTestCase.test_with_pathlike_filename[  s    F#h 	28T* ah% 3 OOAFFH5	  E23 8T* 2a  512	2 	2 3 32 2	2 	2sR   DC*D:C6D4%DD*C3	/D6C?	;DD	DDc                    | j                  t              5  t        j                  t        d       d d d        | j                  t              5  t        j                  t        d       d d d        | j                  t              5  t        j                  t        dd       d d d        | j                  t              5  t        j                  t        dd       d d d        | j                  t              5  t        j                  t        dd	       d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   hxY w# 1 sw Y   y xY w)
Nr   rbtr  zutf-8r  ignore)errorsr  )newline)r+   r-   r   r  r
   rF   s    r<   test_bad_paramszOpenTestCase.test_bad_paramsf  s   z* 	"IIfb!	"z* 	%IIfe$	%z* 	6IIfdWI5	6z* 	5IIfd8I4	5z* 	2IIfdDI1	2 	2	" 	"	% 	%	6 	6	5 	5	2 	2s;   D D,D8 E:E D),D58EEEc                     t         j                  t        d}t        j                  t	        t
              dfi |5 }| j                  |j                         t               d d d        t	               5 }t        j                  |dfi |5 }|j                  t               d d d        t        j                  |j                         fi |}| j                  |t               d d d        y # 1 sw Y   xY w# 1 sw Y   XxY w# 1 sw Y   y xY w)Nr(   r  r  )r   r0   r1   r  r   rf   rU   r  rV   r  r6   r  )r8   optionsr  r  r  s        r<   test_format_and_filtersz$OpenTestCase.test_format_and_filterss  s    !__GYYw/0$B'B 	.aQVVXu-	.Y 	/#300 AB'BIY.		/ 	/	. 	. 	/ 	/s0   %C,3DC8!AD,C58D	=DDc                 l   t         j                  d      }|j                  dt        j                        }t               5 }t        j                  |dd      5 }|j                  |       d d d        t        j                  |j                               j                  d      }| j                  ||       |j                  d       t        j                  |dd      5 }| j                  |j                         |       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr  r  r'  z	utf-16-ler  r   r&  )rV   r  r  ro  r  r   r   r  r  r6   r  rU   r  r  )r8   r  r   r  r  r  s         r<   test_encodingzOpenTestCase.test_encoding~  s    ||G,'//bjjAY 	9#3{; &q%&7>>{KIY(89HHQK3{; 9q  <89	9 	9& &
9 9	9 	9s=    D*D+A5D* !DD*D	D*D'	#D**D3c                    t        t        j                  d            5 }t        j                  |ddd      5 }| j	                  |j                         d       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Ns   foobarr&  r  r(  )r  r)  foobar)r   r   r4   r  rU   r  )r8   r  r  s      r<   test_encoding_error_handlerz(OpenTestCase.test_encoding_error_handler  sp    T]]=12 	5c3wxH 5A  845	5 	55 5	5 	5s"   A7!A+A7+A4	0A77B c                    t         j                  d      }t               5 }t        j	                  |ddd      5 }|j                  |       d d d        |j                  d       t        j	                  |ddd      5 }| j                  |j                         |g       d d d        d d d        y # 1 sw Y   fxY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr  r'  r  )r  r*  r   r&  )	rV   r  r   r   r  r  r  rU   r  )r8   r  r  r  s       r<   test_newlinezOpenTestCase.test_newline  s    ||G$Y 	8#3wE HHQK3wE 8  78		8 	8 8 8		8 	8s:   C	B12C	>"B= C	1B:	6C	=C	C		Cc                    | j                  t        t               dD ]  }t        t               d|v rdnd }t        j	                  t        ||      5  	 d d d        | j                  t              5  t        j	                  t        |      5  	 d d d        d d d         y # 1 sw Y   NxY w# 1 sw Y    xY w# 1 sw Y   xY w)N)r  r  r#  tr  r  )r  r   r
   r   r  r+   r  )r8   r   r  s      r<   test_x_modezOpenTestCase.test_x_mode  s    '% 	D6N"%+w4H64(; ""?3 YYvt,  	   s0   B"2B:B.B:"B+	.B73B::C	N)r   r   r   r  r!  r#  r%  r+  r.  r0  r3  r6  r9  r#   rL   r<   r  r  /  s4    3>6	22	/958	rL   r  c                   $    e Zd Zd Zd Zd Zd Zy)MiscellaneousTestCasec                    | j                  t        j                  t        j                               | j                  t        j                  t        j                               | j                  t        j                  t        j                  dz                | j                  t        j                  t        j                               y r   )rW   r   is_check_supportedr^   r-  rS   r,  r+  rF   s    r<   test_is_check_supportedz-MiscellaneousTestCase.test_is_check_supported  s     	//@A//0@0@AB 	001B1BQ1FGH 	001C1CDErL   c                    | j                  t              5  t        j                  d       d d d        | j                  t              5  t        j                  ddi       d d d        | j                  t              5  t        j                  t        j
                  dd       d d d        | j                  t        j                        5  t        j                  t        j                  dd       d d d        t        j                  t        j                  dd	d
dd      }| j                  |d       y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   jxY w)Ns
   not a dictr!      r~  )r!   junkr  r!   distr   r   r      )r!   pblplc	dict_size   ]   )
r+   r,   r   _encode_filter_propertiesr-   r/   r   rD   FILTER_LZMA1rU   )r8   propss     r<   test__encode_filter_propertiesz4MiscellaneousTestCase.test__encode_filter_properties  s,   y) 	:**=9	:z* 	:**D%=9	:z* 	R**$2C2CR+PQ	Rt~~. 	:**$2C2C37,9 :	:
 ..''$0  	 45%	: 	:	: 	:	R 	R	: 	:s/   D7	E>'E'E7EEEE%c                    | j                  t              5  t        j                  t        j                  dt
        i       d d d        | j                  t        j                        5  t        j                  t        j                  d       d d d        t        j                  t        j                  d      }| j                  |d   t        j                         | j                  |d   d       | j                  |d   d       | j                  |d	   d
       | j                  |d   d       t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  g}|D ],  }t        j                  |d      }| j                  |d|i       . y # 1 sw Y   xY w# 1 sw Y   @xY w)Nz	should bes   too longrI  r!   rE  r   rF  r   rG  r   rH  rD  rL   )r+   r,   r   _decode_filter_propertiesrE   r   r   rD   rK  rU   FILTER_POWERPCFILTER_IA64
FILTER_ARMFILTER_ARMTHUMBFILTER_SPARC)r8   
filterspecr   r  s       r<   test__decode_filter_propertiesz4MiscellaneousTestCase.test__decode_filter_properties  s   y) 	R**4??[%<PQ	Rt~~. 	K**4+<+<kJ	K 33!!#79
D)4+<+<=D)1-D)1-D)1-K0': ??D$7$7##T__''):):<  	4A773?JZ$3	4%	R 	R	K 	Ks   +F>(%G>GGc                     t         j                  t         j                  d      }t         j                  |      }t         j                  t         j                  |      }| j	                  ||       y )NrI  )r   rO  rK  rJ  rU   )r8   spec1	reencodedspec2s       r<    test_filter_properties_roundtripz6MiscellaneousTestCase.test_filter_properties_roundtrip  sV    ..!!#792259	..t/@/@)L&rL   N)r   r   r   r>  rM  rV  r[  r#   rL   r<   r;  r;    s    
F6*4.'rL   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.
s   this is not a valid lzma streams   7zXZ  ִF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܄(dOD64,SJc^0	D[憰n^븸)a @+/h3`+P-Bn^/w<M!EY<٦Bǃ"D|&d`70o喤v;]'hA&9~@t<4)=:&6A+ <k\dv^l5C?ԠMCȀ3BPjyzE[oT'*HM7f;'wM 帷 D+PgnkcƐVUovfZ3^翬vxJjn*o>_+D{sHAGݭ7q+Wg"X~4`q)KsV5s*;{<@GjLؒ&	u5]\A|ICeQ*~uXyP
fZEu>'`cZ8jUoe>Rb#H-!ޝkw{/K)A:UM̻{9 ((6iu؞q7-BQ8vACd!'ͮؓިb2K l	|DU>w7}W|g|1 m@6+	D Mҵ'~Co	fI1φ`͂wcdCUEMJH=*I"^S6=@,Gr[>n<(}~4stff	/)
ײwQnsƷ(G<6[~H ~:e(_(c̟gvS=S>
YRGAOdcPܟ"[Q~䈡#CϾHؾmWFQ(XDKB.-՞|N]Z=)MLTiN?4O&u70ؓBNEyϘDʚL_]ܩ1 cؿp-N(#2Ilr __main__)7rb  r  ior   r   r   ro  r   r   r   testr   unittesttest.supportr   r   test.support.import_helperr	   test.support.os_helperr
   r   r   r   r   r   r   r   TestCaser   r   r   r  r  r;  rV   r   rI   rO   r/   r1   rf   rD   PRESET_DEFAULTPRESET_EXTREMErj   rk   rQ  rn   ro   rE   rr   rs   r  r   mainr#   rL   r<   <module>ri     s     A A 	   
   ( 4  V F Fk3X%6%6 k3\D+):): D+N S/8$$ S/lu8$$ up?'H-- ?'H>	@ 6 +4 `(" X ))Q78* \ ))15)) //$2E2EEGH:& | ((%@))*,) Z ))15>))Qa@B? HA% L zHMMO rL   