U
    +if/                     @   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   S/home/mars/bis/venv/lib/python3.8/site-packages/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

)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right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ptZsmallg333333#@)Zmedium12ptZlargeg      +@)zx-large18pt)zxx-largeZ24pt)Z8pxr/   )z1.25pc15pt)z.25inr3   )z02.54cm72pt)z25.4mmr5   )z101.6qr5   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   sizer6   resolvedr   r   r   r   test_css_absolute_font_size   s    r=   zsize,relative_to,resolved)1emNr2   )1.0emNr2   )1.25emNr4   )r>   r7   r7   )r?   r7   r7   )r@   r7   20pt)Z1remr7   r2   )z1.0remr7   r2   )z1.25remr7   r4   )100%Nr2   )125%Nr4   )rB   r7   r7   )rC   r7   rA   )Z2exNr2   )z2.0exNr2   )z2.50exNr4   )inheritr7   r7   )smallerNZ10pt)rE   r3   r4   largerg,@)rF   r4   r3   c                 C   s2   |d krd }nd|i}t d|  d|i|d d S r8   r9   r:   r   r   r   test_css_relative_font_size   s    rG   )N)N)ZpytestZpandas._testingZ_testingr   Zpandas.io.formats.cssr   r   r   r   markZparametrizer   r   r%   r-   r.   r=   rG   r   r   r   r   <module>   s   





"


