o
    Û­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ÚdataÚhtml_encoding)Úparam)ÚrequestÚdatapath© r   úV/var/www/html/CropPilot/venv/lib/python3.10/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„ | |ƒƒ}|s(J |ƒ‚t| |ƒD ]\}}tj||g|¢R i |¤Ž |jrEJ dƒ‚q-d 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>:   s    z(assert_framelist_equal.<locals>.<lambda>zframes are both empty)ÚlenÚallÚmapÚzipÚtmÚassert_frame_equalÚempty)Úlist1Úlist2ÚargsÚkwargsÚmsgÚboth_framesÚframe_iÚframe_jr   r   r   Úassert_framelist_equal1   s(   ÿþÿýÿþr2   c                 C   sl   t  d¡}t  d¡ |  |dd¡ t jtdd�� t|ddd	d
ƒdd� W d   ƒ d S 1 s/w   Y  d S )NÚbs4Úhtml5libÚ__version__z4.2zPandas requires version©Úmatchr   r   Úhtmlú	spam.html©Úflavor)ÚpytestÚimportorskipÚsetattrÚraisesÚImportErrorr   )Úmonkeypatchr   r3   r   r   r   Útest_bs4_version_failsE   s   

"ÿrB   c                  C   sZ   d} d}d| d }t jt|d�� tt| ƒd|d� W d   ƒ d S 1 s&w   Y  d S )Nz
google.comzinvalid flavorz\{z \} is not a valid set of flavorsr6   Úgoogle©r7   r;   )r<   r?   Ú
ValueErrorr   r   )Úurlr;   r.   r   r   r   Útest_invalid_flavorN   s   "ÿrG   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 )
Nr3   Úlxmlr4   r   r   r8   úvalid_markup.htmlr   )Ú	index_colr;   )r<   r=   r   r2   )r   ÚfilenameÚdfs_lxmlÚdfs_bs4r   r   r   Útest_same_orderingW   s   


rN   r3   r4   )ÚmarksrH   c                 C   s   t t| jd�S )Nr:   )r   r   r   )r   r   r   r   Úflavor_read_htmlb   s   rP   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   ƒ d S 1 sw   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.r6   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'   Úassert_produces_warningÚFutureWarning)ÚselfrP   r.   r   r   r   Útest_literal_html_deprecationm   s   ÿÿ"ÿz*TestReadHtml.test_literal_html_deprecationc                 C   ó   |ddddƒS )Nr   r   r8   r9   r   ©rT   r   r   r   r   Ú	spam_data�   ó   zTestReadHtml.spam_datac                 C   rV   )Nr   r   r8   úbanklist.htmlr   rW   r   r   r   Úbanklist_data‘   rY   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}ÚclassÚ	dataframer   )ÚattrsrJ   )r
   ÚnpÚrandomÚdefault_rngÚpdÚIndexÚlistr%   ÚformatÚastypeÚfloatÚto_htmlr   r'   r(   )rT   rP   Ú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 sRw   Y  |dkrht 	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é   r^   ÚInt64)Údtype)rs   r\   r^   ç      ø?ç      @ÚFloat64)rv   g       @rw   )TFN)TFT©ÚaÚbÚc)rz   r{   N)rz   r{   r|   ÚdÚeÚfÚgÚhF©Úindexzmode.string_storage©Údtype_backendr   ÚpyarrowTÚboolean)ÚArrowExtensionArrayc                    s$   i | ]}|ˆ ˆj ˆ| d d�ƒ“qS )T)Úfrom_pandas)Úarray)Ú.0Úcol©rˆ   ÚexpectedÚpar   r   Ú
<dictcomp>Ð   s    ÿÿz3TestReadHtml.test_dtype_backend.<locals>.<dictcomp>)Úcheck_column_type)r
   r   re   Únanrn   rh   Úoption_contextr   r<   r=   Ú
