o
    Û­j)]  ã                   @   s*  d Z ddlZddlZddlmZ ddlmZmZmZ ddl	Z	ddl
Z
ddlmZ ddlZddlZddlZddlZddlmZ ddlmZ ddlm  mZ ddlZddlmZ ddlm  m Z! ej" #d¡Z$G d	d
„ d
ƒZ%e&e%egZ'zddl(m)Z* e' +e*¡ W n	 e,yˆ   Y nw e
j- .e
j- /e0¡¡Z1G dd„ dƒZ2ej3dd„ ƒZ4G dd„ dƒZ5dd„ Z6ej" 7dddg¡dd„ ƒZ8dd„ Z9ej" 7deddfeddfg¡d d!„ ƒZ:ej" 7d"g d#¢¡ej" 7dddg¡d$d%„ ƒƒZ;d&d'„ Z<d(d)„ Z=d*d+„ Z>d,d-„ Z?ej" 7d.ej@ejAejBejCejDejEejFejGejHg	¡d/d0„ ƒZIdS )1z0
Tests for the pandas.io.common functionalities
é    N)Úpartial)ÚBytesIOÚStringIOÚUnsupportedOperation)ÚPath)Úis_platform_windows)Úpa_version_under19p0z=ignore:Passing a BlockManager to DataFrame:DeprecationWarningc                   @   s"   e Zd ZdZddd„Zdd„ ZdS )	ÚCustomFSPathz%For testing fspath on unknown objectsÚreturnNc                 C   s
   || _ d S ©N©Úpath)Úselfr   © r   úX/var/www/html/CropPilot/venv/lib/python3.10/site-packages/pandas/tests/io/test_common.pyÚ__init__&   s   
zCustomFSPath.__init__c                 C   s   | j S r   r   ©r   r   r   r   Ú
__fspath__)   s   zCustomFSPath.__fspath__)r
   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r	   #   s    
r	   )Úlocalc                   @   s,  e Zd ZdZdd„ Zdd„ Zdd„ Ze d¡d	d
„ ƒZ	dd„ Z
dd„ Zej de¡dd„ ƒZej deeeg¡dd„ ƒZdd„ Zdd„ Zdd„ Zdd„ Zej dejdedfejdedfejd ed!fejd"ed#fej d$ed%fej!ded&fej"ded'fej#ded(fej$ded)fg	¡d*d+„ ƒZ%ej d,ej&j'dedfej&j(ded-fej&j)d ed!fej&j*d"ed#fej&j+d"ed.fej&j,ded&fej&j-ded(fej&j.ded)fg¡d/d0„ ƒZ/ej dejdedfej0dedfejdedfejd ed!fejd"ed#fej d$ed%fej!ded&fej"ded'fej#ded(fej$ded)fg
¡d1d2„ ƒZ1ej d3ejdd4fej0dd4fejdd5fejd d6fejd"d7fej2ej d$d8ejj3d9d:d;�d<�ej!dd=fej"dd>fej#dd?fej$dd@fg
¡dAdB„ ƒZ4ej dCdDi dfdEdFdGidGfdHi d"fdIi dfdJi dfdKi dfdLi dfdMdNe 5dO¡idfg¡dPdQ„ ƒZ6dRdS„ Z7dTS )UÚTestCommonIOCapabilitiesziindex,A,B,C,D
foo,2,3,4,5
bar,7,8,9,10
baz,12,13,14,15
qux,12,13,14,15
foo2,12,13,14,15
bar2,12,13,14,15
c                 C   sB   d}t  |¡}||ksJ ‚tj |¡sJ ‚tj |¡|ksJ ‚d S )Nz
~/sometest)ÚicomÚ_expand_userÚosr   ÚisabsÚ
expanduser©r   ÚfilenameÚexpanded_namer   r   r   Útest_expand_userE   s
   
