o
    �¨ÊhIï  ã                   @  sþ  d dl mZ d dlmZmZ d dlmZ d dlZd dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlZd dlZd d	lmZ d d
lmZmZ d dlm  mZ d dlZd dlmZmZm Z  d dl!m"Z# d dl$m%Z%m&Z& d dl'm(Z( d dl)m*Z* d dl+m,Z, eg d¢g d¢dej-dgdœƒZ.dZ/dZ0eddddddœddddddœddddddœd d d d d dœd d d d d dœd!d"d#d$d%dœd&œƒZ1d'd(„ Z2ej3d)d*gd+�d,d-„ ƒZ4ej3ej5d.e 6d.¡d/�d0gd+�d1d2„ ƒZ7d3d4„ Z8d5d6„ Z9d7d8„ Z:ej;j<ej;j=d9d:„ ƒƒZ>d;d<„ Z?d=d>„ Z@d?d@„ ZAdAdB„ ZBdCdD„ ZCdEdF„ ZDdGdH„ ZEej; FdIdJdKg¡dLdM„ ƒZGej; FdIdJdKg¡dNdO„ ƒZHdPdQ„ ZIej;j<ej;j=dRdS„ ƒƒZJej;j<ej;j=dTdU„ ƒƒZKdVdW„ ZLdXdY„ ZMdZd[„ ZNd\d]„ ZOd^d_„ ZPd`da„ ZQdbdc„ ZRddde„ ZSdfdg„ ZTdhdi„ ZUdjdk„ ZVej; FdldJdg¡dmdn„ ƒZWdodp„ ZXdqdr„ ZYdsdt„ ZZdudv„ Z[dwdx„ Z\dydz„ Z]d{d|„ Z^d}d~„ Z_dd€„ Z`d�d‚„ Zadƒd„„ Zbd…d†„ Zcd‡dˆ„ Zdd‰dŠ„ Zed‹dŒ„ Zfd�dŽ„ Zgd�d�„ Zhd‘d’„ Zid“d”„ Zjd•d–„ Zke ld.¡d—d˜„ ƒZmd™dš„ Znd›dœ„ Zod�dž„ ZpdŸd „ Zqd¡d¢„ Zrd£d¤„ Zsd¥d¦„ Ztd§d¨„ Zud©dª„ Zvd«d¬„ Zwd­d®„ Zxd¯d°„ Zyd±d²„ Zzej; FdIdJdKg¡d³d´„ ƒZ{dµd¶„ Z|d·d¸„ Z}ej;j<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‹ej;j<ej;j=dÕdÖ„ ƒƒZŒd×dØ„ Z�dÙdÚ„ ZŽdS )Ûé    )Úannotations)ÚBytesIOÚStringIO)Ú	LZMAErrorN)Ú	ReadError)Ú	HTTPError)Ú
ParseError)Ú
BadZipFile)Úimport_optional_dependency)ÚEmptyDataErrorÚParserError)ÚNAÚ	DataFrameÚSeries)ÚArrowStringArrayÚStringArray)ÚArrowStringArrayNumpySemantics)Ú
get_handle)Úread_xml©ÚsquareÚcircleÚtriangle©éh  r   é´   é   é   ©ÚshapeÚdegreesÚsidesa[  <?xml version='1.0' encoding='utf-8'?>
<data xmlns="http://example.com">
  <row>
    <shape>square</shape>
    <degrees>360</degrees>
    <sides>4</sides>
  </row>
  <row>
    <shape>circle</shape>
    <degrees>360</degrees>
    <sides/>
  </row>
  <row>
    <shape>triangle</shape>
    <degrees>180</degrees>
    <sides>3</sides>
  </row>
</data>aÇ  <?xml version='1.0' encoding='utf-8'?>
<doc:data xmlns:doc="http://example.com">
  <doc:row>
    <doc:shape>square</doc:shape>
    <doc:degrees>360</doc:degrees>
    <doc:sides>4.0</doc:sides>
  </doc:row>
  <doc:row>
    <doc:shape>circle</doc:shape>
    <doc:degrees>360</doc:degrees>
    <doc:sides/>
  </doc:row>
  <doc:row>
    <doc:shape>triangle</doc:shape>
    <doc:degrees>180</doc:degrees>
    <doc:sides>3.0</doc:sides>
  </doc:row>
</doc:data>ÚID_00001ÚID_00002ÚID_00003ÚID_00004ÚID_00005©r   é   é   r   r   zBlue Line (Forest Park)zRed, Purple Linez#LineStyle01ÚclampedToGroundzæ-87.77678526964958,41.8708863930319,0 -87.77826234150609,41.87097820122218,0 -87.78251583439344,41.87130129991005,0 -87.78418294588424,41.87145055520308,0 -87.7872369165933,41.8717239119163,0 -87.79160214925886,41.87210797280065,0a\  -87.65758750947528,41.96427269188822,0 -87.65802133507393,41.96581929055245,0 -87.65819033925305,41.96621846093642,0 -87.6583189819129,41.96650362897086,0 -87.65835858701473,41.96669002089185,0 -87.65838428411853,41.96688150295095,0 -87.65842208882658,41.96745896091846,0 -87.65846556843937,41.9683761425439,0 -87.65849296214573,41.96913893870342,0a”  -87.65492939166126,41.95377494531437,0 -87.65557043199591,41.95376544118533,0 -87.65606302030132,41.95376391658746,0 -87.65623502146268,41.95377379126367,0 -87.65634748981634,41.95380103566435,0 -87.65646537904269,41.95387703994676,0 -87.65656532461145,41.95396622645799,0 -87.65664760856414,41.95404201996044,0 -87.65671750555913,41.95416647054043,0 -87.65673983607117,41.95429949810849,0 -87.65673866475777,41.95441024240925,0 -87.6567690255541,41.95490657227902,0 -87.65683672482363,41.95692259283837,0 -87.6568900886376,41.95861070983142,0 -87.65699865558875,41.96181418669004,0 -87.65756347177603,41.96397045777844,0 -87.65758750947528,41.96427269188822,0ah  -87.65362593118043,41.94742799535678,0 -87.65363554415794,41.94819886386848,0 -87.6536456393239,41.95059994675451,0 -87.65365831235026,41.95108288489359,0 -87.6536604873874,41.9519954657554,0 -87.65362592053201,41.95245597302328,0 -87.65367158496069,41.95311153649393,0 -87.65368468595476,41.9533202828916,0 -87.65369271253692,41.95343095587119,0 -87.65373335834569,41.95351536301472,0 -87.65378605844126,41.95358212680591,0 -87.65385067928185,41.95364452823767,0 -87.6539390793817,41.95370263886964,0 -87.6540786298351,41.95373403675265,0 -87.65430648647626,41.9537535411832,0 -87.65492939166126,41.95377494531437,0a   -87.65345391792157,41.94217681262115,0 -87.65342448305786,41.94237224420864,0 -87.65339745703922,41.94268217746244,0 -87.65337753982941,41.94288140770284,0 -87.65336256753105,41.94317369618263,0 -87.65338799707138,41.94357253961736,0 -87.65340240886648,41.94389158188269,0 -87.65341837392448,41.94406444407721,0 -87.65342275247338,41.94421065714904,0 -87.65347469646018,41.94434829382345,0 -87.65351486483024,41.94447699917548,0 -87.65353483605053,41.9453896864472,0 -87.65361975532807,41.94689193720703,0 -87.65362593118043,41.94742799535678,0©ÚidÚnameÚstyleUrlÚextrudeÚaltitudeModeÚcoordinatesc                  C  sJ   t  d¡ d} tjt| d�� ttƒ W d   ƒ d S 1 sw   Y  d S )NÚlxmlú—Passing literal xml to 'read_xml' is deprecated and will be removed in a future version. To read from a literal string, wrap it in a 'StringIO' object.©Úmatch)ÚpytestÚimportorskipÚtmÚassert_produces_warningÚFutureWarningr   Úxml_default_nmsp©Úmsg© r>   úN/var/www/html/env/lib/python3.10/site-packages/pandas/tests/io/xml/test_xml.pyÚtest_literal_xml_deprecationú   s   
ÿ
"ÿr@   ÚrbÚr)Úparamsc                 C  ó   | j S ©N©Úparam©Úrequestr>   r>   r?   Úmode  ó   rJ   r2   )ÚmarksÚetreec                 C  rD   rE   rF   rH   r>   r>   r?   Úparser  rK   rN   c              	   K  st   t  ¡ �,}t|ddd��}| | ¡ W d   ƒ n1 sw   Y  t|fi |¤ŽW  d   ƒ S 1 s3w   Y  d S )NÚwúutf-8©Úencoding)r8   Úensure_cleanÚopenÚwriter   )ÚdataÚkwargsÚpathÚfr>   r>   r?   Úread_xml_iterparse  s   
ÿ$ýrZ   c              
   K  s¸   t | d|d��K}t ¡ �6}t|ddd��}| |j ¡ ¡ W d   ƒ n1 s'w   Y  t|fi |¤ŽW  d   ƒ W  d   ƒ S 1 sEw   Y  W d   ƒ d S 1 sUw   Y  d S )NrB   )ÚcompressionrO   rP   rQ   )r   r8   rS   rT   rU   ÚhandleÚreadr   )Ú	comp_pathÚcompression_onlyrW   ÚhandlesrX   rY   r>   r>   r?   Úread_xml_iterparse_comp  s   