ArrowDtypeÚstringÚStringDtyper	   r†   Úpandas.arraysrˆ   ra   r'   r(   )rT   Ústring_storager…   rP   ro   rp   ÚresultÚstring_dtyper   r�   r   Útest_dtype_backend¤   sN   øÿÿ

øÿþÿ	zTestReadHtml.test_dtype_backendc                 C   óf   t |dd��}|j| ¡ d� ||jdd�}||jdd�}W d   ƒ n1 s'w   Y  t||ƒ d S )Núutf-8©Úencoding©ÚcontentúFirst Federal Bank of Floridar6   úMetcalf Bank©ÚopenÚserve_contentÚreadrF   r2   )rT   Ú
httpserverr[   rP   r   Údf1Údf2r   r   r   Útest_banklist_urlÚ   s   ýþøzTestReadHtml.test_banklist_urlc                 C   rœ   )Nr�   rž   r    ú	.*Water.*r6   ÚUnitr¤   )rT   r¨   rX   rP   r   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©r7   rd   r£   ©r2   )rT   r[   rP   r©   rª   r   r   r   Útest_banklistö   s   
ÿ
ÿzTestReadHtml.test_banklistc                 C   sR   ||dd�}||dd�}t ||ƒ |d jd dksJ ‚|d jd dks'J ‚d S )Nr¬   r6   r­   r   ©r   r   Ú
ProximatesÚNutrient)r2   Úilocra   ©rT   rX   rP   r©   rª   r   r   r   Ú	test_spam  s
   
