o
    g`                     @   s   d dl mZ d dlZd dlmZ d dlmZm	Z	 d dl
mZ dd Zedgdd	d
d Zedgdd Zedgdd	dd Zdd Zedgdd Zdd ZdS )    N)image_comparison)
CustomCellTable)Pathc                  C   s   ddg} t j| d d S )Nbr)cellColours)plttable)
cellcolors r   Y/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/matplotlib/tests/test_table.pytest_non_square	   s   r   ztable_zorder.pngT)remove_textc                  C   s   ddgddgg} d}dd dD }g }t t|}t| D ]}||7 }|d	d |D  qt d
dt j d}tj|t 	|ddd tj
|||ddd tj
|||ddd tg  d S )NiR iب iv  i )FreezeWindc                 S   s   g | ]}d | qS )z%d yearr   .0xr   r   r   
<listcomp>   s    ztest_zorder.<locals>.<listcomp>)d   2   c                 S   s   g | ]}d |d  qS )z%1.1fg     @@r   r   r   r   r   r      s    r      r      )lwzordercenter)cellText	rowLabels	colLabelslocr   zupper center)npzeroslenreversedappendlinspacepir	   plotcosr
   yticks)datar    r   r   yoffrowtr   r   r   test_zorder   s2   r0   ztable_labels.pngc            	      C   s   d} t dd| }tj|}dg|  g|  }t }|ddd}|d |j||dd |ddd	}|d |j||d
g|  dd |ddd}|d |j||dd |ddd}|d |j||d
g|  dd d S )N   r      1r   offbest)r   
rowColoursr!   r   Header)r   r6   r   r!   )r   
colColoursr!   )r   r8   r    r!   )	r"   r'   r	   cmRdYlGnfigureadd_subplotaxisr
   )	dimccoloursr   figax1ax2ax3ax4r   r   r   test_label_colours0   s>   




rF   ztable_cell_manipulation.pngc                  C   s   d} dgt |  gd }dgt |  }tjt | dt | d fd\}}t|| D ]\}}|j||d|d	 |d
 q)t  d S )N
horizontalverticalopenclosedTRBLr3   r   g?r   r2   )nrowsfigsizer   )	colWidthsr   r!   edgesr4   )r$   r	   subplotszipr
   r=   tight_layout)cellsr   rR   _axsaxcellr   r   r   test_diff_cell_tableU   s   "r\   c                  C   s  d} t jt jt jt jt jft jt jt jt jt jft jt jt jt jt jft jt jt jt jt jft jt jt jt jt jft jt jt jt jt jft jt jt jt jt jft jt jt jt jt jff}t| |D ]\}}td|ddd}tdd |  D }||ksJ qad S )NrG   r   r   r2   )visible_edgeswidthheightc                 s   s    | ]\}}|V  qd S )Nr   )r   rX   sr   r   r   	<genexpr>v   s    z"test_customcell.<locals>.<genexpr>)	r   MOVETOLINETO	CLOSEPOLYrU   r   tupleget_pathiter_segments)typescodesr/   r?   r[   coder   r   r   test_customcellg   s   rl   ztable_auto_column.pngc            	      C   s  t  } | ddd}|d |jddgddggddgd	d
gdd}|d |d |g d | ddd}|d |jddgddggddgd	d
gdd}|d |d |d | ddd}|d |jddgddggddgd	d
gdd}|d |d |d |d |d | ddd}|d |jddgddggddgd	d
gdd}|d |d |d d S )Nr   r2   r4   zFit Textr   z-very long long text, Longer text than defaultArN   Col1Col2r   )r   r   r    r!   F   )r   r2   r1   rq   r   z-101)r	   r;   r<   r=   r
   auto_set_font_sizeset_fontsizeauto_set_column_width)	rA   rB   tb1rC   tb2rD   tb3rE   tb4r   r   r   test_auto_columnz   sn   















ry   c                  C   s   t  \} }t|}|dddd}t|tsJ ||d u s!J tdddd d}||d< |d |u s5J |  t | d S )Nr2   r   )r2   r   r]   )r^   )r   r2   )r	   rT   r   add_cell
isinstancer   
propertiessetp)rA   rZ   r
   r[   cell2r   r   r   test_table_cells   s   r   )matplotlib.pyplotpyplotr	   numpyr"   matplotlib.testing.decoratorsr   matplotlib.tabler   r   matplotlib.pathr   r   r0   rF   r\   rl   ry   r   r   r   r   r   <module>   s     
 
$

: