a
    é´«jÍÜ  ã                   @   s^  d dl mZ d dlmZ d dlmZmZ d dlZd dl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mZ d dlm  mZ d dlZd dlmZmZmZmZmZmZmZm Z m!Z! d dl"m#Z$ d d	l%m&Z& ej'g d
¢d�dd„ ƒZ(dd„ Z)dd„ Z*dd„ Z+dd„ Z,ej'ej-de .d¡e .d¡gd�ej-de .d¡d�gd�dd„ ƒZ/G dd„ dƒZ0dS )é    )ÚIterator)Úpartial)ÚBytesIOÚStringION)ÚPath)ÚURLError)Úis_platform_windows)	ÚNAÚ	DataFrameÚ
MultiIndexÚSeriesÚ	TimestampÚ
date_rangeÚread_csvÚ	read_htmlÚto_datetime)Úfile_path_to_url)zchinese_utf-16.htmlzchinese_utf-32.htmlzchinese_utf-8.htmlzletz_latin1.html)Úparamsc                 C   s   |ddd| j ƒS )z6Parametrized fixture for HTML encoding test filenames.ÚioÚdataZhtml_encoding)Úparam)ÚrequestÚdatapath© r   úX/var/www/html/laksyashrimp/venv/lib/python3.9/site-packages/pandas/tests/io/test_html.pyÚhtml_encoding_file$   s    
r   c                 O   s�   t | ƒt |ƒks,J dt | ƒ› dt |ƒ› �ƒ‚d}ttdd„ | |ƒƒ}|sPJ |ƒ‚t| |ƒD ]0\}}tj||g|¢R i |¤Ž |jrZJ dƒ‚qZd S )Nz*lists are not of equal size len(list1) == z, len(list2) == z$not all list elements are DataFramesc                 S   s   t | tƒot |tƒS ©N©Ú
isinstancer
   )ÚxÚyr   r   r   Ú<lambda>:   ó    z(assert_framelist_equal.<locals>.<lambda>zframes are both empty)ÚlenÚallÚmapÚzipÚtmÚassert_frame_equalÚempty)Zlist1Zlist2ÚargsÚkwargsÚmsgZboth_framesZframe_iZframe_jr   r   r   Úassert_framelist_equal1   s&    ÿþÿýÿr-   c                 C   sj   t  d¡}t  d¡ |  |dd¡ t jtdd��& t|ddd	d
ƒdd� W d   ƒ n1 s\0    Y  d S )NÚbs4Úhtml5libÚ__version__z4.2zPandas requires version©Úmatchr   r   Úhtmlú	spam.html©Úflavor)ÚpytestÚimportorskipÚsetattrÚraisesÚImportErrorr   )Zmonkeypatchr   r.   r   r   r   Útest_bs4_version_failsE   s
    

r<   c                  C   sX   d} d}d| d }t jt|d��" tt| ƒd|d� W d   ƒ n1 sJ0    Y  d S )Nz
google.comzinvalid flavorz\{z \} is not a valid set of flavorsr1   Zgoogle©r2   r6   )r7   r:   Ú
ValueErrorr   r   )Úurlr6   r,   r   r   r   Útest_invalid_flavorN   s
    r@   c                 C   sZ   t  d¡ t  d¡ t  d¡ | ddddƒ}t|ddgd	�}t|ddgd	�}t||ƒ d S )
Nr.   Úlxmlr/   r   r   r3   úvalid_markup.htmlr   )Ú	index_colr6   )r7   r8   r   r-   )r   ÚfilenameZdfs_lxmlZdfs_bs4r   r   r   Útest_same_orderingW   s    


rE   r.   r/   )ZmarksrA   c                 C   s   t t| jd�S )Nr5   )r   r   r   )r   r   r   r   Úflavor_read_htmlb   s    rF   c                   @   s8  e Zd Zdd„ Zejdd„ ƒZejdd„ ƒZdd„ Zd	d
„ Z	ej
jej
jdd„ ƒƒZej
jej
jdd„ ƒƒZej
jdd„ ƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Z d1d2„ Z!d3d4„ Z"d5d6„ Z#d7d8„ Z$ej
jej
jd9d:„ ƒƒZ%ej
jej
jej
jd;d<„ ƒƒƒZ&ej
jd=d>„ ƒZ'ej
jd?d@„ ƒZ(ej
jdAdB„ ƒZ)ej
jdCdD„ ƒZ*ej
jdEdF„ ƒZ+ej
jdGdH„ ƒZ,ej
jdIdJ„ ƒZ-ej
jdKdL„ ƒZ.ej
jdMdN„ ƒZ/dOdP„ Z0ejdQdR„ ƒZ1ej
jej
jdSdT„ ƒƒZ2ej
jej
jdUdV„ ƒƒZ3dWdX„ Z4dYdZ„ Z5d[d\„ Z6d]d^„ Z7d_d`„ Z8dadb„ Z9ej
jdcdd„ ƒZ:ej
jdedf„ ƒZ;dgdh„ Z<didj„ Z=dkdl„ Z>dmdn„ Z?dodp„ Z@dqdr„ ZAdsdt„ ZBdudv„ ZCdwdx„ ZDdydz„ ZEd{d|„ ZFd}d~„ ZGdd€„ ZHej
 Id�d‚dƒg¡d„d…„ ƒZJd†d‡„ ZKdˆd‰„ ZLdŠd‹„ ZMdŒd�„ ZNdŽd�„ ZOd�d‘„ ZPd’d“„ ZQej
jd”d•„ ƒZRd–d—„ ZSd˜d™„ ZTej
 Idšd‚eUd›gƒdœfdƒeUd�gƒeUd›gƒfg¡dždŸ„ ƒZVej
 Id d‚dƒg¡d¡d¢„ ƒZWeX Y¡ ej
 Zd£¡d¤d¥„ ƒƒZ[d¦d§„ Z\d¨d©„ Z]ej
jej
jdªd«„ ƒƒZ^d¬d­„ Z_d®d¯„ Z`ej
 Id�g d°¢¡d±d²„ ƒZad³d´„ Zbdµd¶„ Zcd·d¸„ Zdd¹dº„ ZedœS )»ÚTestReadHtmlc                 C   s>   d}t jt|d�� |dƒ W d   ƒ n1 s00    Y  d S )Nz™Passing literal html to 'read_html' is deprecated and will be removed in a future version. To read from a literal string, wrap it in a 'StringIO' object.r1   a  <table>
                <thead>
                    <tr>
                        <th>A</th>
                        <th>B</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>1</td>
                        <td>2</td>
                    </tr>
                </tbody>
                <tbody>
                    <tr>
                        <td>3</td>
                        <td>4</td>
                    </tr>
                </tbody>
            </table>)r'   Zassert_produces_warningÚFutureWarning)ÚselfrF   r,   r   r   r   Útest_literal_html_deprecationm   s    ÿÿz*TestReadHtml.test_literal_html_deprecationc                 C   s   |ddddƒS )Nr   r   r3   r4   r   ©rI   r   r   r   r   Ú	spam_data�   s    zTestReadHtml.spam_datac                 C   s   |ddddƒS )Nr   r   r3   úbanklist.htmlr   rK   r   r   r   Úbanklist_data‘   s    zTestReadHtml.banklist_datac                 C   sd   t tj d¡ d¡t tdƒ¡d� dj¡ 	t
