a
    DBìjÝ!  ã                   @   s  d dl Z d dlmZ d dlmZ d dlmZ dfdd„Zdgdd„Z	e j
 dg d	¢¡d
d„ ƒZe j
 dg d¢¡dd„ ƒZe j
 ddg d¢fdg d¢fdg d¢fdg d¢fdg d¢fg¡dd„ ƒZe j
 dddgfd d!gfd"d#gfd$d%gfd&g d'¢fg¡d(d)„ ƒZe j
 d*g d+¢¡d,d-„ ƒZe j
 d.g d/¢¡d0d1„ ƒZe j
 d2g d3¢¡d4d5„ ƒZe j
 d6d7d8d9d:›d;�fd<d=d:›d;�fd>d?d@d:›d;�fdAdBdCdDdEdFdGdHdHg¡e j
 dIddJg¡dKdL„ ƒƒZe j
 dMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`daddbd:›d;�fdcg¡ddde„ ƒZdS )hé    N)Ú
CSSWarning©ÚCSSResolverc                 C   s"   t ƒ }|| |d�}||ksJ ‚d S ©N©Ú	inheritedr   )ÚcssÚpropsr   ÚresolveÚactual© r   ú_/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/pandas/tests/io/formats/test_css.pyÚassert_resolves
   s    r   c                 C   s.   t ƒ }|| |d�}|||d�}||ks*J ‚d S r   r   )Zcss1Zcss2r   r
   Z	resolved1Z	resolved2r   r   r   Úassert_same_resolution   s    r   zname,norm,abnorm))Ú
whitespaceúhello: world; foo: barz( 	 hello 	 :
  world 
  ;  
 foo: 	bar

)Úcaser   zHello: WORLD; foO: bar)z
empty-declr   z; hello: world;; foo: bar;
; ;)z
empty-listÚ ú;c                 C   s   t ||ƒ d S ©N©r   )ÚnameZnormZabnormr   r   r   Útest_css_parse_normalisation   s    r   zinvalid_css,remainder))zhello-worldr   )z border-style: solid; hello-worldzborder-style: solid)z3border-style: solid; hello-world; font-weight: boldz&border-style: solid; font-weight: bold)zfont-size: blahúfont-size: 1em)zfont-size: 1a2br   )zfont-size: 1e5ptr   )zfont-size: 1+6ptr   )zfont-size: 1unknownunitr   )zfont-size: 10r   )zfont-size: 10 ptr   )zborder-top: 1pt solid red greenzborder-top: 1pt solid greenc                 C   s8   t  t¡� t| |ƒ W d   ƒ n1 s*0    Y  d S r   )ÚtmÚassert_produces_warningr   r   )Zinvalid_cssÚ	remainderr   r   r   Útest_css_parse_invalid(   s    r   zshorthand,expansionsÚmargin)z
margin-topzmargin-rightzmargin-bottomzmargin-leftÚpadding)zpadding-topzpadding-rightzpadding-bottomzpadding-leftzborder-width)zborder-top-widthzborder-right-widthzborder-bottom-widthúborder-left-widthzborder-color)zborder-top-colorzborder-right-colorzborder-bottom-colorúborder-left-colorzborder-style)zborder-top-stylezborder-right-stylezborder-bottom-styleúborder-left-stylec              
   C   sÊ   |\}}}}t | › d�|d|d|d|diƒ t | › d�|d|d|d|diƒ t | › d�|d|d|d|diƒ t | › d�|d|d|d|diƒ t t¡�  t | › d	�i ƒ W d   ƒ n1 s¼0    Y  d S )
Nz: 1ptÚ1ptz	: 1pt 4ptZ4ptz: 1pt 4pt 2ptZ2ptz: 1pt 4pt 2pt 0ptZ0ptz: 1pt 1pt 1pt 1pt 1pt)r   r   r   r   )Ú	shorthandZ
expansionsÚtopÚrightÚbottomÚleftr   r   r   Útest_css_side_shorthandsD   s"    #ÿÿþþr)   zshorthand,sidesz
border-topr%   zborder-rightr&   zborder-bottomr'   zborder-leftr(   Úborder)r%   r&   r'   r(   c                 C   s(   ddd„}t | › d�||dddƒƒ d S )Nc                 S   sN   i }| D ]@}|r ||d|› d�< |r4||d|› d�< |r||d|› d�< q|S )Nzborder-z-colorz-stylez-widthr   )ÚsidesÚcolorÚstyleÚwidthÚresolvedZsider   r   r   Úcreate_border_dictŠ   s    z;test_css_border_shorthand_sides.<locals>.create_border_dictz: 1pt red solidÚredÚsolidr#   )NNN©r   )r$   r+   r0   r   r   r   Útest_css_border_shorthand_sides   s    
ÿr4   zprop, expected))z1pt red solid©r1   r2   r#   )zred 1pt solidr5   )zred solid 1ptr5   )zsolid 1pt redr5   )z	red solid)r1   r2   ú
1.500000pt)z	1pt solid)Úblackr2   r#   )z1pt red)r1   Únoner#   )r1   )r1   r8   r6   )r#   )r7   r8   r#   )r2   )r7   r2   r6   )Ú1em)r7   r8   Ú12ptc                 C   s&   |\}}}t d| › �|||dœƒ d S )Nzborder-left: )r!   r"   r    r3   )ÚpropÚexpectedr,   r-   r.   r   r   r   Útest_css_border_shorthandsš   s    
ýþr=   zstyle,inherited,equiv))zmargin: 1px; margin: 2pxr   úmargin: 2px)úmargin: 1pxr>   r?   )zmargin: 1px; margin: inheritr>   r>   )úmargin: 1px; margin-top: 2pxr   zHmargin-left: 1px; margin-right: 1px; margin-bottom: 1px; margin-top: 2px)úmargin-top: 2pxr?   r@   )r?   rA   r?   )ú margin: 1px; margin-top: inheritr>   r@   c                 C   s2   t ƒ }||ƒ}|| |d�}||ƒ}||ks.J ‚d S r   r   )r-   r   Úequivr
   Zinherited_propsZstyle_propsZequiv_propsr   r   r   Útest_css_precedenceº   s
    rD   zstyle,equiv))rB   z7margin-bottom: 1px; margin-right: 1px; margin-left: 1px)zmargin-top: inheritr   )zmargin-top: initialr   c                 C   s   t | |ƒ d S r   r   )r-   rC   r   r   r   Útest_css_none_absent×   s    rE   zsize,resolved)zxx-smallÚ6ptzx-smallg      @ÚfÚptZsmallg333333#@)Zmediumr:   Zlargeg      +@)zx-largeÚ18pt)zxx-largeZ24pt)Z8pxrF   )z1.25pcÚ15pt)z.25inrI   )z02.54cmÚ72pt)z25.4mmrK   )z101.6qrK   Úrelative_toÚ16ptc                 C   s2   |d u rd }nd|i}t d| › �d|i|d� d S ©Nz	font-sizezfont-size: r   r3   ©ÚsizerL   r/   r   r   r   r   Útest_css_absolute_font_sizeæ   s    rQ   zsize,relative_to,resolved)r9   Nr:   )ú1.0emNr:   )ú1.25emNrJ   )r9   rM   rM   )rR   rM   rM   )rS   rM   Ú20pt)Z1remrM   r:   )z1.0remrM   r:   )z1.25remrM   rJ   )ú100%Nr:   )ú125%NrJ   )rU   rM   rM   )rV   rM   rT   )Z2exNr:   )z2.0exNr:   )z2.50exNrJ   )ÚinheritrM   rM   )ÚsmallerNZ10pt)rX   rI   rJ   ÚlargergÍÌÌÌÌÌ,@)rY   rJ   rI   c                 C   s2   |d u rd }nd|i}t d| › �d|i|d� d S rN   r3   rO   r   r   r   Útest_css_relative_font_size  s    rZ   )N)N)ZpytestZpandas.errorsr   Zpandas._testingZ_testingr   Zpandas.io.formats.cssr   r   r   ÚmarkZparametrizer   r   r)   r4   r=   rD   rE   rQ   rZ   r   r   r   r   Ú<module>   sÌ   

þ
þ


þ
þ
þëþ"

ûþ

þ
þ
þ
òþëþ