ÿýÿ"ÿra   c                 C  sv   t  d¡ t| dd�}t| dd�}t| ddg d¢id�}t| ddg d¢id�}t ||¡ t ||¡ t ||¡ d S )Nr2   ©rN   rM   Úbook©ÚcategoryÚtitleÚyearÚauthorÚprice©rN   Ú	iterparse©r6   r7   r   r8   Úassert_frame_equal)Ú	xml_booksÚdf_file_lxmlÚdf_file_etreeÚdf_iter_lxmlÚdf_iter_etreer>   r>   r?   Útest_parser_consistency_file#  s    

ý
ýrs   c                 C  sJ   |j td� tttƒ| d�}ttt ¡ ƒ| dg d¢id�}t ||¡ d S )N©Úcontentrb   Úrowr   rj   )Úserve_contentr;   r   r   r   Úencoder8   rm   )rN   Ú
httpserverÚdf_xpathÚdf_iterr>   r>   r?   Útest_parser_consistency_url8  s   

ýr|   c                 C  s~   t | ||dkr	dnd d��}t||d�}W d   ƒ n1 sw   Y  tg d¢g d¢g d¢g d¢g d	¢d
œƒ}t ||¡ d S ©NrB   rP   rQ   rb   ©ÚcookingÚchildrenÚweb©zEveryday ItalianzHarry PotterzLearning XML©zGiada De LaurentiiszJ K. RowlingzErik T. Ray©éÕ  r…   iÓ  ©g      >@g=
×£pý=@gš™™™™ùC@©re   rf   rh   rg   ri   )rT   r   r   r8   rm   )rn   rN   rJ   rY   Údf_fileÚdf_expectedr>   r>   r?   Útest_file_likeG  s   ÿûÿ
rŠ   c                 C  sœ   t | ||dkr	dnd d��}| ¡ }W d   ƒ n1 sw   Y  tt|tƒr+t|ƒnt|ƒ|d�}tg d¢g d¢g d¢g d¢g d	¢d
œƒ}t 	||¡ d S r}   )
rT   r]   r   Ú
isinstanceÚbytesr   r   r   r8   rm   )rn   rN   rJ   rY   Úxml_objÚdf_ior‰   r>   r>   r?   Útest_file_ioX  s    
ÿþûÿ
r�   c                 C  s¬   t | ||dkr	dnd d��}| ¡ }W d   ƒ n1 sw   Y  |dkr,t| ¡ ƒ}n|dkr4t|ƒ}t||d�}tg d¢g d¢g d¢g d	¢g d
¢dœƒ}t ||¡ d S ©NrB   rP   rQ   rA   rb   r~   r‚   rƒ   r„   r†   r‡   )rT   r]   r   Údecoder   r   r8   rm   ©rn   rN   rJ   rY   r�   Údf_strr‰   r>   r>   r?   Ú test_file_buffered_reader_stringn  s"   
ÿûÿ
r”   c                 C  s´   t | ||dkr	dnd d��}t|ƒ | ¡ }W d   ƒ n1 s w   Y  |dkr0t| ¡ ƒ}n|dkr8t|ƒ}t||d�}tg d¢g d¢g d¢g d	¢g d
¢dœƒ}t ||¡ d S r�   )	rT   Únextr]   r   r‘   r   r   r8   rm   r’   r>   r>   r?   Ú,test_file_buffered_reader_no_xml_declaration†  s$   
þûÿ
r–   c                 C  s8   d}t t|ƒ| d�}tdddœdgd�}t ||¡ d S )Nõ<   <ä¸­æ–‡æ¨™ç±¤><row><c1>1</c1><c2>2</c2></row></ä¸­æ–‡æ¨™ç±¤>rb   r(   r)   )Úc1Úc2r   )Úindex©r   r   r   r8   rm   )rN   Útxtr“   r‰   r>   r>   r?   Útest_string_charsetŸ  s   r�   c                 C  sD   t | |d�}tg d¢d ddg¡d dgg d¢dœƒ}t ||¡ d S )	Nrb   )uP   å•�  è‹¥ç®‡æ˜¯é‚ªè€Œè¨€ç ´é‚ª ä½•è€…æ˜¯æ­£è€Œé�“(Sorry, this is Big5 only)ç”³æ­£u;   å•� æ—¢ç ´æœ‰å¾—ç”³ç„¡å¾— äº¦æ‡‰ä½†ç ´æ€§åŸ·ç”³å�‡å��ä»¥ä¸�uO   å•� æ—¢ç ´æ€§ç”³å�‡ äº¦æ‡‰ä½†ç ´æœ‰ç”³ç„¡ è‹¥æœ‰ç„¡å…©æ´— äº¦æ‡‰æ€§å�‡é›™ç ´è€¶Ú u<   ç­”  é‚ªæ—¢ç„¡é‡� æ­£äº¦å¤šé€”  å¤§ç•¥ç‚ºè¨€ä¸�å‡ºäºŒç¨® è¬‚u;   æœ‰å¾—èˆ‡ç„¡å¾— æœ‰å¾—æ˜¯é‚ªé ˆç ´ ç„¡å¾—æ˜¯æ­£é ˆç”³
		æ•…uL   ç­”  ä¸�ä¾‹  æœ‰ç„¡çš†æ˜¯æ€§ æ‰€ä»¥é ˆé›™ç ´ æ—¢åˆ†æ€§å�‡ç•° æ•…æœ‰ç ´ä¸�ç ´)NuV   ç­” æ€§åŸ·æ˜¯æœ‰å¾— å�‡å��æ˜¯ç„¡å¾—  ä»Šç ´æœ‰å¾—ç”³ç„¡å¾— å�³æ˜¯ç ´æ€§åŸ·ç”³å�‡å��ä¹ŸN)u   å•�u   ç­”Úa)r   r   Újoinr8   rm   )Úxml_doc_ch_utfrN   rˆ   r‰   r>   r>   r?   Útest_file_charset©  s   þÿø
