
    rbi/                        d Z ddlZ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 ddlmZ  G d d          Z G d d          Z G d	 d
          Zej        ej        ej        gZg dZ G d d          Z G d d          Zd Z G d d          Z G d d          Z G d d          Zej                             d           edg          d                         Z!d Z"d Z#d Z$dS )z#Catch all for categorical functions    N)Axes)check_figures_equalc                   t   e Zd Zddgdgffddgdgffdg dg dffgZ ee \  ZZej        	                    d	ee
          d             Z
d Zddej        fdddgfdddgfgZ ee \  ZZej        	                    dee
          d             Zej        	                    dee
          d             ZdS )TestUnitDatasinglehello worldr   unicode   Здравствуйте мирmixed)Aznp.nanBz3.14   мир)r               z
data, locsidsc                     t          j        |          }t          |j                                                  |k    sJ t          |j                                                  |k    sJ d S N)catUnitDatalist_mappingkeysvalues)selfdatalocsunits       n/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/matplotlib/tests/test_category.py	test_unitzTestUnitData.test_unit   se    |D!!DM&&(())T1111DM((**++t333333    c                    ddg}ddg}g d}g d}g d}t          j        |          }t          |j                                                  |k    sJ t          |j                                                  |k    sJ |                    |           t          |j                                                  |k    sJ t          |j                                                  |k    sJ d S )Nadr   r   )br&   e)r%   r&   r'   r(   )r   r   r   r   )r   r   r   r   r   r   update)r   r   r   data_updateunique_dataupdated_locsr    s          r!   test_updatezTestUnitData.test_update   s    Sz1v%oo***#|||D!!DM&&(())T1111DM((**++t3333K   DM&&(())[8888DM((**++|;;;;;;r#   )numberQ	@nanr   r/      z
mixed typer   r   fdatac                     t          j        t                    5  t          j        |           d d d            d S # 1 swxY w Y   d S r   )pytestraises	TypeErrorr   r   )r   r2   s     r!   test_non_string_failsz"TestUnitData.test_non_string_fails0   s    ]9%% 	  	 L	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 s   <A A c                     t          j                    }t          j        t                    5  |                    |           d d d            d S # 1 swxY w Y   d S r   )r   r   r4   r5   r6   r)   )r   r2   unitdatas      r!   test_non_string_update_failsz)TestUnitData.test_non_string_update_fails5   s    <>>]9%% 	# 	#OOE"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#s   AAAN)__name__
__module____qualname__
test_caseszipr   r   r4   markparametrizer"   r-   npr0   failing_test_casesfidsr2   r7   r:    r#   r!   r   r      sQ       }os34 ABQCHICCC,__. /0J Z IC[\4S994 4 :94
< < <  +UBFO!D":.Qx0HJ #z"KD%[We66    76  [We66# # 76# # #r#   r   c                       e Zd Zd ZdS )FakeAxisc                     || _         d S r   )units)r   rI   s     r!   __init__zFakeAxis.__init__=   s    


r#   N)r;   r<   r=   rJ   rE   r#   r!   rG   rG   <   s#            r#   rG   c                      e Zd ZdZddgfddgfdg dfdd	d
gfdg dfgZ ee \  ZZdddej	        gfdddgfgZ
 ee
 \  ZZ ej        d          d             Zej                            dee          d             Zej                            dddgddg          d             Zej                            dee          d             Zd Zd  Zd!S )"TestStrCategoryConverterz
    Based on the pandas conversion and factorization tests:

    ref: /pandas/tseries/tests/test_converter.py
         /pandas/tests/test_algos.py:TestFactorize
    r	   r
   asciir   r   r%   r'   czinteger string12zsingle + values>10)r   r   CDEFGHIJKLMNOPQRSTUVWXYZr   r/   r   string integer42*   T)autousec                     t          j                    | _        t          j                    | _        t          | j                  | _        d S r   )r   StrCategoryConverterccr   r    rG   ax)r   requests     r!   	mock_axisz"TestStrCategoryConverter.mock_axisX   s4    *,,LNN	49%%r#   valsr   c                     t           j                            | j                            || j        j        | j                  t          t          |                               d S r   )	rB   testingassert_allcloserp   convertrq   rI   rangelen)r   rt   s     r!   test_convertz%TestStrCategoryConverter.test_convert_   sV    

""47??4377$< $<#(T#3#3	5 	5 	5 	5 	5r#   valuehir   c                 ^    | j                             || j        | j                  dk    sJ d S )Nr   )rp   rx   r    rq   )r   r|   s     r!   test_convert_one_stringz0TestStrCategoryConverter.test_convert_one_stringe   s/    wudi99Q>>>>>>r#   fvalsc                     t          j        t                    5  | j                            || j        | j                   d d d            d S # 1 swxY w Y   d S r   )r4   r5   r6   rp   rx   r    rq   )r   r   s     r!   test_convert_failz*TestStrCategoryConverter.test_convert_faili   s    ]9%% 	7 	7GOOE49dg666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s   'AAAc                     | j                             | j        | j                  }t	          |j        t          j                  sJ t	          |j        t          j	                  sJ d S r   )
rp   axisinfor    rq   
isinstancemajlocr   StrCategoryLocatormajfmtStrCategoryFormatter)r   axiss     r!   test_axisinfoz&TestStrCategoryConverter.test_axisinfon   sY    w	4733$+s'=>>>>>$+s'?@@@@@@@r#   c                 |    t          | j                            dg| j                  t          j                  sJ d S )Nr%   )r   rp   default_unitsrq   r   r   r   s    r!   test_default_unitsz+TestStrCategoryConverter.test_default_unitss   s6    $'//tw??NNNNNNNr#   N)r;   r<   r=   __doc__r>   r?   r   r   rB   infrC   rD   fvaluesr4   fixturers   r@   rA   r{   r   r   r   r   rE   r#   r!   rL   rL   A   s         @AB]O,___-#c3Z0' *C *C *C D	EJ #z"KC"T3$78+dBZ8: C+,MD'V^D!!!& & "!& [VV555 5 655
 [WtX&6Wi<PQQ? ? RQ? [Wg4887 7 987A A A
O O O O Or#   rL   )scatterplotbarc                   `    e Zd Zd Zej                            dee          d             Z	dS )TestStrCategoryLocatorc                     g d}t          j        d |D                       }t          j        |j                  }t          j                            |                    d d           |           d S )N)r   r   r   r   r               	   
   c                 ,    g | ]}t          |          S rE   )str).0js     r!   