z)TestCommonIOCapabilities.test_expand_userc                 C   s2   d}t  |¡}||ksJ ‚tj |¡|ksJ ‚d S )Nz/somefolder/sometest)r   r   r   r   r   r   r   r   r   Útest_expand_user_normal_pathM   s   
z5TestCommonIOCapabilities.test_expand_user_normal_pathc                 C   sB   t  tdƒ¡}|dksJ ‚t  tdƒ¡}|tj dd¡ksJ ‚d S )NÚ.zfoo//barÚfooÚbar)r   Ústringify_pathr   r   r   Újoin)r   Úrel_pathÚredundant_pathr   r   r   Útest_stringify_path_pathlibT   s   z4TestCommonIOCapabilities.test_stringify_path_pathlibzpy.pathc                 C   s8   t j dd¡}t j |¡}t|ƒ}t |¡|ksJ ‚d S )Nr%   r&   )r   r   r(   ÚabspathÚ	LocalPathr   r'   )r   r   Úabs_pathÚlpathr   r   r   Útest_stringify_path_localpathZ   s   z6TestCommonIOCapabilities.test_stringify_path_localpathc                 C   s"   t dƒ}t |¡}|dksJ ‚d S )Núfoo/bar.csv)r	   r   r'   )r   ÚpÚresultr   r   r   Útest_stringify_path_fspatha   s   
z3TestCommonIOCapabilities.test_stringify_path_fspathc              	   C   sŽ   t  d¡}t ¡ �4}|jd|› �dd��}|t |¡ksJ ‚W d   ƒ n1 s(w   Y  W d   ƒ d S W d   ƒ d S 1 s@w   Y  d S )NÚfsspeczfile://Úwb©Úmode)ÚpytestÚimportorskipÚtmÚensure_cleanÚopenr   r'   )r   r5   r   Ú
fsspec_objr   r   r   Ú!test_stringify_file_and_path_likef   s   

ÿÿ"ÿz:TestCommonIOCapabilities.test_stringify_file_and_path_likeÚ	path_typec                 C   s2   |\}}|d| ƒ}t j|dd�}||ksJ ‚d S )Nr1   Úinfer)Úcompression)r   Úinfer_compression)r   Úcompression_formatr@   Ú	extensionÚexpectedr   rB   r   r   r   Ú test_infer_compression_from_pathm   s   z9TestCommonIOCapabilities.test_infer_compression_from_pathc              	   C   s´   t jt ¡ d��H}|dt|ƒj d ƒ}t |d¡�}t|jjƒ ¡ s%J ‚t	j
 |¡|jjks1J ‚W d   ƒ n1 s;w   Y  W d   ƒ d S W d   ƒ d S 1 sSw   Y  d S )N)Údirz~/z	/sometestÚw)ÚtempfileÚTemporaryDirectoryr   ÚhomeÚnamer   Ú