ðÿr¢   c                 C  sN   t | dƒ�}tt| ¡ ƒ|d� |jrJ ‚W d   ƒ d S 1 s w   Y  d S )NrA   rb   )rT   r   r   r]   Úclosed)rn   rN   rY   r>   r>   r?   Útest_file_handle_closeÈ  s   "ýr¤   Úvalrž   ó    c                 C  sŠ   t  d¡}d ddg¡}t j|j|d��' t| tƒr#tt| ƒdd� ntt	| ƒdd� W d   ƒ d S W d   ƒ d S 1 s>w   Y  d S )Nú
lxml.etreeú|zDocument is emptyzNone \(line 0\)r4   r2   rb   )
r6   r7   r    ÚraisesÚXMLSyntaxErrorr‹   Ústrr   r   r   )r¥   Ú
lxml_etreer=   r>   r>   r?   Útest_empty_string_lxmlÏ  s   
ýÿ
ü"þr­   c                 C  sp   t jtdd��' t| tƒrtt| ƒdd� ntt| ƒdd� W d   ƒ d S W d   ƒ d S 1 s1w   Y  d S )Nzno element foundr4   rM   rb   )r6   r©   r   r‹   r«   r   r   r   )r¥   r>   r>   r?   Útest_empty_string_etreeá  s   
ü"þr®   c                 C  sT   d}t j ddd¡}tjt|d�� t|| d� W d   ƒ d S 1 s#w   Y  d S )Nr3   rV   Úhtmlz	books.xmlr4   rb   )ÚosrX   r    r6   r©   r:   r   )rN   r=   Úfilenamer>   r>   r?   Útest_wrong_file_pathê  s   ÿþ"ür²   c                 C  sŒ   t  d¡ t|dd��}| j| ¡ d� t| jdd�}W d   ƒ n1 s%w   Y  tg d¢g d¢g d	¢g d
¢g d¢dœƒ}t 	||¡ d S )Nr2   rP   rQ   rt   ú.//book[count(*)=4]©Úxpathr~   r‚   rƒ   r„   r†   r‡   )
r6   r7   rT   rw   r]   r   Úurlr   r8   rm   )ry   Úxml_filerY   Údf_urlr‰   r>   r>   r?   Útest_urlù  s   
þûÿ
r¹   c                 C  sR   |j ddd� tjtdd�� t|jd| d� W d   ƒ d S 1 s"w   Y  d S )Nz	NOT FOUNDi”  )ÚcodezHTTP Error 404: NOT FOUNDr4   r³   ©rµ   rN   )rw   r6   r©   r   r   r¶   )rN   ry   r>   r>   r?   Útest_wrong_url  s   "ÿr¼   c                 C  sj   d}t t|ƒ| dd�}t|| dg d¢idd�}tg d¢g d¢g d	¢dœdd
�}t ||¡ t ||¡ d S )NaÍ  
      <data>
        <row sides=" 4 ">
          <shape>
              square
          </shape>
          <degrees>&#009;360&#009;</degrees>
        </row>
        <row sides=" 0 ">
          <shape>
              circle
          </shape>
          <degrees>&#009;360&#009;</degrees>
        </row>
        <row sides=" 3 ">
          <shape>
              triangle
          </shape>
          <degrees>&#009;180&#009;</degrees>
        </row>
      </data>Ústring)rN   Údtyperv   )r!   r   r    )rN   rk   r¾   )z 4 z 0 z 3 )z 
              square
          z 
              circle
          z"
              triangle
          )ú	360	r¿   z	180	©r¾   ©r   r   rZ   r   r8   rm   ©rN   Úxmlrz   r{   r‰   r>   r>   r?   Útest_whitespace  s"   
üù	örÄ   c                 C  sL   t  d¡ t jtdd�� t| ddd� W d   ƒ d S 1 sw   Y  d S )Nr2   úxpath does not return any nodesr4   z	.//pythonr»   ©r6   r7   r©   Ú
ValueErrorr   ©rn   r>   r>   r?   Útest_empty_xpath_lxmlM  s   
"ÿrÉ   c                 C  óB   t jtdd�� t| ddd� W d   ƒ d S 1 sw   Y  d S )Nz/You have used an incorrect or unsupported XPathr4   ú	.//[book]rM   r»   ©r6   r©   ÚSyntaxErrorr   rÈ   r>   r>   r?   Útest_bad_xpath_etreeS  s
   ÿ"ýrÎ   c                 C  óN   t  d¡}t j|jdd�� t| ddd� W d   ƒ d S 1 s w   Y  d S )Nr§   zInvalid expressionr4   rË   r2   r»   ©r6   r7   r©   ÚXPathEvalErrorr   )rn   r¬   r>   r>   r?   Útest_bad_xpath_lxmlZ  ó   
"ÿrÒ   c                 C  ól   t ttƒdddi| d�}tt| dg d¢id�}tg d¢g d	¢d
tdƒdgdœƒ}t ||¡ t ||¡ d S )Nú	.//ns:rowÚnsúhttp://example.com©rµ   Ú
namespacesrN   rv   r   rj   r   r   ç      @Únanç      @)r   r   r;   rZ   r   Úfloatr8   rm   ©rN   Údf_nmspr{   r‰   r>   r>   r?   Útest_default_namespaced  s&   ü
ýýÿrà   c                 C  rÔ   )Nú
.//doc:rowÚdocr×   rØ   rv   r   rj   r   r   rÚ   rÛ   rÜ   )r   r   Úxml_prefix_nmsprZ   r   rÝ   r8   rm   rÞ   r>   r>   r?   Útest_prefix_namespace~  s"   üÿýÿrä   c                  C  sJ   t  d¡ tttƒdddidd�} tttƒdddidd�}t | |¡ d S )	Nr2   rÕ   rÖ   r×   rØ   rá   râ   rM   )r6   r7   r   r   r;   r8   rm   ©Údf_lxmlÚdf_etreer>   r>   r?   Ú"test_consistency_default_namespace•  ó   
üürè   c                  C  sJ   t  d¡ tttƒdddidd�} tttƒdddidd�}t | |¡ d S )Nr2   rá   râ   r×   rØ   rM   )r6   r7   r   r   rã   r8   rm   rå   r>   r>   r?   Ú!test_consistency_prefix_namespace¨  ré   rê   c                 C  óB   t jtdd�� t| d|d� W d   ƒ d S 1 sw   Y  d S )NrÅ   r4   z.//Placemarkr»   ©r6   r©   rÇ   r   ©rn   rN   r>   r>   r?   Ú*test_missing_prefix_with_default_namespace¾  ó   "ÿrî   c                 C  rÊ   )Nz'you used an undeclared namespace prefixr4   ú.//kml:PlacemarkrM   r»   rÌ   )Úkml_cta_rail_linesr>   r>   r?   Ú$test_missing_prefix_definition_etreeÃ  rï   rò   c                 C  rÏ   )Nr§   zUndefined namespace prefixr4   rð   r2   r»   rÐ   )rñ   r¬   r>   r>   r?   Ú#test_missing_prefix_definition_lxmlÈ  rÓ   ró   Úkeyc                 C  sV   t  d¡ t jtdd�� tttƒd| didd� W d   ƒ d S 1 s$w   Y  d S )Nr2   z0empty namespace prefix is not supported in XPathr4   rð   úhttp://www.opengis.net/kml/2.2rØ   )r6   r7   r©   Ú	TypeErrorr   r   r;   )rô   r>   r>   r?   Útest_none_namespace_prefixÏ  s   
ÿü"ýr÷   c                 C  sf   t | |d�}t | |dg d¢id�}tg d¢g d¢g d¢g d¢g d	¢dœƒ}t ||¡ t ||¡ d S )
Nrb   rc   r‡   rj   r~   r‚   rƒ   r„   r†   ©r   r   r8   rm   ©rn   rN   rˆ   r{   r‰   r>   r>   r?   Útest_file_elems_and_attrsà  s    
ýûÿ
rú   c                 C  sN   t | d|d�}t | |ddgid�}tdg d¢iƒ}t ||¡ t ||¡ d S )NT)Ú
attrs_onlyrN   rc   re   rj   r~   rø   rù   r>   r>   r?   Útest_file_only_attrsõ  s
   rü   c                 C  sb   t | d|d�}t | |dg d¢id�}tg d¢g d¢g d¢g d	¢dœƒ}t ||¡ t ||¡ d S )