¡}| ¡ }|t|ƒddidd	�d }t ||¡ d S )
Né   )é   é   Úabc©Úcolumnsz{:.3f}ÚclassZ	dataframer   )ÚattrsrC   )r
   ÚnpÚrandomÚdefault_rngÚpdÚIndexÚlistr%   ÚformatZastypeÚfloatÚto_htmlr   r'   r(   )rI   rF   ÚdfÚoutÚresr   r   r   Útest_to_html_compat•   s     þûûÿÿþz TestReadHtml.test_to_html_compatc                    s¬  t tdtjdgdd�tg d¢dd�tdtjdgdd�tg d	¢dd�g d
¢g d¢g d¢g d¢dœƒ}|jdd�}t d|¡�$ |t|ƒ|d�d }W d   ƒ n1 s¤0    Y  |dkrÐt 	d¡‰t 
ˆ ¡ ¡}n
t |¡}t tdtjdgdd�tg d¢dd�tdtjdgdd�tg d	¢dd�tddtgdd�tg d¢dd�tg d¢|d�tg d¢|d�dœƒ‰|dk�r˜dd l‰ddlm‰  t ‡ ‡‡fdd„ˆjD ƒƒ‰tj|ˆdd� d S )Né   rQ   ZInt64)Údtype)rd   rO   rQ   ç      ø?ç      @ZFloat64)rf   g       @rg   )TFN)TFT©ÚaÚbÚc)ri   rj   N)ri   rj   rk   ÚdÚeÚfÚgÚhF©Úindexzmode.string_storage©Údtype_backendr   ÚpyarrowTÚboolean)ÚArrowExtensionArrayc                    s$   i | ]}|ˆ ˆj ˆ| d d�ƒ“qS )T)Zfrom_pandas)Úarray)Ú.0Úcol©rw   ÚexpectedÚpar   r   Ú
<dictcomp>Ð   s   ÿz3TestReadHtml.test_dtype_backend.<locals>.<dictcomp>)Zcheck_column_type)r
   r   rW   Únanr_   rZ   Zoption_contextr   r7   r8   Z
ArrowDtypeÚstringZStringDtyper	   ru   Zpandas.arraysrw   rT   r'   r(   )rI   Zstring_storagert   rF   r`   ra   ÚresultZstring_dtyper   r{   r   Útest_dtype_backend¤   sL    øÿ2

øÿ
þÿ	zTestReadHtml.test_dtype_backendc                 C   sf   t |dd��<}|j| ¡ d� ||jdd�}||jdd�}W d   ƒ n1 sN0    Y  t||ƒ d S )Núutf-8©Úencoding©ÚcontentúFirst Federal Bank of Floridar1   úMetcalf Bank©ÚopenÚserve_contentÚreadr?   r-   )rI   Ú
httpserverrN   rF   rn   Údf1Údf2r   r   r   Útest_banklist_urlÚ   s    ýþ$zTestReadHtml.test_banklist_urlc                 C   sf   t |dd��<}|j| ¡ d� ||jdd�}||jdd�}W d   ƒ n1 sN0    Y  t||ƒ d S )Nrƒ   r„   r†   ú	.*Water.*r1   ÚUnitrŠ   )rI   rŽ   rL   rF   rn   r�   r�   r   r   r   Útest_spam_urlì   s
    ,zTestReadHtml.test_spam_urlc                 C   s2   ||dddid�}||dddid�}t ||ƒ d S )Nz.*Florida.*ÚidÚtable©r2   rV   r‰   ©r-   )rI   rN   rF   r�   r�   r   r   r   Útest_banklistö   s    
ÿ
ÿzTestReadHtml.test_banklistc                 C   sR   ||dd�}||dd�}t ||ƒ |d jd dks8J ‚|d jd dksNJ ‚d S )Nr’   r1   r“   r   ©r   r   Ú
ProximatesZNutrient)r-   ÚilocrT   ©rI   rL   rF   r�   r�   r   r   r   Ú	test_spam  s
    
