
    ~i                         d dl Z d dlZd dlZd dlmZ ddlmZ ddlm	Z	m
Z
 d dlmZ d Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd ZdS )    N)Version   )Exporter)FakeRendererFullFakeRendererc                 l     |            }t          |          }|                    |            |j        S N)r   runoutput)figRendererrendererexporters       d/home/jrussi/.local/lib/python3.11/site-packages/plotly/matplotlylib/mplexporter/tests/test_basic.pyfake_renderer_outputr      s4    xzzH!!HLL?    c                     t          |                                                                 |                                                                          D ]\  }}||k    sJ d S r	   )zipstripsplit)text1text2line1line2s       r   _assert_output_equalr      s`    EKKMM//115;;==3F3F3H3HII  u~~~~~ r   c                     t          j                    \  } }|                    t          d          d           t	          t          | t                    d           t	          t          | t                    d           d S )N   z-kz
                         opening figure
                         opening axes
                         draw path with 20 vertices
                         closing axes
                         closing figure
                         z
                         opening figure
                         opening axes
                         draw line with 20 points
                         closing axes
                         closing figure
                         pltsubplotsplotranger   r   r   r   r   axs     r   
test_linesr%      s    lnnGCGGE"IItS,//		 	 	 S"233		 	 	 	 	r   c                     t          j                    \  } }|                    t          d          d           t	          t          | t                    d           t	          t          | t                    d           d S )Nr   oka  
                         opening figure
                         opening axes
                         draw path with 25 vertices
                         draw path with 25 vertices
                         closing axes
                         closing figure
                         z
                         opening figure
                         opening axes
                         draw 2 markers
                         closing axes
                         closing figure
                         r   r#   s     r   test_markersr(   2   s    lnnGCGGE!HHdS,//	
 
 
 S"233		 	 	 	 	r   c                     t          j                    \  } }|                    t          d          t          d                     t	          t          | t                    d           t	          t          | t                    d           d S )N   aR  
                         opening figure
                         opening axes
                         draw path with 25 vertices
                         draw path with 25 vertices
                         draw path with 25 vertices
                         closing axes
                         closing figure
                         z
                         opening figure
                         opening axes
                         draw path collection with 3 offsets
                         closing axes
                         closing figure
                         )r   r    scatterr"   r   r   r   r   r#   s     r   test_path_collectionr,   N   s    lnnGCJJuQxxq"""S,//	   S"233		 	 	 	 	r   c                  $   t          j                    \  } }|                    d           |                    d           |                    d           |                    ddd           t          t          | t                    d           d S )Nz
my x labelz
my y labelzmy titleg      ?zmy texta  
                         opening figure
                         opening axes
                         draw text 'my text' None
                         draw text 'my x label' xlabel
                         draw text 'my y label' ylabel
                         draw text 'my title' title
                         closing axes
                         closing figure
                         )	r   r    
set_xlabel
set_ylabel	set_titletextr   r   r   r#   s     r   	test_textr2   k   s    lnnGCMM,MM,LLGGCi   S,//		    r   c                     t          j                    \  } }|                    t          j        dd                     |                    t          j        ddd                     t          t          | t                    d           d S )Nr   r      r     
                         opening figure
                         opening axes
                         draw path with 25 vertices
                         draw path with 4 vertices
                         closing axes
                         closing figure
                         )r   r    	add_patchCircle	Rectangler   r   r   r#   s     r   	test_pathr:      s}    lnnGCLLFA&&'''LLvq!,,---S,//	
 
 
 
 
r   c                  >   t          j                    } |                     d          }|                    t          j        dd                     |                    t          j        ddd                     t          t          | t                    d           dS )zLif the fig is not associated with a canvas, FakeRenderer shall
    not fail.o   r4   r5   r   r6   N)	r   Figureadd_subplotr7   r8   r9   r   r   r   r#   s     r   test_Figurer?      s     *,,C			BLLFA&&'''LLvq!,,---S,//	
 
 
 
 
r   c                     t          j        d          \  } }|d                             t          d                     |d                             t          d                     t	          t          | t                    d           d S )Nr   r      r5   
   ai  
                         opening figure
                         opening axes
                         draw path with 4 vertices
                         closing axes
                         opening axes
                         draw path with 10 vertices
                         closing axes
                         closing figure
                         )r   r    r!   r"   r   r   r   r#   s     r   test_multiaxesrC      sy    l1ooGCqEJJuQxxqEJJuRyyS,//		    r   c                     t          t          j                  t          d          k    rd} nt          j        d           t
          j                            d           t          j	        d          \  }}|
                    t
          j                            d          t          j        j        d	           t          t          |t                    d
|  d           d S )Nz3.4.1i  zTest fails for older matplotlibr   )r   r   )figsize)rB   rB   nearest)cmapinterpolationz{
                         opening figure
                         opening axes
                         draw image of size zi 
                         closing axes
                         closing figure
                         )r   
matplotlib__version__pytestskipnprandomseedr   r    imshowcmjetr   r   r   )
image_sizer   r$   s      r   
test_imagerT      s     z%&&''*:*:::

5666INN1l6***GCIIbix((svzISSSS,//	 .8	 	 		 	 	 	 	r   c                      t          j                    \  } }|                    g dd           |                                                    d           t          t          | t                    d           d S )Nr5   r   r*   labelrW   Fa9  
                         opening figure
                         opening axes
                         draw path with 3 vertices
                         opening legend
                         closing legend
                         closing axes
                         closing figure
                         )r   r    r!   legendset_visibler   r   r   r#   s     r   test_legendr[      su    lnnGCGGIIIWG%%%IIKKE"""S,//	    r   c                  ,   t          j                    \  } }|                    g dd           |                    g ddd           |                                                    d           t          t          | t                    d           d S )	NrV   rW   rX   )r   r   r   odotsTaK  
                         opening figure
                         opening axes
                         draw line with 3 points
                         draw 3 markers
                         opening legend
                         draw line with 2 points
                         draw text 'label' None
                         draw 1 markers
                         draw text 'dots' None
                         draw path with 13 vertices
                         closing legend
                         closing axes
                         closing figure
                         )r   r    r!   rY   rZ   r   r   r   r#   s     r   test_legend_dotsr_      s    lnnGCGGIIIWG%%%GGIIIs&G)))IIKKD!!! S"233	    r   c                  \    t          j                    \  } }|                    d           d S )Nr   )r   r    axvliner#   s     r   test_blendedrb      s$    lnnGCJJqMMMMMr   )rI   numpyrM   rK   packaging.versionr   r   r   	renderersr   r   matplotlib.pyplotpyplotr   r   r   r%   r(   r,   r2   r:   r?   rC   rT   r[   r_   rb    r   r   <module>ri      sA            % % % % % %       6 6 6 6 6 6 6 6          
  6  8  :  ,  $  *  (  ,  $  6    r   