NT)Ú
elems_onlyrN   rc   )rf   rh   rg   ri   rj   r‚   rƒ   r„   r†   rø   rù   r>   r>   r?   Útest_file_only_elemsþ  s   
ýüÿ	rþ   c                 C  sD   t jtdd�� t| dd|d� W d   ƒ d S 1 sw   Y  d S )Nz3Either element or attributes can be parsed not bothr4   T)rý   rû   rN   rì   )rñ   rN   r>   r>   r?   Útest_elem_and_attrs_only  s   þ"ürÿ   c                 C  óL   d}t jtdd�� tt|ƒdd| d� W d   ƒ d S 1 sw   Y  d S )NaU  
      <data>
        <row>
          <shape sides="4">square</shape>
          <degrees>360</degrees>
        </row>
        <row>
          <shape sides="0">circle</shape>
          <degrees>360</degrees>
        </row>
        <row>
          <shape sides="3">triangle</shape>
          <degrees>180</degrees>
        </row>
      </data>ú-xpath does not return any nodes or attributesr4   ú./rowT)rµ   rû   rN   ©r6   r©   rÇ   r   r   ©rN   rÃ   r>   r>   r?   Útest_empty_attrs_only  s   þ"ür  c                 C  r   )Nz¿
      <data>
        <row sides="4" shape="square" degrees="360"/>
        <row sides="0" shape="circle" degrees="360"/>
        <row sides="3" shape="triangle" degrees="180"/>
      </data>r  r4   r  T)rµ   rý   rN   r  r  r>   r>   r?   Útest_empty_elems_only2  s   þ"ür  c                  C  sv   t  d¡ d} tt| ƒdd�}tt| ƒddd�}t| ddd	gid
�}t| dddd	gid�}t ||¡ t ||¡ d S )Nr2   aº  <?xml version="1.0" encoding="UTF-8"?>
<TrainSchedule>
      <Stations>
         <station Name="Manhattan" coords="31,460,195,498"/>
         <station Name="Laraway Road" coords="63,409,194,455"/>
         <station Name="179th St (Orland Park)" coords="0,364,110,395"/>
         <station Name="153rd St (Orland Park)" coords="7,333,113,362"/>
         <station Name="143rd St (Orland Park)" coords="17,297,115,330"/>
         <station Name="Palos Park" coords="128,281,239,303"/>
         <station Name="Palos Heights" coords="148,257,283,279"/>
         <station Name="Worth" coords="170,230,248,255"/>
         <station Name="Chicago Ridge" coords="70,187,208,214"/>
         <station Name="Oak Lawn" coords="166,159,266,185"/>
         <station Name="Ashburn" coords="197,133,336,157"/>
         <station Name="Wrightwood" coords="219,106,340,133"/>
         <station Name="Chicago Union Sta" coords="220,0,360,43"/>
      </Stations>
</TrainSchedule>z
.//stationr´   rM   r»   ÚstationÚNameÚcoords©rk   rj   )r6   r7   r   r   rZ   r8   rm   )rÃ   ræ   rç   Ú
df_iter_lxÚ
df_iter_etr>   r>   r?   Útest_attribute_centric_xmlA  s   
ÿr  c                 C  sr   t | g d¢|d�}t | |g d¢dg d¢id�}tg d¢g d¢g d¢g d	¢g d
¢dœƒ}t ||¡ t ||¡ d S )N)ÚCol1ÚCol2ÚCol3ÚCol4ÚCol5©ÚnamesrN   rc   r‡   )rN   r  rk   r~   r‚   rƒ   r„   r†   rø   rù   r>   r>   r?   Útest_names_option_outputf  s&   
ÿ
üûÿ
r  c                 C  sp   d}t t|ƒd| g d¢d�}t|| dg d¢ig d¢d�}tdd	gd
dgddgdœƒ}t ||¡ t ||¡ d S )Nz°<shapes>
  <shape type="2D">
    <name>circle</name>
    <type>curved</type>
  </shape>
  <shape type="3D">
    <name>sphere</name>
    <type>curved</type>
  </shape>
</shapes>ú.//shape)Útype_dimr   Ú	type_edge©rµ   rN   r  r   )Útyper-   r  ©rN   rk   r  Ú2DÚ3Dr   ÚsphereÚcurvedrÁ   rÂ   r>   r>   r?   Útest_repeat_names  s*   ü
üýÿr   c                 C  sj   d}t t|ƒd| ddgd�}t|| dddgiddgd�}tg d	¢g d
¢dœƒ}t ||¡ t ||¡ d S )NaB  <shapes>
  <shape>
    <name>rectangle</name>
    <family>rectangle</family>
  </shape>
  <shape>
    <name>square</name>
    <family>rectangle</family>
  </shape>
  <shape>
    <name>ellipse</name>
    <family>ellipse</family>
  </shape>
  <shape>
    <name>circle</name>
    <family>ellipse</family>
  </shape>
</shapes>r  r-   Úgroupr  r   Úfamilyr  )Ú	rectangler   Úellipser   )r#  r#  r$  r$  )r-   r!  rÁ   rÂ   r>   r>   r?   Útest_repeat_values_new_names¥  s"   ÿ
üþÿr%  c                 C  sv   d}t t|ƒd| g d¢d�}t|| dg d¢ig d¢d�}tg d¢g d	¢g d
¢g d¢dœƒ}t ||¡ t ||¡ d S )Na  <shapes>
  <shape>
    <value item="name">circle</value>
    <value item="family">ellipse</value>
    <value item="degrees">360</value>
    <value item="sides">0</value>
  </shape>
  <shape>
    <value item="name">triangle</value>
    <value item="family">polygon</value>
    <value item="degrees">180</value>
    <value item="sides">3</value>
  </shape>
  <shape>
    <value item="name">square</value>
    <value item="family">polygon</value>
    <value item="degrees">360</value>
    <value item="sides">4</value>
  </shape>