zTestReadHtml.test_spamc                 C   s$   ||ƒ}|D ]}t |tƒsJ ‚qd S r   r   )rI   rL   rF   Údfsr`   r   r   r   Útest_spam_no_match	  s    zTestReadHtml.test_spam_no_matchc                 C   s,   ||ddid�}|D ]}t |tƒsJ ‚qd S )Nr•   r–   )rV   r   )rI   rN   rF   rŸ   r`   r   r   r   Útest_banklist_no_match  s    z#TestReadHtml.test_banklist_no_matchc                 C   s2   ||ddd�d }|j d dks$J ‚|jr.J ‚d S )Nr’   rO   ©r2   Úheaderr   r›   )rT   r)   )rI   rL   rF   r`   r   r   r   Útest_spam_header  s    zTestReadHtml.test_spam_headerc                 C   s*   ||ddd�}||ddd�}t ||ƒ d S ©Nr’   rd   ©r2   Úskiprowsr“   r˜   r�   r   r   r   Útest_skiprows_int  s    zTestReadHtml.test_skiprows_intc                 C   s2   ||dt dƒd�}||dt dƒd�}t||ƒ d S ©Nr’   rO   r¦   r“   )Úranger-   r�   r   r   r   Útest_skiprows_range  s    z TestReadHtml.test_skiprows_rangec                 C   s2   ||dddgd�}||dddgd�}t ||ƒ d S ©Nr’   rd   rO   r¦   r“   r˜   r�   r   r   r   Útest_skiprows_list$  s    zTestReadHtml.test_skiprows_listc                 C   s2   ||dddhd�}||dddhd�}t ||ƒ d S r¬   r˜   r�   r   r   r   Útest_skiprows_set*  s    zTestReadHtml.test_skiprows_setc                 C   s*   ||ddd�}||ddd�}t ||ƒ d S r¥   r˜   r�   r   r   r   Útest_skiprows_slice0  s    z TestReadHtml.test_skiprows_slicec                 C   s2   ||dt dƒd�}||dt dƒd�}t||ƒ d S r©   ©Úslicer-   r�   r   r   r   Útest_skiprows_slice_short6  s    z&TestReadHtml.test_skiprows_slice_shortc                 C   s8   ||dt ddƒd�}||dt dddƒd�}t||ƒ d S )	Nr’   rO   é   r¦   r“   rP   rd   éÿÿÿÿr°   r�   r   r   r   Útest_skiprows_slice_long<  s    z%TestReadHtml.test_skiprows_slice_longc                 C   s6   ||dt  d¡d�}||dt  d¡d�}t||ƒ d S r©   )rW   Zaranger-   r�   r   r   r   Útest_skiprows_ndarrayB  s    z"TestReadHtml.test_skiprows_ndarrayc                 C   s@   t jtdd�� ||ddd� W d   ƒ n1 s20    Y  d S )Nz%is not a valid type for skipping rowsr1   r’   Zasdfr¦   )r7   r:   Ú	TypeError)rI   rL   rF   r   r   r   Útest_skiprows_invalidH  s    z"TestReadHtml.test_skiprows_invalidc                 C   s*   ||ddd�}||ddd�}t ||ƒ d S ©Nr’   r   ©r2   rC   r“   r˜   r�   r   r   r   Ú
test_indexL  s    zTestReadHtml.test_indexc                 C   s.   ||dddd�}||dddd�}t ||ƒ d S ©Nr’   rd   r   )r2   r£   rC   r“   r˜   r�   r   r   r   Útest_header_and_index_no_typesQ  s    z+TestReadHtml.test_header_and_index_no_typesc                 C   s.   ||dddd�}||dddd�}t ||ƒ d S r¼   r˜   r�   r   r   r   Ú test_header_and_index_with_typesV  s    z-TestReadHtml.test_header_and_index_with_typesc                 C   s*   ||ddd�}||ddd�}t ||ƒ d S r¹   r˜   r�   r   r   r   Útest_infer_types[  s    zTestReadHtml.test_infer_typesc                 C   s–   t |dd��}t| ¡ ƒ}W d   ƒ n1 s.0    Y  t |dd��}t| ¡ ƒ}W d   ƒ n1 sf0    Y  ||dd�}||dd�}t||ƒ d S ©NzUTF-8r„   r’   r1   r“   )r‹   r   r�   r-   )rI   rL   rF   rn   Údata1Údata2r�   r�   r   r   r   Útest_string_ioa  s    **zTestReadHtml.test_string_ioc                 C   sb   t |dd��}| ¡ }W d   ƒ n1 s*0    Y  |t|ƒdd�}|t|ƒdd�}t||ƒ d S rÀ   )r‹   r�   r   r-   )rI   rL   rF   rn   r   r�   r�   r   r   r   Útest_stringl  s
    &zTestReadHtml.test_stringc                 C   s~   t |dd��}||dd�}W d   ƒ n1 s.0    Y  t |dd��}||dd�}W d   ƒ n1 sf0    Y  t||ƒ d S rÀ   )r‹   r-   )rI   rL   rF   rn   r�   r�   r   r   r   Útest_file_likeu  s
    **zTestReadHtml.test_file_likec                 C   sL   |j ddd� tjtdd�� |ddd� W d   ƒ n1 s>0    Y  d S )Nz#urlopen error unknown url type: gité”  ©Úcoder1   zgit://github.comr’   )rŒ   r7   r:   r   ©rI   rŽ   rF   r   r   r   Útest_bad_url_protocol~  s    z"TestReadHtml.test_bad_url_protocolc                 C   sR   |j ddd� tjttfdd�� ||jdd� W d   ƒ n1 sD0    Y  d S )NzName or service not knownrÆ   rÇ   zHTTP Error 404: NOT FOUNDr1   r’   )rŒ   r7   r:   r   r>   r?   rÉ   r   r   r   Útest_invalid_url…  s    zTestReadHtml.test_invalid_urlc                 C   sL   |}|t tj |¡ƒdddid�}t|tƒs0J ‚|D ]}t|tƒs4J ‚q4d S )NZFirstr•   r–   r—   )r   ÚosÚpathÚabspathr   r\   r
   ©rI   rN   rF   r?   rŸ   r`   r   r   r   Útest_file_url�  s    ÿzTestReadHtml.test_file_urlc                 C   sH   |}t jtdd��" ||dddid� W d   ƒ n1 s:0    Y  d S )NzNo tables foundr1   rˆ   r•   Z	tasdfabler—   ©r7   r:   r>   )rI   rN   rF   r?   r   r   r   Útest_invalid_table_attrs—  s
    
ÿz%TestReadHtml.test_invalid_table_attrsc                 C   s0   ||dddiddgd�d }t |jtƒs,J ‚d S )NÚMetcalfr•   r–   r   rd   )r2   rV   r£   ©r   rT   r   ©rI   rN   rF   r`   r   r   r   Útest_multiindex_headerŸ  s    ÿþz#TestReadHtml.test_multiindex_headerc                 C   s0   ||dddiddgd�d }t |jtƒs,J ‚d S )NrÓ   r•   r–   r   rd   )r2   rV   rC   )r   rr   r   rÕ   r   r   r   Útest_multiindex_index¦  s    ÿþz"TestReadHtml.test_multiindex_indexc                 C   sF   ||dddiddgddgd�d }t |jtƒs2J ‚t |jtƒsBJ ‚d S )NrÓ   r•   r–   r   rd   )r2   rV   r£   rC   )r   rT   r   rr   rÕ   r   r   r   Útest_multiindex_header_index­  s    ûúz)TestReadHtml.test_multiindex_header_indexc                 C   s2   ||dddiddgdd�d }t |jtƒs.J ‚d S ©NrÓ   r•   r–   r   rd   )r2   rV   r£   r§   rÔ   rÕ   r   r   r   Ú&test_multiindex_header_skiprows_tuples¹  s    ûúz3TestReadHtml.test_multiindex_header_skiprows_tuplesc                 C   s2   ||dddiddgdd�d }t |jtƒs.J ‚d S rÙ   rÔ   rÕ   r   r   r   Útest_multiindex_header_skiprowsÄ  s    ûúz,TestReadHtml.test_multiindex_header_skiprowsc                 C   sH   ||dddiddgddgdd�d }t |jtƒs4J ‚t |jtƒsDJ ‚d S )NrÓ   r•   r–   r   rd   )r2   rV   r£   rC   r§   )r   rr   r   rT   rÕ   r   r   r   Ú%test_multiindex_header_index_skiprowsÏ  s    úùz2TestReadHtml.test_multiindex_header_index_skiprowsc                 C   sX   |}|t tj |¡ƒt t d¡¡ddid�}t|tƒs<J ‚|D ]}t|tƒs@J ‚q@d S )NZFloridar•   r–   r—   )	r   rÌ   rÍ   rÎ   ÚreÚcompiler   r\   r
   rÏ   r   r   r   Útest_regex_idempotencyÜ  s    ýz#TestReadHtml.test_regex_idempotencyc                 C   sD   d}t jt|d�� ||ddd� W d   ƒ n1 s60    Y  d S )Nz\(you passed a negative value\)r1   ZWaterr´   r¦   rÑ   )rI   rL   rF   r,   r   r   r   Útest_negative_skiprowsè  s    z#TestReadHtml.test_negative_skiprowsc                 C   s   dS )Naf  
          <table class="contentstable" align="center"><tr>
            <td width="50%">
            <p class="biglink"><a class="biglink" href="whatsnew/2.7.html">What's new in Python 2.7?</a><br/>
                <span class="linkdescr">or <a href="whatsnew/index.html">all "What's new" documents</a> since 2.0</span></p>
            <p class="biglink"><a class="biglink" href="tutorial/index.html">Tutorial</a><br/>
                <span class="linkdescr">start here</span></p>
            <p class="biglink"><a class="biglink" href="library/index.html">Library Reference</a><br/>
                <span class="linkdescr">keep this under your pillow</span></p>
            <p class="biglink"><a class="biglink" href="reference/index.html">Language Reference</a><br/>
                <span class="linkdescr">describes syntax and language elements</span></p>
            <p class="biglink"><a class="biglink" href="using/index.html">Python Setup and Usage</a><br/>
                <span class="linkdescr">how to use Python on different platforms</span></p>
            <p class="biglink"><a class="biglink" href="howto/index.html">Python HOWTOs</a><br/>
                <span class="linkdescr">in-depth documents on specific topics</span></p>
            </td><td width="50%">
            <p class="biglink"><a class="biglink" href="installing/index.html">Installing Python Modules</a><br/>
                <span class="linkdescr">installing from the Python Package Index &amp; other sources</span></p>
            <p class="biglink"><a class="biglink" href="distributing/index.html">Distributing Python Modules</a><br/>
                <span class="linkdescr">publishing modules for installation by others</span></p>
            <p class="biglink"><a class="biglink" href="extending/index.html">Extending and Embedding</a><br/>
                <span class="linkdescr">tutorial for C/C++ programmers</span></p>
            <p class="biglink"><a class="biglink" href="c-api/index.html">Python/C API</a><br/>
                <span class="linkdescr">reference for C/C++ programmers</span></p>
            <p class="biglink"><a class="biglink" href="faq/index.html">FAQs</a><br/>
                <span class="linkdescr">frequently asked questions (with answers!)</span></p>
            </td></tr>
        </table>

        <p><strong>Indices and tables:</strong></p>
        <table class="contentstable" align="center"><tr>
            <td width="50%">
            <p class="biglink"><a class="biglink" href="py-modindex.html">Python Global Module Index</a><br/>
                <span class="linkdescr">quick access to all modules</span></p>
            <p class="biglink"><a class="biglink" href="genindex.html">General Index</a><br/>
                <span class="linkdescr">all functions, classes, terms</span></p>
            <p class="biglink"><a class="biglink" href="glossary.html">Glossary</a><br/>
                <span class="linkdescr">the most important terms explained</span></p>
            </td><td width="50%">
            <p class="biglink"><a class="biglink" href="search.html">Search page</a><br/>
                <span class="linkdescr">search this documentation</span></p>
            <p class="biglink"><a class="biglink" href="contents.html">Complete Table of Contents</a><br/>
                <span class="linkdescr">lists all sections and subsections</span></p>
            </td></tr>
        </table>
        r   ©rI   r   r   r   Úpython_docsí  s    zTestReadHtml.python_docsc                 C   s.   |j |d� ||jdd�}t|ƒdks*J ‚d S )Nr†   ÚPythonr1   rd   )rŒ   r?   r#   )rI   râ   rŽ   rF   rŸ   r   r   r   Útest_multiple_matches  s    z"TestReadHtml.test_multiple_matchesc                 C   s@   |j |d� ||jdd�}dd„ |D ƒ}t|ƒddgks<J ‚d S )Nr†   rã   r1   c                 S   s   g | ]}|j d  dd… ‘qS )rš   r   rP   )rœ   )ry   r`   r   r   r   Ú