<listcomp>zBTestStrCategoryLocator.test_StrCategoryLocator.<locals>.<listcomp>~   s    222SVV222r#   )r   r   r   r   rB   rv   assert_array_equaltick_values)r   r   r    tickss       r!   test_StrCategoryLocatorz.TestStrCategoryLocator.test_StrCategoryLocator|   sk    111|22T22233&t}55

%%e&7&7d&C&CTJJJJJr#   plotterr   c                    t          j                                                    } ||g dg d           t          j                            |j        j                                        t          d                     d S )N)r   r   r   rN   r   )
pltfiguresubplotsrB   rv   r   yaxismajorlocatorry   r   r   rq   s      r!   test_StrCategoryLocatorPlotz2TestStrCategoryLocator.test_StrCategoryLocatorPlot   si    Z\\""$$III///

%%bhn&<&<&>&>aIIIIIr#   N)
r;   r<   r=   r   r4   r@   rA   	PLOT_LISTPLOT_IDSr   rE   r#   r!   r   r   {   s_        K K K [Y	x@@J J A@J J Jr#   r   c                      e Zd Zdg dfdddgfgZ ee \  ZZej        	                    dee          d             Z
ej        	                    dee          ej        	                    d	ee          d
                         ZdS )TestStrCategoryFormatterrM   )helloworldr}   r	      Здравствуйте   приветydatar   c                     t          j        |          }t          j        |j                  }t	          |          D ])\  }} |||          |k    sJ  ||d           |k    sJ *d S r   )r   r   r   r   	enumerate)r   r   r    labelsir&   s         r!   test_StrCategoryFormatterz2TestStrCategoryFormatter.test_StrCategoryFormatter   s    |E"")$-88e$$ 	( 	(DAq6!Q<<1$$$$6!T??a'''''	( 	(r#   r   c                 b   t          j                                                    } ||t          t	          |                    |           t          |          D ]*\  }}|j        j                            |          |k    sJ +|j        j                            |dz             dk    sJ d S )Nr    )	r   r   r   ry   rz   r   r   r   	formatter)r   r   r   rq   r   r&   s         r!   test_StrCategoryFormatterPlotz6TestStrCategoryFormatter.test_StrCategoryFormatterPlot   s     Z\\""$$E#e**%%u---e$$ 	4 	4DAq8>++A..!33333x~''!,,222222r#   N)r;   r<   r=   r>   r?   r   casesr4   r@   rA   r   r   r   r   rE   r#   r!   r   r      s        44459>JKMJ j!JC[We55( ( 65( [We55[Y	x@@3 3 A@ 653 3 3r#   r   c                     t          t          t          |                              }t          j                                                             |            fd|D             }|d |D             k    sJ t           j        j        	                                          d |D             k    sJ t           j        j        
                                          |k    sJ d S )Nc                 F    g | ]}j                             ||          S rE   )r   r   )r   r   r   s     r!   r   zaxis_test.<locals>.<listcomp>   s+    >>>1DJ((A..>>>r#   c                 L    g | ]!}t           j                            |          "S rE   )r   r   _textr   ls     r!   r   zaxis_test.<locals>.<listcomp>   s)    NNN!C4::1==NNNr#   c                     g | ]}|S rE   rE   r   s     r!   r   zaxis_test.<locals>.<listcomp>   s    /B/B/Ba/B/B/Br#   )r   ry   rz   rB   rv   r   get_majorticklocsrI   r   r   r   )r   r   r   graph_labelss   `   r!   	axis_testr      s    s6{{##$$EJ!!$"8"8":":EBBB>>>>>>>LNNvNNNNNNN
#((**++/B/B6/B/B/BBBBB
#**,,--666666r#   c                       e Zd Zdg dfdg dfd ej        g d          fgZ ee \  ZZe	j
                            dee          e	j
                            dee          d	                         Zd
S )TestPlotBytesstring listrN   
bytes list)   a   b   cbytes ndarrayr   r   bdatac                     t          j                                                    }t          j        g d          } ||||           t          |j        |           d S N)r   r   r   r   r   r   rB   arrayr   xaxis)r   r   r   rq   countss        r!   test_plot_byteszTestPlotBytes.test_plot_bytes   Z     Z\\""$$)))$$E6""""(E"""""r#   N)r;   r<   r=   rB   r   bytes_casesr?   	bytes_ids
bytes_datar4   r@   rA   r   r   r   rE   r#   r!   r   r      s        !???3 "4"4"45#XRX.@.@.@%A%ABDK  C-Iz[Y	x@@[Wji@@# # A@ A@# # #r#   r   c                      e Zd Zdg dfd ej        g d          fdg dfd ej        g d          fgZ ee \  ZZe	j
                            dee          e	j
                            d	ee          d
                         ZdS )TestPlotNumliker   )rP   113zstring ndarrayr   )   1s   11   3r   r   r   ndatac                     t          j                                                    }t          j        g d          } ||||           t          |j        |           d S r   r   )r   r   r   rq   r   s        r!   test_plot_numlikez!TestPlotNumlike.test_plot_numlike   r   r#   N)r;   r<   r=   rB   r   numlike_casesr?   numlike_idsnumlike_datar4   r@   rA   r   r   r   rE   r#   r!   r   r      s        #%5%5%56&1A1A1A(B(BC"$7$7$78%xrx0C0C0C'D'DEGM !$] 3K[Y	x@@[WlDD# # ED A@# # #r#   r   c                   .   e Zd Zej                            dee          d             Zej	        d             Z
ej                            d          ej                            dee          d                         Zej                            d          ej                            dee          d                         Zej                            d          ej                            dee          d                         Zej                            dee          d	             Zd
 Zdddgfdddgfdddgfddej        gfgZ ee \  ZZej        ej         ej        ej        ej        j                  gZej                            de          ej                            dee          d                         Zej                            de          ej                            dee          d                         ZdS )TestPlotTypesr   r   c                     t          j                                                    }ddg} |||ddg           t          |j        |           d S )Nr   r   r   r   )r   r   r   r   r   )r   r   rq   wordss       r!   test_plot_unicodezTestPlotTypes.test_plot_unicode   sS    Z\\""$$+^<EAq6""""(E"""""r#   c                 N    g d| _         g d| _        g d| _        g d| _        d S )N)r   happyr   )r   r   r   )Pythonisfun)r   r   r   )xxyyyxr   s    r!   	test_datazTestPlotTypes.test_data   s6    ,,,))((())r#   r   c                     t          j                                                    } ||| j        | j                   t          |j        | j                   d S r   )r   r   r   r   r   r   r   r   r   r   rq   s       r!   test_plot_xaxiszTestPlotTypes.test_plot_xaxis   sM     Z\\""$$DFDG$$$"(DF#####r#   c                     t          j                                                    } ||| j        | j                   t          |j        | j                   d S r   )r   r   r   r   r   r   r   r   s       r!   test_plot_yaxiszTestPlotTypes.test_plot_yaxis   sM     Z\\""$$DGTV$$$"(DF#####r#   c                     t          j                                                    } ||| j        | j                   t          |j        | j                   t          |j        | j                   d S r   )r   r   r   r   r   r   r   r   r   s       r!   test_plot_xyaxiszTestPlotTypes.test_plot_xyaxis   sa     Z\\""$$DFDF###"(DF###"(DF#####r#   c                    t          j                                                    } ||ddgddg            ||g dg d            ||g dg d           t          |j        g d	           t          |j        g d
           d S Nr%   r'   r(   g)r%   r'   r&   )fr%   r'   )r'   rO   r&   )r  r(   r&   )r%   r'   r&   rO   )r(   r  r	  r%   r'   r&   )r   r   r   r   r   r   r   s      r!   test_update_plotzTestPlotTypes.test_update_plot   s    Z\\""$$S#Jc
+++OOO___555OOO___555"(000111"(:::;;;;;r#   c                 H   t          j                                                    }|                    ddgddg           |                    g dg d           |                    g dg d           t          |j        g d	           t          |j        g d
           d S r  )	r   r   r   r   r   r   r   r   r   )r   rq   s     r!   %test_update_plot_heterogenous_plotterz3TestPlotTypes.test_update_plot_heterogenous_plotter   s    Z\\""$$


C:Sz***
111
000"(000111"(:::;;;;;r#   r   r   r/   znumber integerrP   r   rj   rk   rl   missing12)marksxdatac                     t          j                                                    }t          j        t
                    5   |||ddg           d d d            d S # 1 swxY w Y   d S )Nr   r   r   r   r   r4   r5   r6   r   r   r  rq   s       r!   test_mixed_type_exceptionz'TestPlotTypes.test_mixed_type_exception  s     Z\\""$$]9%% 	' 	'GB1v&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	's   AA #A c                     t          j                                                    }t          j        t
                    5   ||ddgddg            |||ddg           d d d            d S # 1 swxY w Y   d S )Nr   r   r   r   r  r  s       r!    test_mixed_type_update_exceptionz.TestPlotTypes.test_mixed_type_update_exception  s     Z\\""$$]9%% 	' 	'GBAA'''GB1v&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	's   !A--A14A1N) r;   r<   r=   r4   r@   rA   r   r   r   r   r   usefixturesr  r  r  r
  r  rB   r0   rC   r?   rD   r   r   r   r   paramr   xfailplottersr  r  rE   r#   r!   r   r      s       [Y	x@@# # A@# ^  ^ [[))[Y	x@@$ $ A@ *)$
 [[))[Y	x@@$ $ A@ *)$
 [[))[Y	x@@$ $ A@ *)$ [Y	x@@< < A@<< < < #S$K0+c1X6+dBZ8$tRVn57
 C+,MD'dhTYfk.?@@@BH [Y11[Wg488' ' 98 21'
 [Y11[Wg488' ' 98 21' ' 'r#   r   defaultpng)
extensionsc                    ddl m }  |ddd          } |ddd          } |ddd          } |ddd          }|                                 }|                                }t          ||gi t          d d           f          D ]c\  }	}
 |	j        ||gd	d