get_handleÚhandleÚis_absoluter   r   r   )r   r@   Útmpr    Úhandlesr   r   r   Útest_get_handle_with_patht   s   þþ"þz2TestCommonIOCapabilities.test_get_handle_with_pathc              	   C   sx   t ƒ �*}t |d¡�}|j|ksJ ‚W d   ƒ n1 sw   Y  |jr&J ‚W d   ƒ n1 s0w   Y  |js:J ‚d S )NÚr)r   r   rN   rO   Úclosed)r   Úinput_bufferrR   r   r   r   Útest_get_handle_with_buffer}   s   ÿýz4TestCommonIOCapabilities.test_get_handle_with_bufferc                 C   s¬   d}t jt|ƒddd��@}d}d}	 |j |¡}t|ƒ|ks J ‚t|ƒ|k r6t|j ¡ ƒdks1J ‚||7 }n||7 }q|| d	¡ksDJ ‚W d   ƒ d S 1 sOw   Y  d S )
Nõ&   a,b,c
1,2,3
Â©,Â®,Â®
Look,a snake,ðŸ��ÚrbF©Úis_textó    é   Tr   úutf-8)r   rN   r   rO   ÚreadÚlenÚencode)r   ÚdatarR   r3   Ú	chunksizeÚchunkr   r   r   Ú)test_bytesiowrapper_returns_correct_bytes…   s   ö"òzBTestCommonIOCapabilities.test_bytesiowrapper_returns_correct_bytesc                 C   sž   t  d¡}d}t g d¢g d¢g d¢dœ¡}t|ƒ}tj|ddd	��#}| |j¡ 	¡ }t
r2| d
¡}t ||¡ |jr=J ‚W d   ƒ d S 1 sHw   Y  d S )Nzpyarrow.csvrX   )Ú1õ   Â©ÚLook)Ú2õ   Â®za snake)Ú3rj   u   ðŸ��©ÚaÚbÚcrY   FrZ   Úobject)r9   r:   ÚpdÚ	DataFramer   r   rN   Úread_csvrO   Ú	to_pandasr   Úastyper;   Úassert_frame_equalrU   )r   Úpa_csvrb   rF   ÚsrR   Údfr   r   r   Útest_get_handle_pyarrow_compatœ   s   
ÿ
"ûz7TestCommonIOCapabilities.test_get_handle_pyarrow_compatc                 C   sÐ   t jt| jƒdd��}t j|dd�}W d   ƒ n1 sw   Y  t  t| jƒ¡}t ||¡ t jt| jƒdd��%}t|ƒ}t ||jdg ¡ t t  |¡|jdd … ¡ W d   ƒ d S 1 saw   Y  d S )Né   )rc   T)Úignore_indexr   )	rq   rs   r   Údata1Úconcatr;   rv   ÚnextÚiloc)r   Úreaderr3   rF   ÚitÚfirstr   r   r   Útest_iterator¯   s   ÿ"ýz&TestCommonIOCapabilities.test_iteratorz#reader, module, error_class, fn_extr   ÚcsvÚtxtÚxlrdÚxlsxÚpyarrowÚfeatherÚtablesÚh5ÚdtaÚsas7bdatÚjsonÚpicklec                 C   sà   t  |¡ tj tdd| ¡}d|› d�}d|› d�}d}d}	d	|› d
|› d�}
d|› d�}d|› d�}d|› �}t j|d|› d|› d|› d|	› d|
› d|› d|› d|› d�d�� ||ƒ W d   ƒ d S 1 siw   Y  d S )Nrb   údoes_not_exist.úFile (b')?.+does_not_exist\.ú'? does not existú:\[Errno 2\] No such file or directory: '.+does_not_exist\.ú'zExpected object or valueú7path_or_buf needs to be a string file path or file-likeú#\[Errno 2\] File .+does_not_exist\.ú$ does not exist: '.+does_not_exist\.õ<   \[Errno 2\] æ²¡æœ‰é‚£ä¸ªæ–‡ä»¶æˆ–ç›®å½•: '.+does_not_exist\.ú?\[Errno 2\] File o directory non esistente: '.+does_not_exist\.ú+Failed to open local file.+does_not_exist\.ú(ú|ú)©Úmatch)r9   r:   r   r   r(   ÚHEREÚraises)r   r�   ÚmoduleÚerror_classÚfn_extr   Úmsg1Úmsg2Úmsg3Úmsg4Úmsg5Úmsg6Úmsg7Úmsg8r   r   r   Útest_read_non_existent»   s(   
ÿÿ
ÿ
4þ
"üz/TestCommonIOCapabilities.test_read_non_existentz#method, module, error_class, fn_extÚhtmlÚparquetc                 C   s|   t  |¡ t g d¢g d¢g d¢dœ¡}tj tddd| ¡}t j|dd	�� |||ƒ W d   ƒ d S 1 s7w   Y  d S )
N)r{   é   é   )r±   r²   é   )r²   r³   r]   rl   rb   Úmissing_folderr‘   z@Cannot save file into a non-existent directory: .*missing_folderrŸ   )	r9   r:   rq   rr   r   r   r(   r¡   r¢   )r   Úmethodr£   r¤   r¥   Údummy_framer   r   r   r   Ú#test_write_missing_parent_directoryá   s   
þ"üz<TestCommonIOCapabilities.test_write_missing_parent_directoryc                 C   sð   t  |¡ tj dd| ¡}| tddd„ ¡ d|› d�}d|› d	�}d
}	d}
d|› d|› d	�}d|› d	�}d|› d	�}d|› �}t j|d|› d|› d|	› d|
› d|› d|› d|› d|› d�d�� ||ƒ W d   ƒ d S 1 sqw   Y  d S )Nú~r‘   r   c                 S   s   t j d| ¡S )Nr%   )r   r   r(   )Úxr   r   r   Ú<lambda>  s    zJTestCommonIOCapabilities.test_read_expands_user_home_dir.<locals>.<lambda>r’   r“   r”   r•   z0Unexpected character found when decoding 'false'r–   r—   r˜   r™   rš   r›   rœ   r�   rž   rŸ   )r9   r:   r   r   r(   Úsetattrr   r¢   )r   r�   r£   r¤   r¥   Úmonkeypatchr   r¦   r§   r¨   r©   rª   r«   r¬   r­   r   r   r   Útest_read_expands_user_home_dirü   s*   
ÿÿ
ÿ
4þ
"üz8TestCommonIOCapabilities.test_read_expands_user_home_dirzreader, module, path)Úiorb   r…   ziris.csv)r¾   rb   Úfixed_widthzfixed_width_format.txt)r¾   rb   Úexcelz
test1.xlsx)r¾   rb   rŠ   zfeather-0_3_1.feather)r¾   rb   Ú
legacy_hdfzdatetimetz_object.h5zTODO(infer_string)F)ÚreasonÚstrict)Úmarks)r¾   rb   Ústatazstata10_115.dta)r¾   Úsasrb   ztest1.sas7bdat)r¾   r�   rb   ztsframe_v012.json)r¾   rb   r�   zcategorical.0.25.0.picklec                 C   sT   t  |¡ ||Ž }t|ƒ}||ƒ}||ƒ}| d¡r"t ||¡ d S t ||¡ d S )Nz.pickle)r9   r:   r	   Úendswithr;   Úassert_categorical_equalrv   )r   r�   r£   r   ÚdatapathÚmypathr3   rF   r   r   r   Útest_read_fspath_all'  s   
"
z-TestCommonIOCapabilities.test_read_fspath_allz"writer_name, writer_kwargs, moduleÚto_csvÚto_excelÚengineÚopenpyxlÚ
to_featherÚto_htmlÚto_jsonÚto_latexÚ	to_pickleÚto_stataÚ
time_stampz2019-01-01 00:00c                 C   s|  |dv r	t  d¡ t d¡}t d¡}t dddgi¡}|�–}|�{}t  |¡ t|ƒ}	t||ƒ}
|
|fi |¤Ž |
|	fi |¤Ž t|dƒ�H}t|dƒ�3}|d	kritj	|fi |¤Ž}tj	|fi |¤Ž}t 
||¡ n| ¡ }| ¡ }||kswJ ‚W d   ƒ n1 s�w   Y  W d   ƒ n1 s�w   Y  W d   ƒ n1 sŸw   Y  W d   ƒ d S W d   ƒ d S 1 s·w   Y  d S )
N)rÓ   Újinja2ÚstringÚfspathÚAr{   r±   rY   rÍ   )r9   r:   r;   r<   rq   rr   r	   Úgetattrr=   Ú
read_excelrv   r_   )r   Úwriter_nameÚwriter_kwargsr£   Úp1Úp2ry   rØ   rÙ   rÊ   ÚwriterÚf_strÚf_pathr3   rF   r   r   r   Útest_write_fspath_allV  s2   