<listcomp>*  r"   z7TestReadHtml.test_python_docs_table.<locals>.<listcomp>ZPythZWhat)rŒ   r?   Úsorted)rI   râ   rŽ   rF   rŸ   Úzzr   r   r   Útest_python_docs_table%  s    z#TestReadHtml.test_python_docs_tablec                 C   s$   d}|t |ƒƒ}t|ƒdks J ‚dS )z@
        Make sure that read_html ignores empty tables.
        aà  
            <table>
                <thead>
                    <tr>
                        <th>A</th>
                        <th>B</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>1</td>
                        <td>2</td>
                    </tr>
                </tbody>
            </table>
            <table>
                <tbody>
                </tbody>
            </table>
        rd   N)r   r#   )rI   rF   r3   r�   r   r   r   Útest_empty_tables-  s    zTestReadHtml.test_empty_tablesc                 C   s<   |t dƒƒd }tddgddggddgd	�}t ||¡ d S )
NaÎ  <table>
            <thead>
                <tr>
                    <th>A</th>
                    <th>B</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>2</td>
                </tr>
            </tbody>
            <tbody>
                <tr>
                    <td>3</td>
                    <td>4</td>
                </tr>
            </tbody>
        </table>r   rd   rO   rQ   rP   ÚAÚB©r   rT   ©r   r
   r'   r(   ©rI   rF   r�   r|   r   r   r   Útest_multiple_tbodyH  s    ÿÿéz TestReadHtml.test_multiple_tbodyc                 C   s2   |t dƒƒd }tddidgd�}t ||¡ dS )zt
        Don't fail with bs4 when there is a header and only one column
        as described in issue #9178
        a3  <table>
                <thead>
                    <tr>
                        <th>Header</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>first</td>
                    </tr>
                </tbody>
            </table>r   ÚHeaderÚfirst©r   rr   Nrí   rî   r   r   r   Útest_header_and_one_columnh  s    ÿÿñz'TestReadHtml.test_header_and_one_columnc                 C   s6   |t dƒƒd }tg d¢gg d¢d�}t ||¡ dS )zK
        Ensure parser adds <tr> within <thead> on malformed HTML.
        aœ  <table>
            <thead>
                <tr>
                    <th>Country</th>
                    <th>Municipality</th>
                    <th>Year</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Ukraine</td>
                    <th>Odessa</th>
                    <td>1944</td>
                </tr>
            </tbody>
        </table>r   )ZUkraineZOdessaé˜  )ZCountryZMunicipalityZYearrì   Nrí   rî   r   r   r   Útest_thead_without_tr‚  s    ÿÿíþz"TestReadHtml.test_thead_without_trc           	      C   sŠ   d}t ddggddgd�}t ddgddggddgd�}|jd	d
�}|jdd
�}|t|ƒƒd }|t|ƒƒd }t ||¡ t ||¡ dS )zh
        Make sure that read_html reads tfoot, containing td or th.
        Ignores empty tfoot
        a†  <table>
            <thead>
                <tr>
                    <th>A</th>
                    <th>B</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>bodyA</td>
                    <td>bodyB</td>
                </tr>
            </tbody>
            <tfoot>
                {footer}
            </tfoot>
        </table>ZbodyAZbodyBrê   rë   rì   ZfootAZfootBÚ )Úfooterz%<tr><td>footA</td><th>footB</th></tr>r   N)r
   r]   r   r'   r(   )	rI   rF   Zdata_templateZ	expected1Z	expected2rÁ   rÂ   Zresult1Zresult2r   r   r   Útest_tfoot_read¢  s    ÿzTestReadHtml.test_tfoot_readc                 C   s6   |t dƒdd�d }tddggdd�}t ||¡ d S )Na
  
            <table>
                <tr>
                    <td>S</td>
                    <td>I</td>
                </tr>
                <tr>
                    <td>text</td>
                    <td>1944</td>
                </tr>
            </table>
        r   ©r£   Útextrô   )ÚSÚIrS   rí   rî   r   r   r   Ú&test_parse_header_of_non_string_columnÈ  s    ÿñðz3TestReadHtml.test_parse_header_of_non_string_columnc                    s´   ddl m‰  ‡ fdd„}||dddid�d }t|d	d