</shapes>r  )r-   r"  r    r!   r  r   )Úvaluer&  r&  r&  r  )r   r   r   )r$  Úpolygonr'  )r   r   r   )r   r   r   rÁ   rÂ   r>   r>   r?   Útest_repeat_elementsÏ  s,   ü
üüÿ	r(  c                 C  sF   t jtdd�� t| g d¢|d� W d   ƒ d S 1 sw   Y  d S )Nznames does not match lengthr4   )r  r  r  r  rì   rí   r>   r>   r?   Útest_names_option_wrong_length   s   "ÿr)  c                 C  rë   )Nzis not a valid type for namesr4   zCol1, Col2, Col3r  ©r6   r©   rö   r   rí   r>   r>   r?   Útest_names_option_wrong_type  rï   r+  c                 C  s@   t jtdd�� t| |d� W d   ƒ d S 1 sw   Y  d S )Nz'utf-8' codec can't decoder4   rb   ©r6   r©   ÚUnicodeDecodeErrorr   ©Úxml_baby_namesrN   r>   r>   r?   Útest_wrong_encoding  s   "ÿr0  c                 C  rë   )NzLUTF-16 stream does not start with BOM|'utf-16(-le)?' codec can't decode byter4   zUTF-16©rR   rN   )r6   r©   ÚUnicodeErrorr   r.  r>   r>   r?   Útest_utf16_encoding  s   ý"ùr3  c                 C  rë   )Nzunknown encoding: UFT-8r4   zUFT-8r1  )r6   r©   ÚLookupErrorr   r.  r>   r>   r?   Útest_unknown_encoding  rï   r5  c                 C  rë   )Nz'ascii' codec can't decode byter4   Úasciir1  r,  r.  r>   r>   r?   Útest_ascii_encoding"  rï   r7  c                 C  s~   t  d¡ t| ddd�}t| ddd�}t| dddg d¢id�}t| dddg d¢id�}t ||¡ t ||¡ t ||¡ d S )	Nr2   z
ISO-8859-1©rN   rR   rM   z
iso-8859-1rv   )ÚrankÚmalenameÚ
femalename)rN   rR   rk   rl   )r/  Údf_xpath_lxmlÚdf_xpath_etreerq   rr   r>   r>   r?   Ú%test_parser_consistency_with_encoding'  s$   

ü
ür>  c                  C  sT   t  d¡ d} t jtdd�� tt| ƒdd d� W d   ƒ d S 1 s#w   Y  d S )Nr2   ú-<data>
  <row>
    <a>c</a>
  </row>
</data>
zencoding Noner4   r8  )r6   r7   r©   rö   r   r   )rV   r>   r>   r?   Útest_wrong_encoding_for_lxml>  s
   
"ÿr@  c                  C  s4   d} t t| ƒdd d�}tddgiƒ}t ||¡ d S )Nr?  rM   r8  rŸ   Úcr›   )rV   ÚresultÚexpectedr>   r>   r?   Útest_none_encoding_etreeK  s   rD  c                 C  s<   t jtdd�� t| ƒ W d   ƒ d S 1 sw   Y  d S )Nz7lxml not found, please install or use the etree parser.r4   )r6   r©   ÚImportErrorr   rÈ   r>   r>   r?   Útest_default_parser_no_lxml[  s
   ÿ
"ýrF  c                 C  s@   t jtdd�� t| dd� W d   ƒ d S 1 sw   Y  d S )Nz,Values for parser can only be lxml or etree.r4   Úbs4rb   rì   rÈ   r>   r>   r?   Útest_wrong_parserc  s
   ÿ"ýrH  c                 C  sN   t  d¡ t| dddi|d�}t| dg d¢id�}t t|¡ t t|¡ d S )	Nr2   ú.//k:PlacemarkÚkrõ   ©rµ   rÙ   Ú
stylesheetÚ	Placemarkr+   r
  )r6   r7   r   r8   rm   Údf_kml)rñ   Úxsl_flatten_docÚdf_styler{   r>   r>   r?   Útest_stylesheet_filem  s   
üÿþrQ  c                 C  sh   t  d¡ t|||dkrdnd d��}t| dddi|d�}W d   ƒ n1 s'w   Y  t t|¡ d S ©	Nr2   rB   rP   rQ   rI  rJ  rõ   rK  )r6   r7   rT   r   r8   rm   rN  )rñ   rO  rJ   rY   rP  r>   r>   r?   Útest_stylesheet_file_likeˆ  s   
üÿrS  c                 C  sŠ   t  d¡ t|||dkrdnd d��}|dkrt| ¡ ƒ}nt| ¡ ƒ}W d   ƒ n1 s.w   Y  t| dddi|d	�}t t	|¡ d S )
Nr2   rB   rP   rQ   rA   rI  rJ  rõ   rK  )
r6   r7   rT   r   r]   r   r   r8   rm   rN  ©rñ   rO  rJ   rY   Úxsl_objrP  r>   r>   r?   Útest_stylesheet_io•  s   
€üürV  c                 C  sp   t  d¡ t|||dkrdnd d��}| ¡ }W d   ƒ n1 s!w   Y  t| dddi|d�}t t|¡ d S rR  )r6   r7   rT   r]   r   r8   rm   rN  rT  r>   r>   r?   Útest_stylesheet_buffered_reader«  s   

ÿürW  c                  C  s>   t  d¡ d} d}tt| ƒƒ}tt| ƒ|d�}t ||¡ d S )Nr2   r—   u­  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>

 <xsl:template match="node()|@*">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
 </xsl:template>

 <xsl:template match="ä¸­æ–‡æ¨™ç±¤">
     <æ ¹>
       <xsl:apply-templates />
     </æ ¹>
 </xsl:template>

</xsl:stylesheet>©rL  )r6   r7   r   r   r8   rm   )rÃ   ÚxslÚdf_origrP  r>   r>   r?   Útest_style_charsetº  s   
r[  c                 C  sL   t  d¡}t j|jdd�� t| |d� W d   ƒ d S 1 sw   Y  d S )Nr§   zdocument is not a stylesheetr4   rX  ©r6   r7   r©   ÚXSLTParseErrorr   )rñ   rn   r¬   r>   r>   r?   Útest_not_stylesheet×  s   
ÿ"ýr^  c                 C  óP   t  d¡}d}t j|jdd�� t| |d� W d   ƒ d S 1 s!w   Y  d S )Nr§   a‹  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:k="http://www.opengis.net/kml/2.2"/>
    <xsl:output method="xml" omit-xml-declaration="yes"
                cdata-section-elements="k:description" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="node()|@*">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
    </xsl:template>

    <xsl:template match="k:MultiGeometry|k:LineString">
        <xsl:apply-templates select='*'/>
    </xsl:template>

    <xsl:template match="k:description|k:Snippet|k:Style"/>