€ö€ €Pùz.TestCommonIOCapabilities.test_write_fspath_allc           	   	   C   sÈ   t  d¡ t dddgi¡}t d¡}t d¡}|�:}|�(}t|ƒ}|j|dd� |j|dd� tj|dd�}tj|dd�}W d   ƒ n1 sHw   Y  W d   ƒ n1 sWw   Y  t 	||¡ d S )	Nr‹   rÚ   r{   r±   rØ   rÙ   r&   )Úkey)
r9   r:   rq   rr   r;   r<   r	   Úto_hdfÚread_hdfrv   )	r   ry   rß   rà   rØ   rÙ   rÊ   r3   rF   r   r   r   Útest_write_fspath_hdf5}  s   


ú€ z/TestCommonIOCapabilities.test_write_fspath_hdf5N)8r   r   r   r}   r"   r#   r+   ÚtdÚ
skip_if_nor0   r4   r?   r9   ÚmarkÚparametrizeÚ
path_typesrG   Ústrr	   r   rS   rW   re   rz   r„   rq   rs   ÚFileNotFoundErrorÚread_fwfrÜ   Úread_featherÚOSErrorrç   Ú
read_stataÚread_sasÚ	read_jsonÚread_pickler®   rr   rÌ   rÑ   rÍ   rÐ   Ú
to_parquetrÕ   rÒ   rÔ   r·   Ú
read_tabler½   ÚparamÚxfailrË   Úto_datetimerä   rè   r   r   r   r   r   ;   sÌ    	


÷þ
øþ
öþ


ý
ýû