ddƒttdœd�}|j|jksZJ ‚g d¢}g d¢}| |¡ ||¡}	| |¡}
|	}ddg}||  t¡||< t	 
||
¡ d S )Nr   ©Ú_remove_whitespacec                    s&   z
ˆ | ƒW S  t y    |  Y S 0 d S r   )ÚAttributeError©r   rþ   r   r   Útry_remove_wså  s    
z8TestReadHtml.test_banklist_header.<locals>.try_remove_wsrÓ   r•   r–   r—   r   r   Úcsvzbanklist.csv)úUpdated DateúClosing Date©Ú
converters)
z,First Vietnamese American Bank In Vietnamesez"Westernbank Puerto Rico En Espanolz*R-G Premier Bank of Puerto Rico En EspanolzEurobank En EspanolzSanderson State Bank En EspanolzLWashington Mutual Bank (Including its subsidiary Washington Mutual Bank FSB)zSilver State Bank En Espanolz%AmTrade International Bank En EspanolzHamilton Bank, NA En Espanolz6The Citizens Savings Bank Pioneer Community Bank, Inc.)
zFirst Vietnamese American BankzWesternbank Puerto RicozR-G Premier Bank of Puerto RicoZEurobankzSanderson State BankzWashington Mutual BankzSilver State BankzAmTrade International BankzHamilton Bank, NAzThe Citizens Savings Bankr  r  )Zpandas.io.htmlrÿ   r   r   Úshaper%   ÚreplaceÚapplyr   r'   r(   )rI   rN   r   rF   r  r`   Zground_truthÚoldÚnewZdfnewZgtnewZ	convertedZ	date_colsr   rþ   r   Útest_banklist_headerá  s     þ
z!TestReadHtml.test_banklist_headerc                 C   sn   d}t |dd��}| ¡ }W d   ƒ n1 s.0    Y  ||v sDJ ‚||dddid�d }|| ¡ v sjJ ‚d S )NzGold Canyonrƒ   r„   r•   r–   r—   r   )r‹   r�   Z	to_string)rI   rN   rF   Úgcrn   Zraw_textr`   r   r   r   Útest_gold_canyon  s    &
ÿþzTestReadHtml.test_gold_canyonc                 C   s8   |t dƒdd�d }|t dƒdd�d }t ||¡ d S )Na�  <table>
                        <thead>
                            <tr style="text-align: right;">
                            <th></th>
                            <th>C_l0_g0</th>
                            <th>C_l0_g1</th>
                            <th>C_l0_g2</th>
                            <th>C_l0_g3</th>
                            <th>C_l0_g4</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                            <th>R_l0_g0</th>
                            <td> 0.763</td>
                            <td> 0.233</td>
                            <td> nan</td>
                            <td> nan</td>
                            <td> nan</td>
                            </tr>
                            <tr>
                            <th>R_l0_g1</th>
                            <td> 0.244</td>
                            <td> 0.285</td>
                            <td> 0.392</td>
                            <td> 0.137</td>
                            <td> 0.222</td>
                            </tr>
                        </tbody>
                    </table>r   ©rC   a¸  <table>
                    <thead>
                        <tr style="text-align: right;">
                        <th></th>
                        <th>C_l0_g0</th>
                        <th>C_l0_g1</th>
                        <th>C_l0_g2</th>
                        <th>C_l0_g3</th>
                        <th>C_l0_g4</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                        <th>R_l0_g0</th>
                        <td> 0.763</td>
                        <td> 0.233</td>
                        </tr>
                        <tr>
                        <th>R_l0_g1</th>
                        <td> 0.244</td>
                        <td> 0.285</td>
                        <td> 0.392</td>
                        <td> 0.137</td>
                        <td> 0.222</td>
                        </tr>
                    </tbody>
                 </table>)r   r'   r(   )rI   rF   r|   r�   r   r   r   Útest_different_number_of_cols  s"    ÿ ß"Þ$ÿâá!z*TestReadHtml.test_different_number_of_colsc                 C   s6   |t dƒƒd }tg d¢gg d¢d�}t ||¡ d S )NaZ  
            <table>
                <tr>
                    <th>A</th>
                    <th colspan="1">B</th>
                    <th rowspan="1">C</th>
                </tr>
                <tr>
                    <td>a</td>
                    <td>b</td>
                    <td>c</td>
                </tr>
            </table>
        r   rh   )rê   rë   ÚCrS   rí   rî   r   r   r   Útest_colspan_rowspan_1e  s    ÿÿïz#TestReadHtml.test_colspan_rowspan_1c                 C   s:   |t dƒdd�d }tg d¢gg d¢d�}t ||¡ d S )Na…  
            <table>
                <tr>
                    <td colspan="2">X</td>
                    <td>Y</td>
                    <td rowspan="2">Z</td>
                    <td>W</td>
                </tr>
                <tr>
                    <td>A</td>
                    <td colspan="2">B</td>
                    <td>C</td>
                </tr>
            </table>
        r   rù   )rê   rë   rë   ÚZr  )ÚXzX.1ÚYr  ÚWrì   rí   rî   r   r   r   Ú test_colspan_rowspan_copy_values~  s    ÿîíÿz-TestReadHtml.test_colspan_rowspan_copy_valuesc                 C   s:   |t dƒdd�d }tg d¢gg d¢d�}t ||¡ d S )Na(  
            <table>
                <tr>
                    <td rowspan="2">A</td>
                    <td rowspan="2" colspan="3">B</td>
                    <td>C</td>
                </tr>
                <tr>
                    <td>D</td>
                </tr>
            </table>
        r   rù   )rê   rë   rë   rë   ÚD)rê   rë   zB.1zB.2r  rì   rí   rî   r   r   r   Útest_colspan_rowspan_both_not_1¡  s    ÿñðÿz,TestReadHtml.test_colspan_rowspan_both_not_1c                 C   s:   |t dƒdd�d }tddggddgd�}t ||¡ d S )Nzñ
            <table>
                <tr>
                    <td>A</td>
                    <td rowspan="2">B</td>
                </tr>
                <tr>
                    <td>C</td>
                </tr>
            </table>
        r   rù   r  rë   rê   rì   rí   rî   r   r   r   Útest_rowspan_at_end_of_rowÁ  s    ÿòñz'TestReadHtml.test_rowspan_at_end_of_rowc                 C   s@   |t dƒdd�d }tddgddggddgd�}t ||¡ d S )Nz³
            <table>
                <tr>
                    <td rowspan="3">A</td>
                    <td rowspan="3">B</td>
                </tr>
            </table>
        r   rù   rê   rë   rì   rí   rî   r   r   r   Útest_rowspan_only_rowsÞ  s    ÿ
õôz#TestReadHtml.test_rowspan_only_rowsc                 C   sV   |t dƒƒd }tddgddggddgddggd�}tdd	gg|d
�}t ||¡ d S )Nam  
            <table>
                <tr>
                    <th>A</th>
                    <th>B</th>
                </tr>
                <tr>
                    <th>a</th>
                    <th>b</th>
                </tr>
                <tr>
                    <td>1</td>
                    <td>2</td>
                </tr>
            </table>
        r   rê   rë   ri   rj   rd   ©ZlevelsÚcodesrO   rì   ©r   r   r
   r'   r(   ©rI   rF   r�   rT   r|   r   r   r   Ú+test_header_inferred_from_rows_with_only_thó  s    ÿÿí$z8TestReadHtml.test_header_inferred_from_rows_with_only_thc                 C   sh   t dtddd�iƒ}| ¡ }|t|ƒdgdd�}t ||d ¡ |t|ƒdgdd�}t ||d ¡ d S )NÚdateú1/1/2001é
   ©Zperiodsrd   r   ©Zparse_datesrC   )r
   r   r_   r   r'   r(   )rI   rF   r`   r|   rb   r   r   r   Útest_parse_dates_list  s    z"TestReadHtml.test_parse_dates_listc                 C   sp   t tddd�ƒ}t| dd„ ¡| dd„ ¡dœƒ}|t| ¡ ƒdd	d