zTestReadHtml.test_spamc                 C   s$   ||ƒ}|D ]	}t |tƒsJ ‚qd S r   r   )rT   rX   rP   Údfsro   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°   )rd   r   )rT   r[   rP   rº   ro   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¬   r\   ©r7   Úheaderr   rµ   )ra   r)   )rT   rX   rP   ro   r   r   r   Útest_spam_header  s   zTestReadHtml.test_spam_headerc                 C   ó*   ||ddd�}||ddd�}t ||ƒ d S ©Nr¬   rs   ©r7   Úskiprowsr­   r²   r¸   r   r   r   Útest_skiprows_int  ó   zTestReadHtml.test_skiprows_intc                 C   ó2   ||dt dƒd�}||dt dƒd�}t||ƒ d S ©Nr¬   r\   rÂ   r­   )Úranger2   r¸   r   r   r   Útest_skiprows_range  ó   z TestReadHtml.test_skiprows_rangec                 C   s2   ||dddgd�}||dddgd�}t ||ƒ d S ©Nr¬   rs   r\   rÂ   r­   r²   r¸   r   r   r   Útest_skiprows_list$  rÊ   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*  rÊ   zTestReadHtml.test_skiprows_setc                 C   rÀ   rÁ   r²   r¸   r   r   r   Útest_skiprows_slice0  rÅ   z TestReadHtml.test_skiprows_slicec                 C   rÆ   rÇ   ©Úslicer2   r¸   r   r   r   Útest_skiprows_slice_short6  rÊ   z&TestReadHtml.test_skiprows_slice_shortc                 C   s8   ||dt ddƒd�}||dt dddƒd�}t||ƒ d S )	Nr¬   r\   é   rÂ   r­   r]   rs   éÿÿÿÿ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Ç   )re   Úaranger2   r¸   r   r   r   Útest_skiprows_ndarrayB  s   z"TestReadHtml.test_skiprows_ndarrayc                 C   sB   t jtdd�� ||ddd� W d   ƒ d S 1 sw   Y  d S )Nz%is not a valid type for skipping rowsr6   r¬   ÚasdfrÂ   )r<   r?   Ú	TypeError)rT   rX   rP   r   r   r   Útest_skiprows_invalidH  s   "ÿz"TestReadHtml.test_skiprows_invalidc                 C   rÀ   ©Nr¬   r   ©r7   rJ   r­   r²   r¸   r   r   r   Ú
test_indexL  s   zTestReadHtml.test_indexc                 C   ó.   ||dddd�}||dddd�}t ||ƒ d S ©Nr¬   rs   r   )r7   r¾   rJ   r­   r²   r¸   r   r   r   Útest_header_and_index_no_typesQ  ó   z+TestReadHtml.test_header_and_index_no_typesc                 C   rÝ   rÞ   r²   r¸   r   r   r   Ú test_header_and_index_with_typesV  rà   z-TestReadHtml.test_header_and_index_with_typesc                 C   rÀ   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w   Y  t |dd��}t| ¡ ƒ}W d   ƒ n1 s3w   Y  ||dd�}||dd�}t||ƒ d S ©NzUTF-8rž   r¬   r6   r­   )r¥   r   r§   r2   )rT   rX   rP   r   Ú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w   Y  |t|ƒdd�}|t|ƒdd�}t||ƒ d S rã   )r¥   r§   r   r2   )rT   rX   rP   r   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w   Y  t |dd��}||dd�}W d   ƒ n1 s3w   Y  t||ƒ d S rã   )r¥   r2   )rT   rX   rP   r   r©   rª   r   r   r   Útest_file_likeu  s   ÿÿzTestReadHtml.test_file_likec                 C   sN   |j ddd� tjtdd�� |ddd� W d   ƒ d S 1 s w   Y  d S )Nz#urlopen error unknown url type: gité”  ©Úcoder6   zgit://github.comr¬   )r¦   r<   r?   r   ©rT   r¨   rP   r   r   r   Útest_bad_url_protocol~  s   "ÿz"TestReadHtml.test_bad_url_protocolc                 C   sT   |j ddd� tjttfdd�� ||jdd� W d   ƒ d S 1 s#w   Y  d S )NzName or service not knownré   rê   zHTTP Error 404: NOT FOUNDr6   r¬   )r¦   r<   r?   r   rE   rF   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ƒsJ ‚|D ]	}t|tƒs#J ‚qd S )NÚFirstr¯   r°   r±   )r   ÚosÚpathÚabspathr   rj   r
   ©rT   r[   rP   rF   rº   ro   r   r   r   Útest_file_url�  s   ÿÿzTestReadHtml.test_file_urlc                 C   sJ   |}t jtdd�� ||dddid� W d   ƒ d S 1 sw   Y  d S )NzNo tables foundr6   r¢   r¯   Ú	tasdfabler±   ©r<   r?   rE   )rT   r[   rP   rF   r   r   r   Útest_invalid_table_attrs—  s   
ÿ"ÿz%TestReadHtml.test_invalid_table_attrsc                 C   ó0   ||dddiddgd�d }t |jtƒsJ ‚d S )NÚMetcalfr¯   r°   r   rs   )r7   rd   r¾   ©r   ra   r   ©rT   r[   rP   ro   r   r   r   Útest_multiindex_headerŸ  ó   ÿþz#TestReadHtml.test_multiindex_headerc                 C   rø   )Nrù   r¯   r°   r   rs   )r7   rd   rJ   )r   rƒ   r   rû   r   r   r   Útest_multiindex_index¦  rý   z"TestReadHtml.test_multiindex_indexc                 C   sF   ||dddiddgddgd�d }t |jtƒsJ ‚t |jtƒs!J ‚d S )Nrù   r¯   r°   r   rs   )r7   rd   r¾   rJ   )r   ra   r   rƒ   rû   r   r   r   Útest_multiindex_header_index­  s   ûúz)TestReadHtml.test_multiindex_header_indexc                 C   ó2   ||dddiddgdd�d }t |jtƒsJ ‚d S ©Nrù   r¯   r°   r   rs   )r7   rd   r¾   rÃ   rú   rû   r   r   r   Ú&test_multiindex_header_skiprows_tuples¹  ó   ûúz3TestReadHtml.test_multiindex_header_skiprows_tuplesc                 C   r   r  rú   rû   r   r   r   Útest_multiindex_header_skiprowsÄ  r  z,TestReadHtml.test_multiindex_header_skiprowsc                 C   sH   ||dddiddgddgdd�d }t |jtƒsJ ‚t |jtƒs"J ‚d S )Nrù   r¯   r°   r   rs   )r7   rd   r¾   rJ   rÃ   )r   rƒ   r   ra   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 )NÚFloridar¯   r°   r±   )	r   rð   rñ   rò   ÚreÚcompiler   rj   r
   ró   r   r   r   Útest_regex_idempotencyÜ  s   ýÿz#TestReadHtml.test_regex_idempotencyc                 C   sF   d}t jt|d�� ||ddd� W d   ƒ d S 1 sw   Y  d S )Nz\(you passed a negative value\)r6   ÚWaterrÓ   rÂ   rö   )rT   rX   rP   r.   r   r   r   Útest_negative_skiprowsè  s   "ÿz#TestReadHtml.test_negative_skiprowsc                 C   ó   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   ©rT   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    ÚPythonr6   rs   )r¦   rF   r#   )rT   r  r¨   rP   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  r6   c                 S   s   g | ]}|j d  dd… ‘qS )r´   r   r]   )r·   )r‹   ro   r   r   r   Ú