gfi |
 |	j        j        }|	j        j        } |	j        ||gd	d
gfi |
 ||	j        j        u sJ ||	j        j        u sJ dd S )Nr   )datetimei  r   r   r   r   )xunitsyunitsV1V2)r  r   r?   dictr   r   rI   r   )fig_testfig_refr  t0t1t2t3ax_testax_refrq   kwargsx_unitsy_unitss                r!   test_overriding_units_in_plotr0    sR    "!!!!!	$1		B	$1		B	$1		B	$1		B!!GF7F+t4===>@ @ 
) 
)
F 	R4,11&111(.(.R4,11&111"(.(((("(.(((((
) 
)r#   c                      t          j                    \  } }|j                            ddg           |                    g g            dS )zQ
    Smoke test to check that no deprecation warning is emitted. See #22640.
    r%   r'   N)r   r   r   update_unitsr   r	  rq   s     r!   !test_no_deprecation_on_empty_datar4  4  sB     LNNEArH3*%%%GGBOOOOOr#   c                      t          j                    \  } }|                    g d          \  }}}|j        dk    sJ t          j                            |g d           d S )N)r%   r'   r%   rO   ff)r   )
g       @        r7        ?r7  r7  r8  r7  r7  r8  )r   r   histshaperB   rv   rw   )figrq   nbinspatchess        r!   	test_histr?  =  sh    lnnGCww999::AtW7eJq"J"J"JKKKKKr#   c                      t          j                    \  } }|                    g dg d           t          j                    5  |                    dd           d d d            d S # 1 swxY w Y   d S )N)r%   r'   rO   r&   )r   r   r   r   r'   rO   )r   r   r   warningscatch_warningsset_xlimr3  s     r!   test_set_limrD  D  s     LNNEArGG   ,,,///		 	"	"  
C                 s   A((A,/A,)%r   rA  r4   numpyrB   
matplotlibmplmatplotlib.axesr   matplotlib.pyplotpyplotr   matplotlib.categorycategoryr   matplotlib.testing.decoratorsr   r   rG   rL   r   r   r   r   r   r   r   r   r   r   r   stylecontextr0  r4  r?  rD  rE   r#   r!   <module>rP     s   ) )                             ! ! ! ! ! ! = = = = = =+# +# +# +# +# +# +# +#\       
3O 3O 3O 3O 3O 3O 3O 3Ol \49dh/	%%%J J J J J J J J3 3 3 3 3 3 3 307 7 7# # # # # # # # # # # # # # # # M' M' M' M' M' M' M' M'` 9((() ) )( ).  L L L    r#   