</xsl:stylesheet>z(Extra content at the end of the documentr4   rX  ©r6   r7   r©   rª   r   ©rñ   r¬   rY  r>   r>   r?   Útest_incorrect_xsl_syntaxà  s   
ÿ"ýrb  c                 C  r_  )Nr§   a‹  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:k="http://www.opengis.net/kml/2.2">
    <xsl:output method="xml" omit-xml-declaration="yes"
                cdata-section-elements="k:description" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="node(*)|@*">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
    </xsl:template>

    <xsl:template match="k:MultiGeometry|k:LineString">
        <xsl:apply-templates select='*'/>
    </xsl:template>

    <xsl:template match="k:description|k:Snippet|k:Style"/>
</xsl:stylesheet>zfailed to compiler4   rX  r\  ra  r>   r>   r?   Útest_incorrect_xsl_evalý  s
   
"ÿrc  c                 C  r_  )Nr§   ag  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="yes" />
    <xsl:strip-space elements="*"/>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:copy-of select="document('non_existent.xml')/*"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>zCannot resolve URIr4   rX  )r6   r7   r©   ÚXSLTApplyErrorr   ra  r>   r>   r?   Útest_incorrect_xsl_apply  s
   
"ÿre  c                 C  sT   t  d¡}|d }t j|jdd�� t| |d� W d   ƒ d S 1 s#w   Y  d S )Nr§   zflatten.xslz!Start tag expected, '<' not foundr4   rX  r`  )rñ   Úxml_data_pathÚ	xml_etreerY  r>   r>   r?   Útest_wrong_stylesheet+  s   
þ"ürh  c                 C  s‚   t  d¡ t|||dkrdnd d��%}|dkrt| ¡ ƒ}nt| ¡ ƒ}t| |d� |jr/J ‚W d   ƒ d S 1 s:w   Y  d S )Nr2   rB   rP   rQ   rA   rX  )r6   r7   rT   r   r]   r   r   r£   )rñ   rO  rJ   rY   rU  r>   r>   r?   Útest_stylesheet_file_close7  s   
"øri  c                 C  sL   t  d¡ t jtdd�� t| d|d� W d   ƒ d S 1 sw   Y  d S )Nr2   z*To use stylesheet, you need lxml installedr4   rM   )rN   rL  rÆ   )rñ   rO  r>   r>   r?   Útest_stylesheet_with_etreeH  s   
ÿ"ýrj  c                 C  s^   t  d¡ d}tj ddd¡}t jt|d�� t|| d� W d   ƒ d S 1 s(w   Y  d S )Nr2   r3   rV   rÃ   zcta_rail_lines.kmlr4   rX  )r6   r7   r°   rX   r    r©   r:   r   )r¥   r=   Úkmlr>   r>   r?   Útest_empty_stylesheetP  s   
ÿ"ÿrl  c              	   C  sî   t | ||dkr	dnd d��F}|dkrA|dkrAtjtdd�� t||dg d¢id	� W d   ƒ n1 s3w   Y  	 W d   ƒ d S t||dg d¢id	�}W d   ƒ n1 sVw   Y  tg d
¢g d¢g d¢g d¢g d¢dœƒ}t ||¡ d S ©NrB   rP   rQ   r2   z.reading file objects must return bytes objectsr4   rc   rd   rj   r~   r‚   rƒ   r„   r†   r‡   )rT   r6   r©   rö   r   r   r8   rm   )rn   rN   rJ   rY   Údf_fileliker‰   r>   r>   r?   Útest_file_like_iterparse_  s:   ÿÿýý
ô
ýòûÿ
ro  c              
   C  s6  |dkrt nt}t| ||dkrdnd d��b}|| ¡ ƒ�L}|dkrV|dkrVtjtdd�� t||dg d¢id	� W d   ƒ n1 sBw   Y  	 W d   ƒ W d   ƒ d S t||dg d¢id	�}W d   ƒ n1 skw   Y  W d   ƒ n1 szw   Y  tg d
¢g d¢g d¢g d¢g d¢dœƒ}t	 
||¡ d S rm  )r   r   rT   r]   r6   r©   rö   r   r   r8   rm   )rn   rN   rJ   ÚfuncIOrY   ÚbÚ	df_fileior‰   r>   r>   r?   Útest_file_io_iterparse�  sP   ýÿÿýý
ôûÿýò€ûûÿ
rs  c              	   C  s˜   t |dd��<}|j| ¡ d� tjtdd�� t|j| dg d¢id� W d   ƒ n1 s-w   Y  W d   ƒ d S W d   ƒ d S 1 sEw   Y  d S )	NrP   rQ   rt   ú)iterparse is designed for large XML filesr4   rv   ©r   r    r!   Údaterj   )rT   rw   r]   r6   r©   r   r   r¶   )rN   ry   r·   rY   r>   r>   r?   Útest_url_path_error«  s   ÿ
ýýþ"þrw  c              	   C  s˜   t jdd��<}tj|| |d� tjtdd�� t|| dg d¢i|d� W d   ƒ n1 s-w   Y  W d   ƒ d S W d   ƒ d S 1 sEw   Y  d S )	Nzgeom_xml.zip©r±   ©rN   r[   rt  r4   rv   ru  ©rN   rk   r[   )r8   rS   Úgeom_dfÚto_xmlr6   r©   r   r   )rN   r_   rX   r>   r>   r?   Útest_compression_errorº  s   ÿ
üýý"ýr}  c                 C  sF   t jtdd�� t| |g d¢d� W d   ƒ d S 1 sw   Y  d S )Nz&list is not a valid type for iterparser4   rd   rj   r*  rí   r>   r>   r?   Útest_wrong_dict_typeÉ  s   ý"ÿr~  c                 C  sF   t jtdd�� t| |ddid� W d   ƒ d S 1 sw   Y  d S )Nz8<class 'str'> is not a valid type for value in iterparser4   rc   re   rj   r*  rí   r>   r>   r?   Útest_wrong_dict_valueÒ  s
   ÿ"ýr  c              	   C  sÆ   d}t jdd��Q}t|ddd��}| |¡ W d   ƒ n1 s w   Y  tjtdd�� t|| d	gd
g d¢id� W d   ƒ n1 sDw   Y  W d   ƒ d S W d   ƒ d S 1 s\w   Y  d S )Na‘  <?xml version='1.0' encoding='utf-8'?>
  <row>
    <shape>square</shape>
    <degrees>00360</degrees>
    <sides>4.0</sides>
    <date>2020-01-01</date>
   </row>
  <row>
    <shape>circle</shape>
    <degrees>00360</degrees>
    <sides/>
    <date>2021-01-01</date>
  </row>
  <row>
    <shape>triangle</shape>
    <degrees>00180</degrees>
    <sides>3.0</sides>
    <date>2022-01-01</date>
  </row>
zbad.xmlrx  rO   rP   rQ   zDExtra content at the end of the document|junk after document elementr4   rv  rv   ru  )rN   Úparse_datesrk   )r8   rS   rT   rU   r6   r©   rÍ   r   )rN   Úbad_xmlrX   rY   r>   r>   r?   Útest_bad_xmlÙ  s&   ÿý
üùü"ür‚  c                 C  ó^   d}t t|ƒd| d�}t|| dddgid�}tdd	gd
dgdœƒ}t ||¡ t ||¡ d S )Na-  <!-- comment before root -->
<shapes>
  <!-- comment within root -->
  <shape>
    <name>circle</name>
    <type>2D</type>
  </shape>
  <shape>
    <name>sphere</name>
    <type>3D</type>
    <!-- comment within child -->
  </shape>
  <!-- comment within root -->