<listcomp>*  s    z7TestReadHtml.test_python_docs_table.<locals>.<listcomp>ÚPythÚWhat)r¦   rF   Úsorted)rT   r  r¨   rP   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>
        rs   N)r   r#   )rT   rP   r8   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   rs   r\   r^   r]   ÚAÚB©r   ra   ©r   r
   r'   r(   ©rT   rP   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   rƒ   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   )ÚUkraineÚOdessaé˜  )ÚCountryÚMunicipalityÚ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>ÚbodyAÚbodyBr  r  r  ÚfootAÚfootBÚ )Úfooterz%<tr><td>footA</td><th>footB</th></tr>r   N)r
   rk   r   r'   r(   )	rT   rP   Údata_templateÚ	expected1Ú	expected2rä   rå   Úresult1Ú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ÚIr`   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s-J ‚g d¢}g d¢}| |¡ ||¡}	| |¡}
|	}ddg}||  t¡||< t	 
||
¡ d S )Nr   ©Ú_remove_whitespacec                    s"   zˆ | ƒW S  t y   |  Y S w 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 RicoÚEurobankzSanderson State BankzWashington Mutual BankzSilver State BankzAmTrade International BankzHamilton Bank, NAzThe Citizens Savings BankrA  r@  )Úpandas.io.htmlr;  r   r   Úshaper%   ÚreplaceÚapplyr   r'   r(   )rT   r[   r   rP   r>  ro   Úground_truthÚoldÚnewÚdfnewÚgtnewÚ	convertedÚ	date_colsr   r:  r   Útest_banklist_headerá  s    þ
z!TestReadHtml.test_banklist_headerc                 C   sn   d}t |dd��}| ¡ }W d   ƒ n1 sw   Y  ||v s"J ‚||dddid�d }|| ¡ v s5J ‚d S )NzGold Canyonr�   rž   r¯   r°   r±   r   )r¥   r§   Ú	to_string)rT   r[   rP   Úgcr   Úraw_textro   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   ©rJ   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(   )rT   rP   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   ry   )r  r  ÚCr`   r  r  r   r   r   Útest_colspan_rowspan_1e  s   ÿÿïz#TestReadHtml.test_colspan_rowspan_1c                 C   ó:   |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   r5  )r  r  r  ÚZrW  )ÚXzX.1ÚYrZ  ÚWr  r  r  r   r   r   Ú test_colspan_rowspan_copy_values~  s   ÿîíÿz-TestReadHtml.test_colspan_rowspan_copy_valuesc                 C   rY  )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   r5  )r  r  r  r  ÚD)r  r  zB.1zB.2rW  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   r5  rW  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   r5  r  r  r  r  r  r   r   r   Útest_rowspan_only_rowsÞ  s   ÿ
õôz#TestReadHtml.test_rowspan_only_rowsc                 C   óV   |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  rz   r{   rs   ©ÚlevelsÚcodesr\   r  ©r   r   r
   r'   r(   ©rT   rP   r™   ra   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é
   ©Úperiodsrs   r   ©Úparse_datesrJ   )r
   r   rn   r   r'   r(   )rT   rP   ro   rŽ   rq   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 )Nrk  rl  rm  c                 S   ó   t |  ¡ ƒS r   )Ústrrj  r=  r   r   r   r"     ó    z7TestReadHtml.test_parse_dates_combine.<locals>.<lambda>c                 S   rr  r   )rs  Útimer=  r   r   r   r"     rt  )rj  ru  Údatetimers   r\   ro  r   )r   r   r
   r%   r   rn   r'   r(   )rT   rP   Ú	raw_datesro   rq   Ú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 |¡s%J t|ƒ› d�ƒ‚||ddd	�d
 }|jdks5J ‚d|jd v s>J ‚|d jt d¡ksJJ ‚t 	|j