ýèþ
!øþ
r   c                 C   s   | ddddƒS )Nr¾   rb   r…   ztest_mmap.csvr   )rÉ   r   r   r   Ú	mmap_file’  s   rü   c                   @   sX   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zej 	d	d
dg¡ej 	dddg¡dd„ ƒƒZ
dS )ÚTestMMapWrapperc                 C   sÖ   t dƒ}dd„ |_tƒ rd}t}nd}tj}tj||d�� t 	|d¡ W d   ƒ n1 s.w   Y  t
|dd	��}W d   ƒ n1 sDw   Y  d
}tjt|d�� t 	|d¡ W d   ƒ d S 1 sdw   Y  d S )NzI am not a filec                   S   s   dS )Néÿÿÿÿr   r   r   r   r   rº   š  s    z;TestMMapWrapper.test_constructor_bad_file.<locals>.<lambda>zThe parameter is incorrectz
[Errno 22]rŸ   Tr^   ©ÚencodingzI/O operation on closed file)r   Úfilenor   rò   ÚmmapÚerrorr9   r¢   r   Ú_maybe_memory_mapr=   Ú
ValueError)r   rü   Únon_fileÚmsgÚerrÚtargetr   r   r   Útest_constructor_bad_file˜  s"   
ÿÿ"ÿz)TestMMapWrapper.test_constructor_bad_filec              
   C   sò   t |dd��i}| ¡ }tj|dddd��C}|j}t|jjtjƒs"J ‚|D ]}t|ƒ}| 	¡ | 	¡ ks4J ‚q$t
jtdd�� t|ƒ W d   ƒ n1 sKw   Y  W d   ƒ n1 sZw   Y  W d   ƒ d S W d   ƒ d S 1 srw   Y  d S )Nr^   rÿ   rT   T)r[   Ú
memory_mapz^$rŸ   )r=   Ú	readlinesr   rN   rO   Ú
isinstanceÚbufferr  r   Ústripr9   r¢   ÚStopIteration)r   rü   r	  ÚlinesÚwrappersÚwrapperÚlineÚ	next_liner   r   r   Ú	test_next®  s&   ÿ
ÿ€öý"ýzTestMMapWrapper.test_nextc              	   C   sÂ   t  ¡ �S}tjdt d¡ d¡ t tdƒ¡t dd„ t	dƒD ƒ¡d�}| 
|¡ tjtd	d
�� tj|dd� W d   ƒ n1 sBw   Y  W d   ƒ d S W d   ƒ d S 1 sZw   Y  d S )Nçš™™™™™ñ?éx   ©é   r³   ÚABCDc                 S   ó   g | ]}d |› �‘qS ©zi-r   ©Ú.0Úir   r   r   Ú
<listcomp>Ä  ó    z7TestMMapWrapper.test_unknown_engine.<locals>.<listcomp>r  ©ÚcolumnsÚindexzUnknown enginerŸ   Úpyt)rÎ   )r;   r<   rq   rr   ÚnpÚarangeÚreshapeÚIndexÚlistÚrangerÌ   r9   r¢   r  rs   ©r   r   ry   r   r   r   Útest_unknown_engine¿  s   
ý
ÿù"ùz#TestMMapWrapper.test_unknown_enginec              	   C   s�   t  ¡ �:}tjdt d¡ d¡ t tdƒ¡t dd„ t	dƒD ƒ¡d�}|j
|d	d
� t  |tj|dd�¡ W d  ƒ dS 1 sAw   Y  dS )z\
        'encoding' shouldn't be passed to 'open' in binary mode.

        GH 35058
        r  r  r  r  c                 S   r  r  r   r  r   r   r   r!  Ô  r"  z4TestMMapWrapper.test_binary_mode.<locals>.<listcomp>r  r#  zw+br7   r   ©Ú	index_colN)r;   r<   rq   rr   r'  r(  r)  r*  r+  r,  rÌ   rv   rs   r-  r   r   r   Útest_binary_modeÊ  s   
ý"ùz TestMMapWrapper.test_binary_moder   zutf-16zutf-32Úcompression_Úbz2Úxzc              	   C   sø   t jdt d¡ d¡ t  tdƒ¡t  dd„ tdƒD ƒ¡d�}t 	¡ �O}t 
t¡� |j|||d	� W d
  ƒ n1 s<w   Y  d}tjt|d�� t j|||d	� W d
  ƒ n1 s]w   Y  W d
  ƒ d
S W d
  ƒ d
