U
    Mf/                     @   s  d dl Z d dlmZ d dlmZmZ dwddZdxddZe j	
ddd	d
dgdd Ze j	
dddddddddddg
dd Ze j	
dddddd gfd!d"d#d$d%gfd&d'd(d)d*gfd+d,d-d.d/gfd0d1d2d3d4gfgd5d6 Ze j	
d7d8d9d:d;d<d=d>gd?d@ Ze j	
dAdBdCdDgdEdF Ze j	
dGdHdIdJdKdLfdMdNdKdLfdOdPdQdKdLfdRdSdTdUdVdWdXdYdYge j	
dZdd[gd\d] Ze j	
d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrddsdKdLfdtgdudv ZdS )y    N)CSSResolver
CSSWarningc                 C   s"   t  }|| |d}||kstd S N	inheritedr   AssertionError)csspropsr   resolveactual r   D/tmp/pip-unpacked-wheel-eb6vo0j3/pandas/tests/io/formats/test_css.pyassert_resolves   s    r   c                 C   s.   t  }|| |d}|||d}||ks*t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

)Z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   c              	   C   s$   t t t| | W 5 Q R X d S r   )tmassert_produces_warningr   r   )Zinvalid_css	remainderr   r   r   test_css_parse_invalid)   s    r   zshorthand,expansionsmarginz
margin-topzmargin-rightzmargin-bottomzmargin-leftpaddingzpadding-topzpadding-rightzpadding-bottomzpadding-leftzborder-widthzborder-top-widthzborder-right-widthzborder-bottom-widthzborder-left-widthzborder-colorzborder-top-colorzborder-right-colorzborder-bottom-colorzborder-left-colorzborder-stylezborder-top-stylezborder-right-stylezborder-bottom-stylez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 5 Q R X d S )
Nz: 1ptZ1ptz	: 1pt 4ptZ4ptz: 1pt 4pt 2ptZ2ptz: 1pt 4pt 2pt 0ptZ0ptz: 1pt 1pt 1pt 1pt 1pt)r   r   r   r   )Z	shorthandZ
expansionstoprightZbottomleftr   r   r   test_css_side_shorthandsC   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%   r'   r%   ) margin: 1px; margin-top: inheritr$   r&   c                 C   s2   t  }||}|| |d}||}||ks.td S r   r   )styler   equivr   Zinherited_propsZstyle_propsZequiv_propsr   r   r   test_css_precedence~   s
    r+   zstyle,equiv)r(   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)   r*   r   r   r   test_css_none_absent   s    r,   zsize,resolved)zxx-small6ptzx-smallg      @fptsmallg333333#@)Zmedium12ptZlargeg      +@)zx-large18pt)zxx-largeZ24pt)Z8pxr-   )z1.25pc15pt)z.25inr2   )z02.54cm72pt)z25.4mmr4   )z101.6qr4   relative_to16ptc                 C   s2   |d krd }nd|i}t d|  d|i|d d S Nz	font-sizezfont-size: r   r   sizer5   Zresolvedr   r   r   r   test_css_absolute_font_size   s    r;   zsize,relative_to,resolved)1emNr1   )1.0emNr1   )1.25emNr3   )r<   r6   r6   )r=   r6   r6   )r>   r6   20pt)Z1remr6   r1   )z1.0remr6   r1   )z1.25remr6   r3   )100%Nr1   )125%Nr3   )r@   r6   r6   )rA   r6   r?   )Z2exNr1   )z2.0exNr1   )z2.50exNr3   )Zinheritr6   r6   )smallerNZ10pt)rB   r2   r3   largerg,@)rC   r3   r2   c                 C   s2   |d krd }nd|i}t d|  d|i|d d S r7   r8   r9   r   r   r   test_css_relative_font_size   s    rD   )N)N)ZpytestZpandas._testingZ_testingr   Zpandas.io.formats.cssr   r   r   r   markZparametrizer   r   r#   r+   r,   r;   rD   r   r   r   r   <module>   s   





"