d d¡sUJ ‚d S )Nr   r   r8   úwikipedia_states.htmlz is not a filez is an empty fileÚArizonars   r½   r   )é<   é   ÚUnnamedrÓ   úsq miÚfloat64)r   r  çHázPN$A)rð   rñ   ÚisfileÚreprÚgetsizerF  ra   ru   re   ÚallcloseÚloc©rT   r   rP   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 s"J ‚|jjdks*J ‚t |jd d¡s5J ‚d S )Nr   r   r8   rz  r{  r   rÛ   )r|  é   r~  rÓ   rs   r\   )ÚAlaska)zTotal area[2]r  r�  )rF  ra   Únlevelsre   r…  r†  r‡  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   rs   r5  rz   r{   )úUnnamed: 0_level_0r  )zUnnamed: 1_level_0r  r`   )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   r€  )r   r
   ru   re   r'   r(   r  r   r   r   Útest_decimal_rowsP  s   ÿíìzTestReadHtml.test_decimal_rowsÚargTFc                 C   sJ   t  d¡}tjt|d�� |||d� W d   ƒ d S 1 sw   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 namesr6   r5  )r  Úescaper<   r?   rØ   )rT   rX   r“  rP   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>rz   rB  r   z0.763z0.244)r   rs  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;Ï?)Ú	na_valuesr   rz   gÑ"Ûù~jè?©r   r
   re   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>rz   zN/Ar	   F)Úkeep_default_nar   T)r
   r   r'   r(   re   r’   )rT   rP   Ú	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   rz   r{   r  r  r  r˜  r  r   r   r   Útest_preserve_empty_rowsÇ  s   ÿÿí z%TestReadHtml.test_preserve_empty_rowsc                 C   rc  )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  rz   r{   rs   rd  r\   r  rg  rh  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))ÚHillaryéD   r_  )ÚBernieéJ   r_  )ÚDonaldéE   ÚR)r   )r�  ÚAgeÚParty)ÚNamezUnnamed: 1_level_1zUnnamed: 2_level_1Fr‚   r   )r
   ra   rn   r   r'   r(   )rT   rP   rœ  r8   r�  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   r8   rI   r   rU  )r   rj   r
   )rT   r   rP   rK   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   r8   rZ   r¬   rH   r4   rD   r   )rT   r   rP   r[   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-01rl  rm  r\   )rl  r]   r‚   )r   r
   re   rf   rg   Ústandard_normalrn   )rT   Úrngro   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 s0J ‚||ks6J ‚||ks<J ‚||ksBJ ‚d	|v sHJ ‚d