gid	d�}td|iƒ}t ||d ¡ d S )Nr#  r$  r%  c                 S   s   t |  ¡ ƒS r   )Ústrr"  r  r   r   r   r!     r"   z7TestReadHtml.test_parse_dates_combine.<locals>.<lambda>c                 S   s   t |  ¡ ƒS r   )r(  Útimer  r   r   r   r!     r"   )r"  r)  Údatetimerd   rO   r&  r   )r   r   r
   r%   r   r_   r'   r(   )rI   rF   Z	raw_datesr`   rb   Znewdfr   r   r   Útest_parse_dates_combine  s    þÿÿz%TestReadHtml.test_parse_dates_combinec                 C   s®   |ddddƒ}t j |¡s,J t|ƒ› d�ƒ‚t j |¡sJJ t|ƒ› d�ƒ‚||ddd	�d
 }|jdksjJ ‚d|jd v s|J ‚|d jt d¡ks”J ‚t 	|j
d d¡sªJ ‚d S )Nr   r   r3   úwikipedia_states.htmlz is not a filez is an empty fileÚArizonard   r¢   r   )é<   é   ÚUnnamedr´   úsq miÚfloat64)r   r1  çHázPN$A)rÌ   rÍ   ÚisfileÚreprÚgetsizer  rT   re   rW   ÚallcloseÚloc©rI   r   rF   r   r�   r   r   r   Útest_wikipedia_states_table%  s    z(TestReadHtml.test_wikipedia_states_tablec                 C   sn   |ddddƒ}||ddd�d }|j dks.J ‚d	|jd
 d v sDJ ‚|jjdksTJ ‚t |jd d¡sjJ ‚d S )Nr   r   r3   r,  r-  r   rº   )r.  é   r0  r´   rd   rO   )ZAlaska)zTotal area[2]r1  r3  )r  rT   ZnlevelsrW   r7  r8  r9  r   r   r   Ú test_wikipedia_states_multiindex/  s    z-TestReadHtml.test_wikipedia_states_multiindexc                 C   sD   |t dƒddgd�}tddggt ddg¡d	�}t |d |¡ d S )
NaK  
                <table>
                    <thead>
                        <tr><th></th><th></tr>
                        <tr><th>A</th><th>B</th></tr>
                    </thead>
                    <tbody>
                        <tr><td>a</td><td>b</td></tr>
                    </tbody>
                </table>
            r   rd   rù   ri   rj   )úUnnamed: 0_level_0rê   )zUnnamed: 1_level_0rë   rS   )r   r
   r   Úfrom_tuplesr'   r(   rî   r   r   r   Ú%test_parser_error_on_empty_header_row7  s    ÿòÿþz2TestReadHtml.test_parser_error_on_empty_header_rowc                 C   sN   |t dƒdd�d }tddidgd�}|d jt d¡ks>J ‚t ||¡ d S )	Na�  <html>
            <body>
             <table>
                <thead>
                    <tr>
                        <th>Header</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>1100#101</td>
                    </tr>
                </tbody>
            </table>
            </body>
        </html>ú#)Údecimalr   rð   g–C‹lg0‘@rò   r2  )r   r
   re   rW   r'   r(   rî   r   r   r   Útest_decimal_rowsP  s    ÿíìzTestReadHtml.test_decimal_rowsÚargTFc                 C   sH   t  d¡}tjt|d�� |||d� W d   ƒ n1 s:0    Y  d S )Nz–Passing a bool to header is invalid. Use header=None for no header or header=int or list-like of ints to specify the row(s) making up the column namesr1   rù   )rÝ   Úescaper7   r:   r·   )rI   rL   rC  rF   r,   r   r   r   Útest_bool_header_argm  s
    ÿz!TestReadHtml.test_bool_header_argc                 C   s8   |t dƒdtid�d }tdddgiƒ}t ||¡ d S )Naƒ  <table>
                 <thead>
                   <tr>
                     <th>a</th>
                    </tr>
                 </thead>
                 <tbody>
                   <tr>
                     <td> 0.763</td>
                   </tr>
                   <tr>
                     <td> 0.244</td>
                   </tr>
                 </tbody>
               </table>ri   r  r   z0.763z0.244)r   r(  r
   r'   r(   rî   r   r   r   Útest_convertersx  s    ÿîízTestReadHtml.test_convertersc                 C   s8   |t dƒdgd�d }tddtjgiƒ}t ||¡ d S )Na‚  <table>
                 <thead>
                   <tr>
                     <th>a</th>
                   </tr>
                 </thead>
                 <tbody>
                   <tr>
                     <td> 0.763</td>
                   </tr>
                   <tr>
                     <td> 0.244</td>
                   </tr>
                 </tbody>
               </table>g¬Zd;Ï?)Z	na_valuesr   ri   gÑ"Ûù~jè?©r   r
   rW   r   r'   r(   rî   r   r   r   Útest_na_values“  s    ÿîízTestReadHtml.test_na_valuesc                 C   sl   d}t dddgiƒ}|t|ƒdd�d }t ||¡ t dtjtjgiƒ}|t|ƒdd�d }t ||¡ d S )	Naé  <table>
                        <thead>
                            <tr>
                            <th>a</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                            <td> N/A</td>
                            </tr>
                            <tr>
                            <td> NA</td>
                            </tr>
                        </tbody>
                    </table>ri   zN/Ar	   F)Zkeep_default_nar   T)r
   r   r'   r(   rW   r   )rI   rF   Z	html_dataÚexpected_dfÚhtml_dfr   r   r   Útest_keep_default_na®  s    z!TestReadHtml.test_keep_default_nac                 C   s@   |t dƒƒd }tddgtjtjggddgd�}t ||¡ d S )Nak  
            <table>
                <tr>
                    <th>A</th>
                    <th>B</th>
                </tr>
                <tr>
                    <td>a</td>
                    <td>b</td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                </tr>
            </table>
        r   ri   rj   rê   rë   rì   rG  rî   r   r   r   Útest_preserve_empty_rowsÇ  s    ÿÿí z%TestReadHtml.test_preserve_empty_rowsc                 C   sV   |t dƒƒd }tddgddggddgddggd�}tdd	gg|d