</shapes>
<!-- comment after root -->r  r»   r   r-   r  rj   r   r  r  r  ©r-   r  rÁ   rÂ   r>   r>   r?   Útest_comment  s   ÿþÿr…  c                 C  rƒ  )Na8  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE non-profits [
    <!ELEMENT shapes (shape*) >
    <!ELEMENT shape ( name, type )>
    <!ELEMENT name (#PCDATA)>
]>
<shapes>
  <shape>
    <name>circle</name>
    <type>2D</type>
  </shape>
  <shape>
    <name>sphere</name>
    <type>3D</type>
  </shape>
</shapes>r  r»   r   r-   r  rj   r   r  r  r  r„  rÁ   rÂ   r>   r>   r?   Útest_dtd%  ó   ÿþÿr†  c                 C  rƒ  )Nam  <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<?display table-view?>
<?sort alpha-ascending?>
<?textinfo whitespace is allowed ?>
<?elementnames <shape>, <name>, <type> ?>
<shapes>
  <shape>
    <name>circle</name>
    <type>2D</type>
  </shape>
  <shape>
    <name>sphere</name>
    <type>3D</type>
  </shape>
</shapes>r  r»   r   r-   r  rj   r   r  r  r  r„  rÁ   rÂ   r>   r>   r?   Útest_processing_instructionI  r‡  rˆ  c                 C  óJ   t jtdd�� t| |dg d¢id� W d   ƒ d S 1 sw   Y  d S )Nz+No result from selected items in iterparse.r4   Únode©Úattr1Úelem1Úelem2Úelem3rj   )r6   r©   r   r   rí   r>   r>   r?   Útest_no_resultm  s   ÿ
ý"ýr�  c                 C  r‰  )NzNo columns to parse from filer4   rc   r‹  rj   )r6   r©   r   r   rí   r>   r>   r?   Útest_empty_datax  s   
ý"ÿr‘  c                  C  s`   t  d¡ d} d}tt| ƒdddg|d�}tdd	d
dddœddddddœdœƒ}t ||¡ d S )Nr2   a  <?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
  </cd>
  <cd>
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>9.90</price>
    <year>1988</year>
  </cd>
  <cd>
    <title>Greatest Hits</title>
    <artist>Dolly Parton</artist>
    <country>USA</country>
    <company>RCA</company>
    <price>9.90</price>
    <year>1982</year>
  </cd>
  <cd>
    <title>Still got the blues</title>
    <artist>Gary Moore</artist>
    <country>UK</country>
    <company>Virgin records</company>
    <price>10.20</price>
    <year>1990</year>
  </cd>
  <cd>
    <title>Eros</title>
    <artist>Eros Ramazzotti</artist>
    <country>EU</country>
    <company>BMG</company>
    <price>9.90</price>
    <year>1997</year>
  </cd>
  <cd>
    <title>One night only</title>
    <artist>Bee Gees</artist>
    <country>UK</country>
    <company>Polydor</company>
    <price>10.90</price>
    <year>1998</year>
  </cd>
  <cd>
    <title>Sylvias Mother</title>
    <artist>Dr.Hook</artist>
    <country>UK</country>
    <company>CBS</company>
    <price>8.10</price>
    <year>1973</year>
  </cd>
  <cd>
    <title>Maggie May</title>
    <artist>Rod Stewart</artist>
    <country>UK</country>
    <company>Pickwick</company>
    <price>8.50</price>
    <year>1990</year>
  </cd>
  <cd>
    <title>Romanza</title>
    <artist>Andrea Bocelli</artist>
    <country>EU</country>
    <company>Polydor</company>
    <price>10.80</price>
    <year>1996</year>
  </cd>
  <cd>
    <title>When a man loves a woman</title>
    <artist>Percy Sledge</artist>
    <country>USA</country>
    <company>Atlantic</company>
    <price>8.70</price>
    <year>1987</year>
  </cd>
  <cd>
    <title>Black angel</title>
    <artist>Savage Rose</artist>
    <country>EU</country>
    <company>Mega</company>
    <price>10.90</price>
    <year>1995</year>
  </cd>
  <cd>
    <title>1999 Grammy Nominees</title>
    <artist>Many</artist>
    <country>USA</country>
    <company>Grammy</company>
    <price>10.20</price>
    <year>1999</year>
  </cd>
  <cd>
    <title>For the good times</title>
    <artist>Kenny Rogers</artist>
    <country>UK</country>
    <company>Mucik Master</company>
    <price>8.70</price>
    <year>1995</year>
  </cd>
  <cd>
    <title>Big Willie style</title>
    <artist>Will Smith</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>9.90</price>
    <year>1997</year>
  </cd>
  <cd>
    <title>Tupelo Honey</title>
    <artist>Van Morrison</artist>
    <country>UK</country>
    <company>Polydor</company>
    <price>8.20</price>
    <year>1971</year>
  </cd>
  <cd>
    <title>Soulsville</title>
    <artist>Jorn Hoel</artist>
    <country>Norway</country>
    <company>WEA</company>
    <price>7.90</price>
    <year>1996</year>
  </cd>
  <cd>
    <title>The very best of</title>
    <artist>Cat Stevens</artist>
    <country>UK</country>
    <company>Island</company>
    <price>8.90</price>
    <year>1990</year>
  </cd>
  <cd>
    <title>Stop</title>
    <artist>Sam Brown</artist>
    <country>UK</country>
    <company>A and M</company>
    <price>8.90</price>
    <year>1988</year>
  </cd>
  <cd>
    <title>Bridge of Spies</title>
    <artist>T`Pau</artist>
    <country>UK</country>
    <company>Siren</company>
    <price>7.90</price>
    <year>1987</year>
  </cd>
  <cd>
    <title>Private Dancer</title>
    <artist>Tina Turner</artist>
    <country>UK</country>
    <company>Capitol</company>
    <price>8.90</price>
    <year>1983</year>
  </cd>
  <cd>
    <title>Midt om natten</title>
    <artist>Kim Larsen</artist>
    <country>EU</country>
    <company>Medley</company>
    <price>7.80</price>
    <year>1983</year>
  </cd>
  <cd>
    <title>Pavarotti Gala Concert</title>
    <artist>Luciano Pavarotti</artist>
    <country>UK</country>
    <company>DECCA</company>
    <price>9.90</price>
    <year>1991</year>
  </cd>
  <cd>
    <title>The dock of the bay</title>
    <artist>Otis Redding</artist>
    <country>USA</country>
    <COMPANY>Stax Records</COMPANY>
    <PRICE>7.90</PRICE>
    <YEAR>1968</YEAR>
  </cd>
  <cd>
    <title>Picture book</title>
    <artist>Simply Red</artist>
    <country>EU</country>
    <company>Elektra</company>
    <price>7.20</price>
    <year>1985</year>
  </cd>
  <cd>
    <title>Red</title>
    <artist>The Communards</artist>
    <country>UK</country>
    <company>London</company>
    <price>7.80</price>
    <year>1987</year>
  </cd>
  <cd>
    <title>Unchain my heart</title>
    <artist>Joe Cocker</artist>
    <country>USA</country>
    <company>EMI</company>
    <price>8.20</price>
    <year>1987</year>
  </cd>
</catalog>
a7  <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
  <h2>My CD Collection</h2>
  <table border="1">
    <tr bgcolor="#9acd32">
      <th style="text-align:left">Title</th>
      <th style="text-align:left">Artist</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <tr>
      <td><xsl:value-of select="title"/></td>
      <td><xsl:value-of select="artist"/></td>
    </tr>
    </xsl:for-each>
  </table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
z.//tr[td and position() <= 6]rf   Úartist)rµ   r  rL  zEmpire BurlesquezHide your heartzGreatest HitszStill got the bluesÚErosr'   z	Bob DylanzBonnie TylerzDolly Partonz
Gary MoorezEros Ramazzotti)rf   r’  )r6   r7   r   r   r   r8   rm   )rÃ   rY  Údf_xslr‰   r>   r>   r?   Útest_online_stylesheet�  s4   
 Vüûûøÿr•  c                 C  s~   t  ¡ �%}tj|d| |d� t|| |d�}t||| dg d¢i|d�}W d   ƒ n1 s,w   Y  t  |t¡ t  |t¡ d S )NF)rš   rN   r[   ry  rv   r   rz  )r8   rS   r{  r|  r   ra   rm   )rN   r_   r^   rz   r{   r>   r>   r?   Útest_compression_read‘  s   
ÿ
ûùr–  c              	   C  s  |}|}||krt  |› d|› �¡ tdftdftdftdfdœ}tddd	�}|d ur2|jd
f|d< tddd	�}|d urBtdf|d< || \}}	t 	¡ �7}
t
j|
| |d� t j||	d�� t|
| |d� W d   ƒ n1 snw   Y  W d   ƒ d S W d   ƒ d S 1 s†w   Y  d S )Nz == zInvalid data streamzNot a gzipped filezFile is not a zip filez%file could not be opened successfully)Úbz2ÚgzipÚzipÚtarÚ	zstandardÚignore)ÚerrorszUnknown frame descriptorÚzstdÚlzmaz%Input format not supported by decoderÚxzry  r4   )r6   ÚskipÚOSErrorr	   r   r
   Ú	ZstdErrorr   r8   rS   r{  r|  r©   r   )rN   r[   r_   Úactual_compressionÚattempted_compressionr�  rž  rŸ  Ú	error_clsÚ	error_strrX   r>   r>   r?   Útest_wrong_compression¥  s0   ü
ÿý"ýr¨  c              	   C  sz   t jtdd��, t ¡ �}t|| dd� W d   ƒ n1 sw   Y  W d   ƒ d S W d   ƒ d S 1 s6w   Y  d S )NzUnrecognized compression typer4   Ú7zry  )r6   r©   rÇ   r8   rS   r   )rN   rX   r>   r>   r?   Útest_unsuported_compressionÁ  s   
ÿÿ"ÿrª  c                 C  sN   t  d¡ t  d¡ d| j› d�}t|d|d�}t|d|d�}t ||¡ d S )NÚs3fsr2   zs3://z
/books.xml)rN   Ústorage_optionsrM   )r6   r7   r-   r   r8   rm   )Ús3_public_bucket_with_dataÚs3soÚs3ræ   rç   r>   r>   r?   Útest_s3_parser_consistencyÊ  s   

r°  c                   sò  d}|rt  d¡‰tˆ ddg¡ƒ}tˆ dd g¡ƒ}nV|dkr9ttjddgtjd�ƒ}ttjdtgtjd�ƒ}n9|dkr[t  d¡‰ddlm	‰  ˆ ˆ ddg¡ƒ}ˆ ˆ dd g¡ƒ}nt  d¡‰t
ˆ ddg¡ƒ}t
ˆ dd g¡ƒ}t d	|¡� tt|ƒ| |d
�}W d   ƒ n1 sŒw   Y  t|tddgdd�tddgdd�|tdtgdd�tdtgdd�tttgdd�tddgdd�tdtgdd�dœ	ƒ‰|dkrñt  d¡‰ddlm	‰  t‡ ‡‡fdd„ˆjD ƒƒ‰ˆ ˆ d d g¡ƒˆd< t |ˆ¡ d S )Na;  <?xml version='1.0' encoding='utf-8'?>
<data xmlns="http://example.com">
<row>
  <a>x</a>
  <b>1</b>
  <c>4.0</c>
  <d>x</d>
  <e>2</e>
  <f>4.0</f>
  <g></g>
  <h>True</h>
  <i>False</i>
</row>
<row>
  <a>y</a>
  <b>2</b>
  <c>5.0</c>
  <d></d>
  <e></e>
  <f></f>
  <g></g>
  <h>False</h>
  <i></i>
</row>
</data>ÚpyarrowÚxÚyÚpythonrÀ   r   )ÚArrowExtensionArrayzmode.string_storage)rN   Údtype_backendr(   r)   ÚInt64rÚ   g      @ÚFloat64TFÚboolean)	rŸ   rq  rA  ÚdÚerY   ÚgÚhÚic                   s$   i | ]}|ˆ ˆj ˆ| d d�ƒ“qS )T)Úfrom_pandas)Úarray)Ú.0Úcol©rµ  rC  Úpar>   r?   Ú
<dictcomp>!  s    ÿÿz1test_read_xml_nullable_dtypes.<locals>.<dictcomp>r¼  )r6   r7   r   rÀ  r   ÚnpÚobject_r   Úpandas.arraysrµ  r   ÚpdÚoption_contextr   r   r   r   Úcolumnsr8   rm   )rN   Ústring_storager¶  Úusing_infer_stringrV   Ústring_arrayÚstring_array_narB  r>   rÃ  r?   Útest_read_xml_nullable_dtypesØ  sR   


ÿ÷ÿ
þÿrÐ  c                  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.r4   ÚtestÚnumpy)r¶  rì   r<   r>   r>   r?   Útest_invalid_dtype_backend+  s
   ÿ"ÿrÓ  )�Ú
__future__r   Úior   r   rŸ  r   r°   Útarfiler   Úurllib.errorr   Úxml.etree.ElementTreer   Úzipfiler	   rÒ  rÆ  r6   Úpandas.compat._optionalr
   Úpandas.errorsr   r   Úpandas.util._test_decoratorsÚutilÚ_test_decoratorsÚtdÚpandasrÉ  r   r   r   Úpandas._testingÚ_testingr8   Úpandas.core.arraysr   r   Úpandas.core.arrays.string_arrowr   Úpandas.io.commonr   Úpandas.io.xmlr   rÛ   r{  r;   rã   rN  r@   ÚfixturerJ   rG   Ú
skip_if_norN   rZ   ra   rs   ÚmarkÚnetworkÚ
single_cpur|   rŠ   r�   r”   r–   r�   r¢   r¤   Úparametrizer­   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+  r0  r3  r5  r7  r>  r@  rD  Úskip_if_installedrF  rH  rQ  rS  rV  rW  r[  r^  rb  rc  re  rh  ri  rj  rl  ro  rs  rw  r}  r~  r  r‚  r…  r†  rˆ  r�  r‘  r•  r–  r¨  rª  r°  rÐ  rÓ  r>   r>   r>   r?   Ú<module>   sL   6
ýÿûûûû	Æâÿm




	4

	%&*1

	
"*	)#$$	  	S