|vsNJ ‚d|vsTJ ‚||ksZJ ‚d S )Nrs   r\   ©r  r  T)Úborderr   Fz border="1"z border="2"z border="0"z border)r
   rn   )rT   ro   Úout_border_defaultÚout_border_trueÚout_border_explicit_defaultÚout_border_nondefaultÚout_border_zeroÚout_border_falser   r   r   Útest_to_html_borderless  s   z$TestReadHtml.test_to_html_borderlesszdisplayed_only,exp0,exp1ÚfooNzfoo  bar  baz  quxc                 C   sT   d}|t |ƒ|d�}t |d |¡ |d ur t |d |¡ d S t|ƒdks(J ‚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   rs   )r   r'   r(   r#   )rT   r¼  Úexp0Úexp1rP   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   rs   r]   r\   rÒ   r±  r  )rT   r¼  rP   Ú
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¡\}}zZt|dƒ�}|| ¡ |dd� ¡ }W d   ƒ n1 s1w   Y  t|dƒ�}|t| ¡ ƒ|dd� ¡ }	W d   ƒ n1 sSw   Y  |||dd� ¡ }
t	 
||	¡ t	 
||
¡ W d S  ty†   tƒ r…d|v s�d|v r…t ¡  ‚ w )Nr   Ú_Úrb)rŸ   rJ   Ú16Ú32)rð   rñ   ÚbasenameÚsplitextÚsplitr¥   r§   Úpopr   r'   r(   Ú	Exceptionr   r<   Úskip)rT   r   rP   Ú	base_pathÚrootrÂ  rŸ   ÚfobjÚfrom_stringÚfrom_file_likeÚfrom_filenamer   r   r   Útest_encodeh  s>   
ÿþÿÿþÿÿþûzTestReadHtml.test_encodec                 C   sz   |j  d¡dkrt d¡ G dd„ dtƒ}|dƒ}||ƒsJ ‚tjtdd�� ||ƒ W d   ƒ d S 1 s6w   Y  d S )	Nr;   rH   zNot applicable for lxmlc                   @   s   e Zd Zdd„ ZdS )zFTestReadHtml.test_parse_failure_unseekable.<locals>.UnseekableStringIOc                 S   r  ©NFr   r  r   r   r   Úseekable�  ó   zOTestReadHtml.test_parse_failure_unseekable.<locals>.UnseekableStringIO.seekableN)Ú__name__Ú
__module__Ú__qualname__rÔ  r   r   r   r   ÚUnseekableStringIO�  s    rÙ  z?
            <table><tr><td>spam<foobr />eggs</td></tr></table>z#passed a non-rewindable file objectr6   )ÚkeywordsÚgetr<   rË  r   r?   rE   )rT   rP   rÙ  Úbadr   r   r   Útest_parse_failure_unseekable‰  s   
ÿ
"ÿz*TestReadHtml.test_parse_failure_unseekablec                 C   s:   G dd„ dƒ}|dƒ}|dƒ}||ƒsJ ‚||ƒsJ ‚d S )Nc                   @   sF   e Zd Zddd„Zddd„Zdd„ Zd	d
„ Zdd„ Zdefdd„Z	dS )z9TestReadHtml.test_parse_failure_rewinds.<locals>.MockFileÚreturnNc                 S   s   || _ d| _d S rÓ  )r   Úat_end)rT   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)rß  r   )rT   Úsizer   r   r   r   r§   ¥  s   z>TestReadHtml.test_parse_failure_rewinds.<locals>.MockFile.readc                 S   s
   d| _ d S rÓ  )rß  )rT   Úoffsetr   r   r   Úseekª  s   
z>TestReadHtml.test_parse_failure_rewinds.<locals>.MockFile.seekc                 S   r  )NTr   r  r   r   r   rÔ  ­  rÕ  zBTestReadHtml.test_parse_failure_rewinds.<locals>.MockFile.seekablec                 S   s   d S r   r   r  r   r   r   Ú__next__±  rÕ  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__)rÞ  Nr   )
rÖ  r×  rØ  rà  r§   rã  rÔ  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   )rT   rP   ræ  ÚgoodrÜ  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�}| ¡  | ¡  | ¡ s.| ¡ r7	 | ¡ s.| ¡ s.d |j  u rD|ju sGJ ‚ J ‚d S )Nc                       s   e Zd Z‡ fdd„Z‡  ZS )z@TestReadHtml.test_importcheck_thread_safety.<locals>.ErrorThreadc              
      sF   zt ƒ  ¡  W n ty } z