S 1 suw   Y  d
S )zš
        bz2 and xz do not write the byte order mark (BOM) for utf-16/32.

        https://stackoverflow.com/questions/55171439

        GH 35681
        r  r  r  r  c                 S   r  r  r   r  r   r   r   r!  æ  r"  z@TestMMapWrapper.test_warning_missing_utf_bom.<locals>.<listcomp>r  r#  )rB   r   NzHUTF-\d+ stream does not start with BOM|'utf-\d+' codec can't decode byterŸ   )rq   rr   r'  r(  r)  r*  r+  r,  r;   r<   Úassert_produces_warningÚUnicodeWarningrÌ   r9   r¢   ÚUnicodeErrorrs   )r   r   r2  ry   r   r  r   r   r   Útest_warning_missing_utf_bomÙ  s"   
ý
ÿÿÿ÷	"÷z,TestMMapWrapper.test_warning_missing_utf_bomN)r   r   r   r
  r  r.  r1  r9   rë   rì   r8  r   r   r   r   rý   —  s    rý   c                   C   s‚   t  d¡sJ ‚t  d¡sJ ‚t  d¡rJ ‚t  d¡rJ ‚t  d¡r#J ‚t  d¡r*J ‚t  d¡r1J ‚t  d¡r8J ‚t  d	¡s?J ‚d S )
Nzgcs://pandas/somethingelse.comzgs://pandas/somethingelse.comzhttp://pandas/somethingelse.comzrandom:pandas/somethingelse.comz/local/pathzrelative/local/pathzthis is not fsspec://urlz({'url': 'gs://pandas/somethingelse.com'}z#RFC-3986+compliant.spec://something)r   Úis_fsspec_urlr   r   r   r   Útest_is_fsspec_urlõ  s   r:  Úformatr…   r�   c              	   C   s  t jdt d¡ d¡ t  tdƒ¡t  dd„ tdƒD ƒ¡d�}t 	¡ �P}t
|d	d
d��}t|d| › �ƒ|ƒ W d   ƒ n1 s@w   Y  t
|d
d��}| dkrXt j|dd�}nt  |¡}W d   ƒ n1 sgw   Y  W d   ƒ n1 svw   Y  t ||¡ d S )Nr  r  r  r  c                 S   r  r  r   r  r   r   r   r!  
  r"  z(test_codecs_encoding.<locals>.<listcomp>r  r#  rI   r^   )r8   r   Úto_rÿ   r…   r   r/  )rq   rr   r'  r(  r)  r*  r+  r,  r;   r<   r=   rÛ   rs   rõ   rv   )r;  rF   r   rO   ry   r   r   r   Útest_codecs_encoding  s$   ý
ÿ
€ü€ýr=  c               
   C   s>  t jdt d¡ d¡ t  tdƒ¡t  dd„ tdƒD ƒ¡d�} t 	¡ �l}t
|d	ƒ�$}t d
¡|ƒ�}|  |¡ W d   ƒ n1 sAw   Y  W d   ƒ n1 sPw   Y  t
|dƒ�&}t d
¡|ƒ�}t j|dd�}W d   ƒ n1 stw   Y  W d   ƒ n1 sƒw   Y  W d   ƒ n1 s’w   Y  t | |¡ d S )Nr  r  r  r  c                 S   r  r  r   r  r   r   r   r!    r"  z1test_codecs_get_writer_reader.<locals>.<listcomp>r  r#  r6   r^   rY   r   r/  )rq   rr   r'  r(  r)  r*  r+  r,  r;   r<   r=   ÚcodecsÚ	getwriterrÌ   Ú	getreaderrs   rv   )rF   r   rO   Úencodedry   r   r   r   Útest_codecs_get_writer_reader  s*   ý
ÿ€ÿÿ€ÿ€ürB  zio_class,mode,msgÚtz*a bytes-like object is required, not 'str'rn   z%string argument expected, got 'bytes'c              	   C   s¼   t jdt d¡ d¡ t  tdƒ¡t  dd„ tdƒD ƒ¡d�}| ƒ �2}tj	t
|d	�� |j|d
|› �d� W d   ƒ n1 s?w   Y  W d   ƒ d S W d   ƒ d S 1 sWw   Y  d S )Nr  r  r  r  c                 S   r  r  r   r  r   r   r   r!  6  r"  z*test_explicit_encoding.<locals>.<listcomp>r  r#  rŸ   rI   r7   )rq   rr   r'  r(  r)  r*  r+  r,  r9   r¢   Ú	TypeErrorrÌ   )Úio_classr8   r  rF   r  r   r   r   Útest_explicit_encoding(  s   ýÿÿ"ÿrF  Úencoding_errors)NrÃ   Úreplacec              	   C   s<  d}d}|dkrd| d |d  d | }t tjdd�}nd	|d  d
 | d | d }t tjdd�}t ¡ �[}t|ƒ}| |¡ | dkretj	t