�}t ||¡ d S )NaU  
            <table>
                <thead>
                    <tr><th></th><th></tr>
                    <tr><th>A</th><th>B</th></tr>
                    <tr><th>a</th><th>b</th></tr>
                </thead>
                <tbody>
                    <tr><td>1</td><td>2</td></tr>
                </tbody>
            </table>
        r   rê   rë   ri   rj   rd   r  rO   rì   r  r   r   r   r   Ú,test_ignore_empty_rows_when_inferring_headerá  s    ÿÿñ$z9TestReadHtml.test_ignore_empty_rows_when_inferring_headerc                 C   sL   t g d¢d�}g d¢g d¢g|_|jdd�}|t|ƒƒd }t ||¡ d S )N))ZHillaryéD   r  )ZBernieéJ   r  )ZDonaldéE   ÚR)r   )r=  ZAgeZParty)ÚNamezUnnamed: 1_level_1zUnnamed: 2_level_1Frq   r   )r
   rT   r_   r   r'   r(   )rI   rF   rI  r3   rJ  r   r   r   Útest_multiple_header_rowsø  s    ÿþz&TestReadHtml.test_multiple_header_rowsc                 C   s>   |ddddƒ}||dd�}t |tƒs(J ‚t |d tƒs:J ‚d S )Nr   r   r3   rB   r   r  )r   r\   r
   )rI   r   rF   rD   rŸ   r   r   r   Útest_works_on_valid_markup  s    z'TestReadHtml.test_works_on_valid_markupc                 C   s$   |ddddƒ}||dddgd� d S )	Nr   r   r3   rM   r’   rA   r/   r=   r   )rI   r   rF   rN   r   r   r   Útest_fallback_success  s    z"TestReadHtml.test_fallback_successc                 C   s>   t ddd�}ttj d¡ d¡|d�}| ¡ }d|v s:J ‚d S )Nz
2000-01-01r$  r%  rO   )r$  rP   rq   )r   r
   rW   rX   rY   Zstandard_normalr_   )rI   Úrngr`   r�   r   r   r   Útest_to_html_timestamp  s    z#TestReadHtml.test_to_html_timestampc                 C   s¸   t dddœgƒ}| ¡ }|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}d|v s`J ‚||kslJ ‚||ksxJ ‚||ks„J ‚d	|v s�J ‚d
