a
    Pf!                     @   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   Y/var/www/ai-form-bot/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 s0    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   







"