|d�� ||| d� W d   ƒ n1 s_w   Y  n'||| d�}|j| d�}	tj|	|	gi|	d gd�}
t ||
¡ W d   ƒ d S W d   ƒ d S 1 s—w   Y  d S )Nz'utf-8' codec can't decode byteó   är…   ó   ,ó   
r±   r   r/  s   {"s   ": {"s   ":"s   "}}r%  )ÚorientrH  rŸ   )rG  ©Úerrors)r%  )r   rq   rs   rõ   r;   r<   r   Úwrite_bytesr9   r¢   ÚUnicodeDecodeErrorÚdecoderr   rv   )rG  r;  r  Úbad_encodingÚcontentr�   r   Úfilery   ÚdecodedrF   r   r   r   Útest_encoding_errors=  sF   ÿþýüûúÿ	

ÿ€õ€" rV  c               	   C   s|   t  ¡ �0} tjtdd�� tj| ddd� W d   ƒ n1 sw   Y  W d   ƒ d S W d   ƒ d S 1 s7w   Y  d S )Nzunknown error handler namerŸ   rI   ÚbadrM  )r;   r<   r9   r¢   ÚLookupErrorr   rN   r   r   r   r   Útest_bad_encdoing_errors`  s   
ÿÿ"ÿrY  c                  C   sN   t jtdd��} t d¡ | jtjksJ ‚W d   ƒ d S 1 s w   Y  d S )Nz\[Errno 2\]rŸ   Údoesnt_exist)r9   r¢   rï   rq   rs   ÚerrnoÚENOENT)r  r   r   r   Útest_errno_attributeg  s   
"þr]  c               	   C   sz   t jtdd��, tƒ �} tj| ddd� W d   ƒ n1 sw   Y  W d   ƒ d S W d   ƒ d S 1 s6w   Y  d S )Nr  rŸ   rY   T)r  )r9   r¢   r   r   r   rN   )r  r   r   r   Útest_fail_mmapn  s   ÿÿ"ÿr^  c               
   C   s²   G dd„ dƒ} t jtdd��A tƒ �%}t |d¡�}|j | ƒ ¡ W d   ƒ n1 s+w   Y  W d   ƒ n1 s:w   Y  W d   ƒ d S W d   ƒ d S 1 sRw   Y  d S )Nc                   @   s   e Zd Zdd„ ZdS )z&test_close_on_error.<locals>.TestErrorc                 S   s   t dƒ‚)NÚtest)rò   r   r   r   r   Úclosew  s   z,test_close_on_error.<locals>.TestError.closeN)r   r   r   r`  r   r   r   r   Ú	TestErrorv  s    ra  r_  rŸ   rY   )r9   r¢   rò   r   r   rN   Úcreated_handlesÚappend)ra  r  rR   r   r   r   Útest_close_on_errort  s   ÿ€ÿÿ"ÿrd  r�   c                 C   s8   t ƒ �}t | |¡ W d   ƒ d S 1 sw   Y  d S r   )r   r�   Údump)r�   r  r   r   r   Útest_pickle_reader€  s   "ÿrf  )Jr   r>  r[  Ú	functoolsr   r¾   r   r   r   r  r   Úpathlibr   r�   rJ   Únumpyr'  r9   Úpandas.compatr   Úpandas.compat.pyarrowr   Úpandas.util._test_decoratorsÚutilÚ_test_decoratorsré   Úpandasrq   Úpandas._testingÚ_testingr;   Úpandas.io.commonÚcommonr   rë   ÚfilterwarningsÚ
pytestmarkr	   rî   rí   Úpy.pathr   r-   rc  ÚImportErrorr   r,   ÚdirnameÚ__file__r¡   r   Úfixturerü   rý   r:  rì   r=  rB  rF  rV  rY  r]  r^  rd  rs   rð   rÜ   rñ   rç   ró   rô   rõ   rö   rf  r   r   r   r   Ú<module>   sˆ    ÿ
ÿ  Y
^
þþ
!÷þ