|vsœJ ‚d|vs¨J ‚||ks´J ‚d S )Nrd   rO   ©rê   rë   T)Úborderr   Fz border="1"z border="2"z border="0"z border)r
   r_   )rI   r`   Zout_border_defaultZout_border_trueZout_border_explicit_defaultZout_border_nondefaultZout_border_zeroZout_border_falser   r   r   Útest_to_html_borderless  s    z$TestReadHtml.test_to_html_borderlesszdisplayed_only,exp0,exp1ZfooNzfoo  bar  baz  quxc                 C   sR   d}|t |ƒ|d�}t |d |¡ |d ur>t |d |¡ nt|ƒdksNJ ‚d S )Na  <html>
          <body>
            <table>
              <tr>
                <td>
                  foo
                  <span style="display:none;text-align:center">bar</span>
                  <span style="display:none">baz</span>
                  <span style="display: none">qux</span>
                </td>
              </tr>
            </table>
            <table style="display: none">
              <tr>
                <td>foo</td>
              </tr>
            </table>
          </body>
        </html>©Údisplayed_onlyr   rd   )r   r'   r(   r#   )rI   r\  Zexp0Zexp1rF   r   rŸ   r   r   r   Útest_displayed_only+  s    	z TestReadHtml.test_displayed_onlyr\  c                 C   s>   d}|t |ƒ|d�d }tddgddgdœƒ}t ||¡ d S )	NaW  
        <table>
            <tr>
                <th>A</th>
                <th>B</th>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
            </tr>
            <tr>
                <td><span style="display:none"></span>4</td>
                <td>5</td>
            </tr>
        </table>
        r[  r   rd   rP   rO   r³   rX  rí   )rI   r\  rF   Z
html_tabler�   r|   r   r   r   Ú&test_displayed_only_with_many_elementsP  s    ÿz3TestReadHtml.test_displayed_only_with_many_elementsz\ignore:You provided Unicode markup but also provided a value for from_encoding.*:UserWarningc                 C   s  t j |¡}t j |¡d }| d¡\}}z²t|dƒ�&}|| ¡ |dd� ¡ }W d   ƒ n1 sb0    Y  t|dƒ�*}|t| ¡ ƒ|dd� ¡ }	W d   ƒ n1 s¦0    Y  |||dd� ¡ }
t	 
||	¡ t	 
||
¡ W n: t�y   tƒ �rd|v �sd|v �rt ¡  ‚ Y n0 d S )Nr   Ú_Úrb)r…   rC   Z16Z32)rÌ   rÍ   ÚbasenameÚsplitextÚsplitr‹   r�   Úpopr   r'   r(   Ú	Exceptionr   r7   Úskip)rI   r   rF   Ú	base_pathÚrootr_  r…   ZfobjZfrom_stringZfrom_file_likeÚfrom_filenamer   r   r   Útest_encodeh  s,    
ÿ(ÿ(ÿ
zTestReadHtml.test_encodec                 C   sx   |j  d¡dkrt d¡ G dd„ dtƒ}|dƒ}||ƒs>J ‚tjtdd�� ||ƒ W d   ƒ n1 sj0    Y  d S )	Nr6   rA   zNot applicable for lxmlc                   @   s   e Zd Zdd„ ZdS )zFTestReadHtml.test_parse_failure_unseekable.<locals>.UnseekableStringIOc                 S   s   dS ©NFr   rá   r   r   r   Úseekable�  s    zOTestReadHtml.test_parse_failure_unseekable.<locals>.UnseekableStringIO.seekableN)Ú__name__Ú
__module__Ú__qualname__rl  r   r   r   r   ÚUnseekableStringIO�  s   rp  z?
            <table><tr><td>spam<foobr />eggs</td></tr></table>z#passed a non-rewindable file objectr1   )ÚkeywordsÚgetr7   rf  r   r:   r>   )rI   rF   rp  Úbadr   r   r   Útest_parse_failure_unseekable‰  s    
ÿz*TestReadHtml.test_parse_failure_unseekablec                 C   s:   G dd„ dƒ}|dƒ}|dƒ}||ƒs*J ‚||ƒs6J ‚d S )Nc                   @   sJ   e Zd Zddœdd„Zddd„Zdd„ Zd	d
„ Zdd„ Zedœdd„Z	dS )z9TestReadHtml.test_parse_failure_rewinds.<locals>.MockFileN)Úreturnc                 S   s   || _ d| _d S rk  )r   Úat_end)rI   r   r   r   r   Ú__init__¡  s    zBTestReadHtml.test_parse_failure_rewinds.<locals>.MockFile.__init__c                 S   s   | j r
dn| j}d| _ |S )Nrö   T)rv  r   )rI   Úsizer   r   r   r   r�   ¥  s    z>TestReadHtml.test_parse_failure_rewinds.<locals>.MockFile.readc                 S   s
   d| _ d S rk  )rv  )rI   Úoffsetr   r   r   Úseekª  s    z>TestReadHtml.test_parse_failure_rewinds.<locals>.MockFile.seekc                 S   s   dS )NTr   rá   r   r   r   rl  ­  s    zBTestReadHtml.test_parse_failure_rewinds.<locals>.MockFile.seekablec                 S   s   d S r   r   rá   r   r   r   Ú__next__±  s    zBTestReadHtml.test_parse_failure_rewinds.<locals>.MockFile.__next__c                 S   s   | S r   r   rá   r   r   r   Ú__iter__´  s    zBTestReadHtml.test_parse_failure_rewinds.<locals>.MockFile.__iter__)N)
rm  rn  ro  rw  r�   rz  rl  r{  r   r|  r   r   r   r   ÚMockFile   s   
r}  z/<table><tr><td>spam<br />eggs</td></tr></table>z2<table><tr><td>spam<foobr />eggs</td></tr></table>r   )rI   rF   r}  Zgoodrs  r   r   r   Útest_parse_failure_rewinds�  s
    z'TestReadHtml.test_parse_failure_rewindsc                 C   s€   G dd„ dt jƒ}|ddddƒ}|||fd�}|||fd�}| ¡  | ¡  | ¡ sL| ¡ r^qLd |j  u rv|ju s|n J ‚d S )Nc                       s   e Zd Z‡ fdd„Z‡  ZS )z@TestReadHtml.test_importcheck_thread_safety.<locals>.ErrorThreadc              
      sD   zt ƒ  ¡  W n* ty8 } z|| _W Y d }~nd }~0 0 d | _d S r   )ÚsuperÚrunre  Úerr)rI   r�  ©Ú	__class__r   r   r€  Å  s
    zDTestReadHtml.test_importcheck_thread_safety.<locals>.ErrorThread.run)rm  rn  ro  r€  Ú__classcell__r   r   r‚  r   ÚErrorThreadÄ  s   r…  r   r   r3   rB   )Útargetr*   )Ú	threadingÚThreadÚstartÚis_aliver�  )rI   r   rF   r…  rD   Zhelper_thread1Zhelper_thread2r   r   r   Útest_importcheck_thread_safety¿  s    	z+TestReadHtml.test_importcheck_thread_safetyc                 C   s>   |ddddƒ}t |ƒ}||ƒd }||ƒd }t ||¡ d S )Nr   r   r3   r4   r   )r   r'   r(   )rI   r   rF   Zfile_path_stringÚ	file_pathr�   r�   r   r   r   Útest_parse_path_objectØ  s
    z#TestReadHtml.test_parse_path_objectc                 C   s2   |t dƒƒd }tdggdgd�}t ||¡ d S )NzÓ
            <table>
                <tr>
                    <th>A</th>
                </tr>
                <tr>
                    <td>word1<br>word2</td>
                </tr>
            </table>
        r   zword1 word2rê   rì   rí   rî   r   r   r   Útest_parse_br_as_spaceà  s    ÿÿóz#TestReadHtml.test_parse_br_as_space)r$   Úbodyr£   r÷   c           
      C   sÜ   d}g d¢g d¢g d¢g d¢g d¢g d¢dœ}|d	 }|d
 }|d }|dkrh|d }|d }|d }n4|dkrz|d }n"|dkrŒ|d }n|dkrœ|d }|t |ƒ|d�d }t||g|d�}	|	 tj¡}	t ||	¡ d S )Naì  
          <table>
            <tr>
              <th>HTTP</th>
              <th>FTP</th>
              <th><a href="https://en.wiktionary.org/wiki/linkless">Linkless</a></th>
            </tr>
            <tr>
              <td><a href="https://en.wikipedia.org/">Wikipedia</a></td>
              <td>SURROUNDING <a href="ftp://ftp.us.debian.org/">Debian</a> TEXT</td>
              <td>Linkless</td>
            </tr>
            <tfoot>
              <tr>
                <td><a href="https://en.wikipedia.org/wiki/Page_footer">Footer</a></td>
                <td>
                  Multiple <a href="1">links:</a> <a href="2">Only first captured.</a>
                </td>
              </tr>
            </tfoot>
          </table>
          )ÚHTTPÚFTPÚLinkless))r�  N)r‘  N)r’  z'https://en.wiktionary.org/wiki/linkless)Ú	WikipediaúSURROUNDING Debian TEXTr’  ))r“  zhttps://en.wikipedia.org/)r”  zftp://ftp.us.debian.org/)r’  N)ÚFooterú$Multiple links: Only first captured.N))r•  z)https://en.wikipedia.org/wiki/Page_footer)r–  Ú1N)Úhead_ignoreÚhead_extractÚbody_ignoreÚbody_extractÚfooter_ignoreÚfooter_extractrš  rœ  r˜  r$   r›  r�  r™  r�  r÷   r£   ©Zextract_linksr   rS   )r   r
   ZfillnarW   r   r'   r(   )
rI   rC  rF   Zgh_13141_dataZgh_13141_expectedZdata_expZfoot_expZhead_expr�   r|   r   r   r   Útest_extract_linksõ  s2    î


zTestReadHtml.test_extract_linksc                 C   sB   d}t jt|d�� t|dd� W d   ƒ n1 s40    Y  d S )NzY`extract_links` must be one of {None, "header", "footer", "body", "all"}, got "incorrect"r1   Z	incorrectrž  ©r7   r:   r>   r   )rI   rL   r,   r   r   r   Útest_extract_links_bad:  s    ÿz#TestReadHtml.test_extract_links_badc                 C   s4   d}|t |ƒdd�d }tdggƒ}t ||¡ d S )Nz¦
        <table>
          <tr>
            <td>
              <a href='https://google.com'>Google.com</a>
            </td>
          </tr>
        </table>
        r$   rž  r   )z
Google.comzhttps://google.comrí   ©rI   rF   r   r�   r|   r   r   r   Ú test_extract_links_all_no_headerB  s    	z-TestReadHtml.test_extract_links_all_no_headerc                 C   sB   d}t jt|d�� tddd� W d   ƒ n1 s40    Y  d S )NzPdtype_backend numpy is invalid, only 'numpy_nullable' and 'pyarrow' are allowed.r1   ÚtestÚnumpyrs   r   )rI   r,   r   r   r   Útest_invalid_dtype_backendQ  s    ÿz'TestReadHtml.test_invalid_dtype_backendc                 C   s@   d}|t |ƒƒd }tddgddggddgd	�}t ||¡ d S )
Na�  
        <table>
            <tr>
                <th>
                    <style>.style</style>
                    A
                    </th>
                <th>B</th>
            </tr>
            <tr>
                <td>A1</td>
                <td>B1</td>
            </tr>
            <tr>
                <td>A2</td>
                <td>B2</td>
            </tr>
        </table>
        r   ÚA1ZB1ÚA2ZB2rê   rë   rì   rí   r¢  r   r   r   Útest_style_tagY  s    zTestReadHtml.test_style_tag)frm  rn  ro  rJ   r7   ÚfixturerL   rN   rc   r‚   ÚmarkÚnetworkZ
single_cpur‘   r”   Zslowr™   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ø   rý   r  r  r  r  r  r  r  r  r!  r'  r+  r:  r<  r?  rB  ZparametrizerE  rF  rH  rK  rL  rM  rS  rT  rU  rW  rZ  r
   r]  r^  ÚtdZskip_if_windowsÚfilterwarningsrj  rt  r~  r‹  r�  rŽ  rŸ  r¡  r£  r¦  r©  r   r   r   r   rG   l   s   

6

		
	










0  &
/
H# 



þþ

ÿ"
DrG   )1Úcollections.abcr   Ú	functoolsr   r   r   r   rÌ   Úpathlibr   rÝ   r‡  Úurllib.errorr   r¥  rW   r7   Zpandas.compatr   Zpandas.util._test_decoratorsÚutilZ_test_decoratorsr­  ZpandasrZ   r	   r
   r   r   r   r   r   r   r   Zpandas._testingZ_testingr'   Zpandas.io.commonr   rª  r   r-   r<   r@   rE   r   Z
skip_if_norF   rG   r   r   r   r   Ú<module>   s<   ,ÿ
		þÿ