|| _W Y d }~d S d }~ww d | _d S r   )ÚsuperÚrunrÊ  Úerr)rT   rë  ©Ú	__class__r   r   rê  Å  s   €ÿ
zDTestReadHtml.test_importcheck_thread_safety.<locals>.ErrorThread.run)rÖ  r×  rØ  rê  Ú__classcell__r   r   rì  r   ÚErrorThreadÄ  s    rï  r   r   r8   rI   )Útargetr,   )Ú	threadingÚThreadÚstartÚis_aliverë  )rT   r   rP   rï  rK   Úhelper_thread1Ú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   r8   r9   r   )r   r'   r(   )rT   r   rP   Ú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r4|d }|d }|d }n|dkr=|d }n|dkrF|d }n|dkrN|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¾   ©Úextract_linksr   r`   )r   r
   Úfillnare   r’   r'   r(   )
rT   r“  rP   Úgh_13141_dataÚgh_13141_expectedÚdata_expÚfoot_expÚhead_expr™   rŽ   r   r   r   Útest_extract_linksõ  s2   î


zTestReadHtml.test_extract_linksc                 C   sD   d}t jt|d�� t|dd� W d   ƒ d S 1 sw   Y  d S )NzY`extract_links` must be one of {None, "header", "footer", "body", "all"}, got "incorrect"r6   Ú	incorrectr  ©r<   r?   rE   r   )rT   rX   r.   r   r   r   Útest_extract_links_bad:  ó
   ÿ"ÿ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  ©rT   rP   r   r™   rŽ   r   r   r   Ú test_extract_links_all_no_headerB  s   	z-TestReadHtml.test_extract_links_all_no_headerc                 C   sD   d}t jt|d�� tddd� W d   ƒ d S 1 sw   Y  d S )NzPdtype_backend numpy is invalid, only 'numpy_nullable' and 'pyarrow' are allowed.r6   ÚtestÚnumpyr„   r  )rT   r.   r   r   r   Útest_invalid_dtype_backendQ  r  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   ÚA1ÚB1ÚA2ÚB2r  r  r  r  r  r   r   r   Útest_style_tagY  s   zTestReadHtml.test_style_tag)frÖ  r×  rØ  rU   r<   ÚfixturerX   r[   rr   r›   ÚmarkÚnetworkÚ
single_cpur«   r®   Ú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(  r4  r9  rP  rT  rV  rX  r^  r`  ra  rb  ri  rq  ry  rˆ  rŒ  r�  r’  Úparametrizer•  r–  r™  rž  rŸ  r   r«  r¬  r­  r°  r¹  r
   r¿  rÁ  ÚtdÚskip_if_windowsÚfilterwarningsrÒ  rÝ  rè  r÷  rú  rû  r  r  r  r  r!  r   r   r   r   rQ   l   s
    

6

		
	










0  &
/
H# 



þþ

ÿ"
DrQ   )1Úcollections.abcr   Ú	functoolsr   r   r   r   rð   Úpathlibr   r  rñ  Úurllib.errorr   r  re   r<   Úpandas.compatr   Úpandas.util._test_decoratorsÚutilÚ_test_decoratorsr(  Úpandasrh   r	   r
   r   r   r   r   r   r   r   Úpandas._testingÚ_testingr'   Úpandas.io.commonr   r"  r   r2   rB   rG   rN   r   Ú
skip_if_norP   rQ   r   r   r   r   Ú<module>   s>    ,ÿ
		þÿ
