
    P/Ph$                       d dl m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	Z
d dlmZmZ d dlZd dlZd dlmZ d dlmZ  G d d          Z G d d          Z G d	 d
          Z G d d          Z G d d          Z G d d          Z G d d          Z G d d          Z G d d          Z G d d          Z  G d d          Z! G d d          Z" G d d          Z# G d d           Z$ G d! d"          Z% G d# d$          Z& G d% d&          Z' G d' d(          Z( G d) d*          Z) G d+ d,          Z* G d- d.          Z+d/ Z,ej-        .                    d0g d1          d2             Z/ G d3 d4          Z0d5 Z1d6 Z2d7 Z3d8 Z4d9 Z5d: Z6d; Z7d< Z8ej-        .                    d=d>          d?             Z9ej-        .                    d@dAdBg e
j:        dC          g          dD             Z;ej-        .                    dEg dF          ej<        =                    dG          dH                         Z>dI Z?ej-        .                    dJ ej@        dK            ejA        dL          f          dM             ZBdN ZCdS )O    )nullcontextN)parse)assert_almost_equalassert_array_equalc            
          e Zd Zdd ej        g d          fdd ej        g d          fdd ej        g d	          fd
d ej        d          dz  fdd
 ej        dd          dz  fgZddd ej        g d          fddd ej        g d          fddg d ej        g d          fgZej	        
                    de          d             Zej	        
                    de          d             Zej	        
                    ddd
ie ej        d           fd!d"dgied#fd!d"ied#fd!d"d$gied#fg          d%             Zej	        
                    d&g d'g d'fd"d(gg d'fdd"gg d'fd"gg d'fg          d)             ZdS )*TestMaxNLocator   d   )      4@g      D@g      N@g      T@      Y@MbP?-C6?)        g-C6*?g-C6:?ga2U0*C?g-C6J?r     4&k  4&kC)r   g  4&kr   g  4&kBr   r   g&q5   gLog5g&q   皙皙?N)r   r      ffffff?)g      пr         ?      ?      ?      ?7   )r         ?   r   
   )r         -   <   vmin, vmax, expectedc                 x    t          j        d          }t          |                    ||          |           d S )Nr    nbinsmtickerMaxNLocatorr   tick_values)selfvminvmaxexpectedlocs        \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/matplotlib/tests/test_ticker.py
test_basiczTestMaxNLocator.test_basic    s9    !***COOD$77BBBBB    zvmin, vmax, steps, expectedc                 |    t          j        dd|          }t          |                    ||          |           d S )Nr    T)r)   integerstepsr*   )r.   r/   r0   r8   r1   r2   s         r3   test_integerzTestMaxNLocator.test_integer%   s=    !4uEEECOOD$77BBBBBr5   zkwargs, errortype, matchfooz5set_params() got an unexpected keyword argument 'foo'r8   r   z$steps argument must be an increasing   c                     t          j        ||          5  t          j        di | d d d            d S # 1 swxY w Y   d S )Nmatch )pytestraisesr+   r,   )r.   kwargs	errortyper>   s       r3   test_errorszTestMaxNLocator.test_errors*   s     ]9E222 	* 	*))&)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   6::zsteps, result)r   r   r!   r!   c                 n    t          j        |          }|j        |k                                    sJ d S )N)r8   )r+   r,   _stepsall)r.   r8   resultr2   s       r3   test_paddingzTestMaxNLocator.test_padding5   s<     !...
f$))+++++++r5   )__name__
__module____qualname__nparrayarange
basic_datainteger_datar@   markparametrizer4   r9   	TypeErrorreescape
ValueErrorrD   rI   r?   r5   r3   r   r      s{       	S("(555667	!L!L!LMMN	hbhJJJKKL	
HibillU*+	AyryQ''%/0J 
sD("(===112	tT828$D$D$DEEF	
B"""HBH-@-@-@$A$ABL [3Z@@C C A@C [:LIIC C JIC [7
Y	J	K	K	M
Aq6	J(NO
1z#IJ
Ar7	Z)OP:  * * * [_	ZZZ 
R***
Q
jjj	/  , , , , ,r5   r   c                   &    e Zd Zd Zd Zd Zd ZdS )TestLinearLocatorc                     t          j        d          }t          j        g d          }t	          |                    dd          |           d S )N   numticks)皙333333ӿ皙?r^   r`   )r+   LinearLocatorrM   rN   r   r-   r.   r2   
test_values      r3   r4   zTestLinearLocator.test_basicA   sO    #Q///X///00
COOD#66
CCCCCr5   c                 d    t          j        d          }|                    dd          g k     d S )Nr   r\   r^   r`   )r+   ra   r-   r.   r2   s     r3   test_zero_numticksz$TestLinearLocator.test_zero_numticksF   s4    #Q///c""b((((r5   c                     t          j        d          }|                    ddg i           |j        dk    sJ |j        dg ik    sJ dS )z
        Create linear locator with presets={}, numticks=2 and change it to
        something else. See if change was successful. Should not exception.
        r   r\      r   r   )r]   presetsN)r+   ra   
set_paramsr]   rj   re   s     r3   test_set_paramsz!TestLinearLocator.test_set_paramsJ   sa    
 #Q///FB<888|q    {vrl******r5   c                    t          j        g dddgd          }|                    dd          g dk    sJ |                    dd          g dk    sJ |                    dd          ddgk    sJ |                    d	d
          ddgk    sJ |                    dd          t          j        ddd          k                                    sJ d S )N)r         ?      ?r   r   ))r   r   r   r   )rj   r   r   r   r          @r;   )r+   ra   r-   rM   linspacerG   re   s     r3   test_presetszTestLinearLocator.test_presetsT   s    #___693Z-A -A B B Bq!$$7777q!$$7777q!$$c
2222sC((S#J66661%%Q2)>)>>CCEEEEEEEr5   N)rJ   rK   rL   r4   rf   rl   rs   r?   r5   r3   rY   rY   @   sX        D D D
) ) )+ + +F F F F Fr5   rY   c                   8    e Zd Zd Zd Zd Zd Zd Zd Zd Z	dS )	TestMultipleLocatorc                     t          j        d          }t          j        g d          }t	          |                    dd          |           d S )NV-	@base)go"V-gV-	r   rw   V-@go"@gV-)@r!   r+   MultipleLocatorrM   rN   r   r-   rb   s      r3   r4   zTestMultipleLocator.test_basic_   sY    %5111X . . . / /
COOB33Z@@@@@r5   c                     t          j        dd          }t          j        g d          }t	          |                    dd          |           d S )Nrw   333333?ry   offset)gZd{ gK7A`gx&r   gSc@g`"@gx&1H%@r|   r!   r}   rb   s      r3   test_basic_with_offsetz*TestMultipleLocator.test_basic_with_offsete   s[    %5===X ' ' ' ( (
COOB33Z@@@@@r5   c                     t          j        ddi          5  t          j        d          }t	          |                    dd          d           ddd           dS # 1 swxY w Y   dS )	z5
        Test basic behavior of view limits.
        axes.autolimit_modedatarw   rx   r   r    )r   r    Nmpl
rc_contextr+   r~   r   view_limitsre   s     r3   test_view_limitsz$TestMultipleLocator.test_view_limitsk   s     ^2F;<< 	A 	A)u555CA 6 6@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A   :AA"%A"c                     t          j        ddi          5  t          j        d          }t	          |                    dd          d           ddd           dS # 1 swxY w Y   dS )	b
        Test that everything works properly with 'round_numbers' for auto
        limit.
        r   round_numbersrw   rx      )rz   r{   Nr   re   s     r3   test_view_limits_round_numbersz2TestMultipleLocator.test_view_limits_round_numberss   s    
 ^2ODEE 	I 	I)u555CA 6 6HHH	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	Ir   c                     t          j        ddi          5  t          j        dd          }t	          |                    dd          d           d	d	d	           d	S # 1 swxY w Y   d	S )
r   r   r   rw   ?r   r   r   )g`"g}?5^@Nr   re   s     r3   *test_view_limits_round_numbers_with_offsetz>TestMultipleLocator.test_view_limits_round_numbers_with_offset|   s    
 ^2ODEE 	I 	I)uSAAACA 6 6HHH	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	Is   ;AA#&A#c                     t          j        ddi          5  t          j        d          }t	          |                    dd          d           ddd           dS # 1 swxY w Y   dS )	zM
        Test that 'round_numbers' works properly with a single bin.
        r   r   r   r(   gffffffgffffff@)r   r   N)r   r   r+   r,   r   r   re   s     r3   test_view_limits_single_binz/TestMultipleLocator.test_view_limits_single_bin   s     ^2ODEE 	E 	E%A...Cc : :GDDD	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	Er   c                     t          j        d          }|                    d           |j        j        dk    sJ |                    d           |j        dk    sJ dS )z
        Create multiple locator with 0.7 base, and change it to something else.
        See if change was successful.
        ffffff?rx   333333?r[   )r   N)r+   r~   rk   _edgestep_offset)r.   mults     r3   rl   z#TestMultipleLocator.test_set_params   sm    
 &C000S!!!z#%%%%q!!!|q      r5   N)
rJ   rK   rL   r4   r   r   r   r   r   rl   r?   r5   r3   ru   ru   ^   s        A A AA A AA A AI I II I IE E E	! 	! 	! 	! 	!r5   ru   c            
          e Zd Zd ZddgZd Zej                            de          d             Z	g dZ
d Zej                            d	e
          d
             Zg dZg dg dg dg dg dg dg dg dgZ e eee                    Zej                            de          d             Zej                            dddg          ej                            ddg dfdg dfg          d                         Zej                            dddg          ej                            dddg dfd d!g d"fd#d$g d%fg          d&                         Zd'S )(TestAutoMinorLocatorc                    t          j                    \  }}|                    dd           |                                 t	          j        g d          }t          |j                            d          |           d S )Nr   =
ףp=?皙?皙?g333333?r   333333?gffffff??r   皙?g?r   r   g333333??r   ?r   gffffff?rn   r   g?Tminor)	pltsubplotsset_xlimminorticks_onrM   rN   r   xaxisget_ticklocsr.   figaxrc   s       r3   r4   zTestAutoMinorLocator.test_basic   s    ,..R
At
X G G G H H
 	BH111==zJJJJJr5   r   r   )r   r   c                    t          j                    \  }}|                    dd           |j                            t          j                               t          j        g d          }t          |j        
                    d          |           |                    dd           t          j        g d          }t          |j        
                    d          |           d	S )
zI
        Test that first and last minor tick appear as expected.
        ffffffffffff?) r   g333333ggffffffgg333333皙gr^   gffffffg333333皙ٿr_   皙ɿr   r   r`   r   皙?333333?r   皙?r   r   r   r   gffffff?g?r   g?r   Tr   r   r    )g      g      g      g      g      g                  r   r   r         @g      @      @g      @      @N)r   r   r   r   set_minor_locatorr+   AutoMinorLocatorrM   rN   r   r   r   s       r3   test_first_and_last_minorticksz3TestAutoMinorLocator.test_first_and_last_minorticks   s    
 ,..R
D#
""7#;#=#=>>>X B B B C C
 	BH111==zJJJ
BX G G G H H
BH111==zJJJJJr5   z%nb_majorticks, expected_nb_minorticksc                    t          j                    \  }}d} |j        |  |                    t	          j        |d         |d         |                     |                                 |j                            t          j
                               t          |j                                                  |k    sJ d S )N)r   r    r   r   )r   r   r   
set_xticksrM   rr   r   r   r   r+   r   lenget_minorticklocs)r.   nb_majorticksexpected_nb_minorticksr   r   xlimss         r3   test_low_number_of_majorticksz2TestAutoMinorLocator.test_low_number_of_majorticks   s     ,..RU
bk%(E!HmDDEEE

""7#;#=#=>>>28--//004JJJJJJJr5   ))r   r    )r   r   )r   r    )r    r    )r!   r    c                     t          j        ddi          5  d | j        D             }t          j                            |t          j                    j                   d d d            d S # 1 swxY w Y   d S )N_internal.classic_modeFc                     g | ]
}|d          S r   r?   ).0xs     r3   
<listcomp>zKTestAutoMinorLocator.test_using_all_default_major_steps.<locals>.<listcomp>   s    FFF1!A$FFFr5   )	r   r   majorstep_minordivisionsrM   testingassert_allcloser+   AutoLocatorrF   )r.   
majorstepss     r3   "test_using_all_default_major_stepsz7TestAutoMinorLocator.test_using_all_default_major_steps   s    ^5u=>> 	E 	EFF(EFFFJJ&&z'.':'<'<'CE E E	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	Es   AA,,A03A0z&major_step, expected_nb_minordivisionsc                 X   t          j                    \  }}d|f} |j        |  |                    |           |                                 |j                            t          j                               t          |j        
                                          dz   }||k    sJ d S Nr   r   )r   r   r   r   r   r   r   r+   r   r   r   )r.   
major_stepexpected_nb_minordivisionsr   r   r   nb_minor_divisionss          r3   test_number_of_minor_ticksz/TestAutoMinorLocator.test_number_of_minor_ticks   s     ,..RJU
e

""7#;#=#=>>> !;!;!=!=>>B!%???????r5   )r   r   r   gn?)r   ԍ;)r   gVs?=)gH׊gIhG|a)gv!>ҷ>)ʔA{v()g"s2_dglEՎfUr   ){Gzt?{Gz?Q?g?gQ?gQ?g
ףp=
?r   g)\(?gp=
ף?gQ?g333333?g(\µ?g
ףp=
?gRQ?gzG?)\(?gq=
ףp?      ?gp=
ף?gHzG?)gO
;gO
;gU;g#B;gU;g̈=;gnP*@;g#B;gԍ;gaW;g̈=;gmx;gJ;gnP*@;gnXen;g+3M;r   )g+<g+=gt=gvIh%=gt =g(#=gQu.U)=gvIh%,=gU.=gnb]K2=g(3=g7Q5=gU>?7=gQu.U9=gc߯x:=g; ==gU>=)g*#&,gYg#"5Ԉg_eG|gS'цgBY[%gk̈́gv!g|)vgQ؎gqrgƀg%e~gw$}g߈/|gYygv(xgS'vgv!tgz]rgqrqgw$mgHjgv(hgz]b)gL>gE/w>gZMϢ>gkʹ>g	ʧ#>g!+lěN>g:0y>gR>g};h>gBY[%>gqwNP>gʔA{>gS'Ѷ>g>g.W'>gG)R>gxz)e秷>r   )g5m/Gg<gT跾g`gxz)e秷gIGmg肸zggG)Rg<g&|gg5_涾gqdqAg34gY#)g#"5Ըg_~r   gҷg.W'gS'Ѷr   gBY[%g:0yg	ʧ#gkʹgE/wgE̳g|)vg<sAC gz]ʲgQ؎g 4PSȱgqrg>g\+-eqg+i)+gM7܉g%eޮgw$zlim, refc                 :   t          j                    \  }}|                                 |                    dddd           |                    dddd           |                    |           t          |j                            d	          |           d S )
NTr   yr   )	linewidthmajork)colorr   r   )r   r   r   gridset_ylimr   yaxisr   )r.   limrefr   r   s        r3   test_additionalz$TestAutoMinorLocator.test_additional  s    ,..R

gsa000
gSA666
CBH111==sCCCCCr5   use_rcparamFTr   r   c                    |rddd}i }ni }ddi}t          j        |          5  t          j                    \  }} |j        |   |j        |  |j                            t          j	        di |           |j
                            t          j	        di |           t          |j                            d          |           t          |j
                            d          |           d d d            d S # 1 swxY w Y   d S )Nautozxtick.minor.ndivszytick.minor.ndivsnTr   r?   )r   r   r   r   r   r   r   r   r+   r   r   r   r   )r.   r   r   r   contextrB   r   r   s           r3   test_number_of_minor_ticks_autoz4TestAutoMinorLocator.test_number_of_minor_ticks_auto  sw     	#,2PPGFFG6]F^G$$ 	H 	HlnnGCBKBKH&&w'?'I'I&'I'IJJJH&&w'?'I'I&'I'IJJJ 5 5D 5 A A3GGG 5 5D 5 A A3GGG	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	Hs   CDDDzn, lim, refr   )r   r   )r   r   r   r   r   rp   )r   r   r   rn   r   ro   r!   ri   )	r   r`   r   r   r   r   r   r   r   c                    |r||d}i }ni }d|i}t          j        |          5  t          j                    \  }} |j        |   |j        |  |j                            t          j	        d                     |j        
                    t          j        di |           |j                            t          j	        d                     |j        
                    t          j        di |           t          |j                            d          |           t          |j                            d          |           d d d            d S # 1 swxY w Y   d S )Nr   r   r   Tr   r?   )r   r   r   r   r   r   r   set_major_locatorr+   r~   r   r   r   r   r   )	r.   r   r   r   r   r   rB   r   r   s	            r3   test_number_of_minor_ticks_intz3TestAutoMinorLocator.test_number_of_minor_ticks_int.  s     	,-AFFGFFG1XF^G$$ 		H 		HlnnGCBKBKH&&w'>q'A'ABBBH&&w'?'I'I&'I'IJJJH&&w'>q'A'ABBBH&&w'?'I'I&'I'IJJJ 5 5D 5 A A3GGG 5 5D 5 A A3GGG		H 		H 		H 		H 		H 		H 		H 		H 		H 		H 		H 		H 		H 		H 		H 		H 		H 		Hs   D'EE EN)rJ   rK   rL   r4   paramsr   r@   rR   rS   r   r   r   r   limits	referencelistzipadditional_datar   r  r  r?   r5   r3   r   r      s       K K K 	F
K K K& [DfMM	K 	K NM	K )  )  )E E E [E57 7	@ 	@7 7	@> > >F	B 	B 	B	 	 		' 	' 	'	' 	' 	'	 	 	
	1 	1 	1	E 	E 	E	 	 	/I: d33vy1122O[Z99D D :9D []UDM::[G G GH " " "#	
	 	H H	 	 ;:H" []UDM::[,,,-:::;FFFG
 H H  ;:H H Hr5   r   c                   8    e Zd Zd Zd Zd Zd Zd Zd Zd Z	dS )	TestLogLocatorc                    t          j        d          }t          j        t                    5  |                    dd           d d d            n# 1 swxY w Y   t          j        g d          }t          |                    dd          |           t          j        d	          }t          j        g d
          }t          |                    dd          |           d S )Nr    r\   r     )h㈵>r   r         $@     @@     j@    cA    eAr   g     @r   rx   )
r   r   rq         @g       @g      0@g      @@g      P@g      `@g      p@r   r
   )	r+   
LogLocatorr@   rA   rW   r-   rM   rN   r   rb   s      r3   r4   zTestLogLocator.test_basicJ  s"    !,,,]:&& 	% 	%OOAt$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% X @ @ @ A A
 	COOE599:FFF a(((XNNNOO
COOAs33Z@@@@@s   AAAc                     t          j        ddi          \  }}|                    d           |                    dd           t	          |                                g d           dS )	z<
        Polar Axes have a different ticking logic.
        
projectionpolar)
subplot_kwlogr   r
   )r!   r
   r  N)r   r   
set_yscaler   r   
get_yticksr.   r   r   s      r3   test_polar_axeszTestLogLocator.test_polar_axesX  sg     ,<*ABBBR
e
As2==??OOO<<<<<r5   c                 4   t          j        d          }t          |                    dd          g d           t          j        t	          j        dd                    }d|                    d	d
          vsJ d|                    d	d
          vsJ d S )NrG   subsr   r   )g)\(?gq=
ףp?gQ?r   gp=
ף?gHzG?gQ?r   r!   r   r   r   r  )r+   r  r   r-   rM   rO   re   s     r3   test_switch_to_autolocatorz)TestLogLocator.test_switch_to_autolocatora  s     e,,,3??466DDD	F 	F 	F  bi2&6&6777#//#s3333333??344444444r5   c                     t          j                    }|                    ddgd           |j        dk    sJ |j        dk    sJ t          |j                  dgk    sJ dS )z
        Create log locator with default value, base=10.0, subs=[1.0],
        numticks=15 and change it to something else.
        See if change was successful. Should not raise exception.
           rq   r   )r]   r"  ry   N)r+   r  rk   r]   _baser  _subsre   s     r3   rl   zTestLogLocator.test_set_paramsj  so      ""A666|q    yA~~~~CI3%''''''r5   c                     t          j        d          }t          j        g d          }t	          |                    dd          |           d S )Nr   r   r    r!  )r   r`   r   r   rq   r   r  r         I@r         i@     @@r       @@     @     @     @     j@r       jA    A    .A    >A    SAr      sA    ׇA    חA    קA    eͽAr   r  )r+   r  rM   rN   r   r-   r.   llrc   s      r3   test_tick_values_correctz'TestLogLocator.test_tick_values_correctv  s`    Y///X O O O P P

 	BNN1c22J?????r5   c                     dt           j        d<   t          j        d          }t	          j        g d          }t          |                    dd          |           d S )NFr   r)  r!  )!r   r`   r   r   rq   r   r  r   r*  r   r+  r,  r  r-  r.  r/  r0  r1  r  r2  r3  r4  r5  r6  r  r7  r8  r9  r:  r;  r  g    eAg    _Ar   r9  )r   rcParamsr+   r  rM   rN   r   r-   r<  s      r3   test_tick_values_not_emptyz)TestLogLocator.test_tick_values_not_empty  sh    16-.Y///X 7 7 7 8 8
 	BNN1c22J?????r5   c                    t           j                            d          }|                    d          g g g}t	          j        t          |          dd          \  }}t          |                                |          D ]3\  }}|	                    |d           |
                    dd	
           4|                                D ]s}t          |                                |d                                         k              sJ |                                |d                                         k    sJ td S )Ni!N,r
   )sizeT)sharexshareyr!   )binsr  clip)nonpositiver   )rM   randomdefault_rngnormalr   r   r   r	  flattenhistr  rG   r  get_ylim)r.   rng
dummy_datar   axesr   r   s          r3   test_multiple_shared_axesz(TestLogLocator.test_multiple_shared_axes  s#   i##H--jjcj**B3
LZdKKK	TDLLNNJ77 	5 	5HBGGDrG"""MM%VM4444,,.. 	7 	7Br}}$q'*<*<*>*>>?????;;==DG$4$4$6$666666	7 	7r5   N)
rJ   rK   rL   r4   r  r#  rl   r>  rA  rR  r?   r5   r3   r  r  I  s        A A A= = =5 5 5
( 
( 
(@ @ @	@ 	@ 	@7 7 7 7 7r5   r  c                       e Zd Zd ZdS )TestNullLocatorc                     t          j                    }t          j        t                    5  |                                 ddd           dS # 1 swxY w Y   dS )z
        Create null locator, and attempt to call set_params() on it.
        Should not exception, and should raise a warning.
        N)r+   NullLocatorr@   warnsUserWarningrk   re   s     r3   rl   zTestNullLocator.test_set_params  s    
 !##\+&& 	 	NN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAANrJ   rK   rL   rl   r?   r5   r3   rT  rT    s#            r5   rT  c                   :    e Zd Zed             Zed             ZdS )_LogitHelperc                     d| cxk     rdk     rZn nWd|cxk     rdk     rJn nGt          j        t          j        d| z  dz
             t          j        d|z  dz
                       ndS )Nr   r   F)rM   iscloser  )r   r   s     r3   r]  z_LogitHelper.isclose  su     q9999199999Q 
BF1Q3q5MM>BF1Q3q5MM>:::05	7r5   c                    t          j        |           }t          j        |          }t          j        |dk              rt          j        |dk               sJ t          j        |dk              rt          j        |dk               sJ t          j        d|z  dz
             }t          j        d|z  dz
             }t	          ||           d S r   )rM   rN   rG   r  r   )r   r   r   aylxlys         r3   r   z _LogitHelper.assert_almost_equal  s    Xa[[Xa[[vb1f~~0"&a..000vb1f~~0"&a..000fQrT!Vnn_fQrT!Vnn_B#####r5   N)rJ   rK   rL   staticmethodr]  r   r?   r5   r3   r[  r[    sH        7 7 \7 $ $ \$ $ $r5   r[  c                      e Zd Zg dZdd ej        dd          z  z  dd ej        dd          z  z  dd ej        dd          z  z  dd ej        dd          z  z  dd ej        dd          z  z  dd ej        dd	          z  z  dd ej        dd
          z  z  dd ej        dd          z  z  gZg dZej	        
                    d eee                    d             Zej	        
                    de          d             Zej	        
                    deez             d             Zej	        
                    d eee                    d             Zd Zg d ej        dd          z  dd ej        dd          z  z
  Zej	        
                    dd  ej        ed          D                       d             Zej	        
                    de          d             ZdS )TestLogitLocator)r   r   )r   gףp=
?)gMb@?gCl?-C6
?gSt$?)gh㈵>g;?)gƠ>g?gHj>ge(?)g:0y5>g$P?r   r!   r[   r   r    r   r%  rh   	   ))r   r   )r   r`   )r   r   zlims, expected_low_ticksc                     t          g |dd|z
            }t          j        d          }t                               |j        | |           dS )zR
        Create logit locator with huge number of major, and tests ticks.
        r   r   r
   r(   N)sortedr+   LogitLocatorr[  r   r-   )r.   limsexpected_low_ticksexpected_ticksr2   s        r3   test_basic_majorz!TestLogitLocator.test_basic_major  sr      A A#A-?)?A
 
 "---((COT"	
 	
 	
 	
 	
r5   rm  c                 B   t          j        d          }t          j        dg d          }dD ]n}|                    |           |                    |            |j        | } |j        | }|j        |j        k    sJ ||k                                    sJ odS )zj
        When the axis is zoomed, the locator must have the same behavior as
        MaxNLocator.
        r
   r(   )r   r   r    r!   )r)   r8   )r   rh      N)r+   rl  r,   rk   r-   shaperG   )r.   rm  r2   maxn_locr)   ticks
maxn_tickss          r3   test_maxn_majorz TestLogitLocator.test_maxn_major  s     "---&SFFF 	/ 	/ENNN'''e,,,#COT*E--t4J;*"22222Z',,......	/ 	/r5   c                 D   t          t          j        t          j        |d                                        dz  dz   }t	          j        d          }t          |dd          D ]8}|                    |           t           |j	        |           |dz   k    sJ 9dS )zB
        Assert logit locator for respecting nbins param.
        r   r   r   r
   r(   r   N)
intrM   floorlog10r+   rl  rangerk   r   r-   )r.   rm  basic_neededr2   r)   s        r3   test_nbins_majorz!TestLogitLocator.test_nbins_major  s     BHRXd1g%6%6777881<q@"---<B// 	< 	<ENNN'''s-..%!);;;;;	< 	<r5   c                 <   t          g |dd|z
            }t          |          }t          j        d          }t          j        dd          }t	          |dd          D ]}|                    |           |                    |            |j        | } |j        | }	t          |          t          |          k    r)t          |          dz
  d	z  t          |	          k     sJ t                              t          g ||	          |           d
S )zt
        In large scale, test the presence of minor,
        and assert no minor when major are subsampled.
        r   r   r
   r(   T)r)   r   r   r   r    N)	rk  r   r+   rl  r|  rk   r-   r[  r   )
r.   rm  rn  ro  r}  r2   	minor_locr)   major_ticksminor_tickss
             r3   
test_minorzTestLogitLocator.test_minor  sX     A A#A-?)?A
 
 >**"---(s$???	<B// 	J 	JENNN'''  u ---)#/40K/)/6K;3~#6#666K((1,1C4D4DDDDDD 007[7;788.J J J J	J 	Jr5   c                     t          j        d          }|j        rJ d|_        |j        sJ |                    d           |j        rJ d S )Nr
   r(   TFr   )r+   rl  r   rk   re   s     r3   test_minor_attrz TestLogitLocator.test_minor_attr  s`    "---9	yU###9r5   r   r   c                 (    g | ]\  }}||k    ||fS r?   r?   )r   abs      r3   r   zTestLogitLocator.<listcomp>&  s1     	
 	
 	
AAvv Fvvr5   r   )repeatc                     t          j                    } |j        | }t          |          t          |          k    sJ dS )zd
        Create logit locator, and test the nonsingular method for acceptable
        value
        N)r+   rl  nonsingularrk  )r.   rm  r2   lims2s       r3   test_nonsingular_okz$TestLogitLocator.test_nonsingular_ok$  sC     "$$&d||ve}},,,,,,r5   okvalc                    t          j                    }d|}}|                    ||          \  }}||k    sJ d|cxk     r|k     sn J |d}}|                    ||          \  }}||k    sJ ||cxk     rdk     sn J dS )zh
        Create logit locator, and test the nonsingular method for non
        acceptable value
        r   r   r   r   N)r+   rl  r  )r.   r  r2   r/   r0   vmin2vmax2s          r3   test_nonsingular_nokz%TestLogitLocator.test_nonsingular_nok5  s     "$$%dtT22u}}}}5    5      QdtT22u}}}}u    q        r5   N)rJ   rK   rL   ref_basic_limitsrM   rO   ref_basic_major_ticksref_maxn_limitsr@   rR   rS   r	  rp  rw  r~  r  r  acceptable_vmin_vmax	itertoolsproductr  r  r?   r5   r3   rd  rd    s       	 	 	 	
R929Q??"#	R929Q??"#	R929Q??"#	R929Q??"#	R929Q??"#	R929Q??"#	R929Q??"#	R929Q###$	 GFFO["344 
 
	 
 [V_55/ / 65/ [V%5%GHH	< 	< IH	< ["344 J J	 J2  
2q!!
!
cYRYr1%%%
%
 [	
 	
+)+,@KKK	
 	
 	
 - - - [W&:;;! ! <;! ! !r5   rd  c                       e Zd Zd ZdS )TestFixedLocatorc                     t          j        t          dd          d          }|                    d           |j        dk    sJ dS )z
        Create fixed locator with 5 nbins, and change it to something else.
        See if change was successful.
        Should not exception.
        r      r    r(   r%  N)r+   FixedLocatorr|  rk   r)   )r.   fixeds     r3   rl   z TestFixedLocator.test_set_paramsG  sQ     $U1b\\;;;q!!!{ar5   NrY  r?   r5   r3   r  r  F  s#                 r5   r  c                       e Zd Zd ZdS )TestIndexLocatorc                     t          j        dd          }|                    dd           |j        dk    sJ |j        dk    sJ dS )z
        Create index locator with 3 base, 4 offset. and change it to something
        else. See if change was successful.
        Should not exception.
        r[   r   r   r%  N)r+   IndexLocatorrk   r&  r   )r.   indexs     r3   rl   z TestIndexLocator.test_set_paramsS  s^     $!A666a***{a|q      r5   NrY  r?   r5   r3   r  r  R  s#        	! 	! 	! 	! 	!r5   r  c                       e Zd Zd Zej                            dddddgfddg dfg          d             Zd Zd	 Z	d
S )TestSymmetricalLogLocatorc                     t          j        dd          }|                    dgd           |j        dgk    sJ |j        dk    sJ dS )z
        Create symmetrical log locator with default subs =[1.0] numticks = 15,
        and change it to something else.
        See if change was successful.
        Should not exception.
        r!   r   ry   	linthreshrq   rh   )r"  r]   N)r+   SymmetricalLogLocatorrk   r'  r]   r.   syms     r3   rl   z)TestSymmetricalLogLocator.test_set_params`  s_     +qAAASEA...ySE!!!!|q      r5   r&   r   r   r   r   r   r   c                     t          j        dd          }|                    ||          }t          ||           d S )Nr!   r   r  )r/   r0   )r+   r  r-   r   )r.   r/   r0   r1   r  ru  s         r3   test_valuesz%TestSymmetricalLogLocator.test_valuesl  sD     +qAAAT555(+++++r5   c                     t          j        ddddg          }|                                 |j                            dd           t           |            g d           d S )Nr!   r   rq   r  )ry   r  r"  )	ir   r   r   r   r	   (   )r+   r  create_dummy_axisaxisset_view_intervalr   r  s     r3   	test_subsz#TestSymmetricalLogLocator.test_subsy  sj    +qSzRRR""3+++3355"E"E"EFFFFFr5   c                    t          j        dd          }|                                 |j                            dd            |            dgk                                    sJ |j                            dd            |            ddgk                                    sJ |                    dd          d	k    sJ |                    d
d
          dk    sJ |                    dd          dk    sJ d S )Nr!   r   r  rh   ri  r      r  )r   r
   r  )r   r   )MbPr   )r+   r  r  r  r  rG   r   r  s     r3   test_extendingz(TestSymmetricalLogLocator.test_extending  s   +qAAA""1a(((###%%%%%""1b)))#t$))+++++r2&&(2222sC((J6666q!$$777777r5   N)
rJ   rK   rL   rl   r@   rR   rS   r  r  r  r?   r5   r3   r  r  _  s        
! 
! 
! ["A1vQ


# , , ,G G G	8 	8 	8 	8 	8r5   r  c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )
TestAsinhLocatorc                     t          j        dd          }|j        dk    sJ |j        dk    sJ |j        dk    sJ d S )NgX9v@   )linear_widthr]   r!   )r+   AsinhLocatorr  r]   ry   r.   lctrs     r3   	test_initzTestAsinhLocator.test_init  sQ    #DDD E))))}""""yBr5   c                    t          j        ddddd          }|j        dk    sJ |j        dk    sJ |j        dk    sJ |j        dk    sJ |                    d           |j        dk    sJ |                    d            |j        dk    sJ |                    d	
           |j        d	k    sJ |                    d 
           |j        d	k    sJ |                    d           |j        dk    sJ |                    d            |j        dk    sJ |                    d           |j        dk    sJ |                    d            |j        dk    sJ |                    g            |j        J d S )Nr       r   r   )r   g      
@)r  r]   	symthreshry   r"     r\   r   )r  r%  rx   )r   g     @r!  )r+   r  r]   r  ry   r"  rk   r  s     r3   rl   z TestAsinhLocator.test_set_params  s   #-/5)*> > > }""""~&&&&yA~~~~yK''''$$$}""""}""""#&&&~$$$$$'''~$$$$QyA~~~~T"""yA~~~~Z(((yJ&&&&T"""yJ&&&&R   y     r5   c                    t          j        ddd          }t          |                    dd          t	          j        ddd                     t          |                    d	d
          t	          j        d	dd                     t          |                    dd          t	          j        ddd                     d S )Nr
   r;   r   r  r]   ry   r   r   )\(?r`   r   r   gB`"۹?{Gz?g{Gzr   gMO?Mb`?r+   r  r   r-   rM   rO   r  s     r3   test_linear_valuesz#TestAsinhLocator.test_linear_values  s    #rJJJD,,R33Ib$44	6 	6 	6D,,T377IdE488	: 	: 	:D,,UD99IeVU;;	= 	= 	= 	= 	=r5   c                     t          j        ddd          }t          |                    dd          g d           t          |                    dd	          g d
           d S )Nr   r;   r   r  r  r
   )r  r  r   r   r   r   r`   r   r    r	   r
   r  )r  r  r  r  r   r   r   r[   r	   r
   r  r+   r  r   r-   r  s     r3   test_wide_valuesz!TestAsinhLocator.test_wide_values  s    #rJJJD,,T3774 4 4	5 	5 	5 	D,,UD997 7 7	8 	8 	8 	8 	8r5   c                     t          j        ddd          }t          |                    dd          g d           dS )	z<Check that manually injected zero will supersede nearby tickr
   r[   r   r  r   r   )r   r   r   Nr  r  s     r3   test_near_zerozTestAsinhLocator.test_near_zero  sF    #qqIIID,,T3779I9I9IJJJJJr5   c                     t          j        dd          }t          |                    dd          t	          j        ddd                     d S )Nr   r;   r\   e   f   gq=
ףY@r   r  r  s     r3   test_fallbackzTestAsinhLocator.test_fallback  sV    #C"555D,,S#66Ic6377	9 	9 	9 	9 	9r5   c                    t          j        dddd          }|                                 |j                            dd           t           |            g d           |j                            dd	           t           |            g d
           |j                            dd           t           |            g d
           |j                            dd           t           |            g d           d S )Nr   r[   r   r   )r  r]   r  ry   r   r   )r   r   r   r   r  g333333r   r   )r   r   r   )r+   r  r  r  r  r   r  s     r3   test_symmetrizingz"TestAsinhLocator.test_symmetrizing  s   #Q.2< < <   	##B***DDFFJJJ///	##B,,,DDFFJJJ///	##E4000DDFFJJJ///	##As+++DDFFNNN33333r5   c                     t          j        dddd          }t          |                    dd          g d           t          j        dd	d
          }t          |                    dd          g d           d S )Nr   rh   r!   )r   r[   r    )r  r]   ry   r"  n   )iir  iir  r   r  r   r   r_   r   r   r   r   r   r   r[   r    r!   r#   2   r
   i,    r	   r    r  ii  )iiir   r   r   r   r`   r   r       }   iq  r  )r.   lctr10lctr5s      r3   test_base_roundingz#TestAsinhLocator.test_base_rounding  s    %1q+-I? ? ?F..tS99A A A	B 	B 	B
 $!bqIIIE--eT::6 6 6	7 	7 	7 	7 	7r5   N)rJ   rK   rL   r  rl   r  r  r  r  r  r  r?   r5   r3   r  r    s          ! ! !>= = =8 8 8K K K9 9 94 4 4"7 7 7 7 7r5   r  c                      e Zd Zg dZddgZddgZg dZddgddgd	d
gddgddggZg dZe	j
                            dddg          d             Ze	j
                            de          d             Ze	j
                            de          d             Ze	j
                            de          d             Zd Zd Ze	j
                            de          d             Ze	j
                            de          d             Ze	j
                            d e          d!             Ze	j
                            d e          d"             Zd# Zd$ Zd% Zd&S )'TestScalarFormatter)){      r   )iCir   )i50  i=0  i40  )iii)g    i@g    j@順 )g    jg    i`y)g    hi@g    j@r  )g    jg    hir  )iO iQ iP )i+i+i+)r   r   r   )r  r  r   )g/'?g_L?r   )g
ףp=@g33333@i  )g@g    `@iȯ  )g1е/G?gg޻G?g9̗G?)g\h@gp=
@i.1  )g      "@g      (@r   )g      @     @r   )g     @r  r   )Gz?r  r   )g{G#@gQ$@r!   )g(\X@gq=
ף Y@r
   )g(\@g
ףp=
@r   )g{G/@g(\0@rr  )g!rhܿrh|?r   )grh|߿r  r   )g3333@g    @@i0  )gffffgffff@r   TF)	)Fr   )r  r   r   F)Tr  r   )r  r	   r   F)Tr  )r  r!   r   F)Tr  )r  x   r   F)Tr  )ir  r   F)Tr  )r  r  r  F)T)r|   r%  )g   tAg   0Ari  T)Tr   g     jr  r    F)T)r   r   r  r   Fr   z0.000g(0?z0.012grh|?z0.123gGz?z1.230g(@z12.300))r   1e-1)r   z1.1e-1)r9  1e8)g    9Az1.1e8zunicode_minus, result)T   −1)F-1c                     |t           j        d<   t          j                    j                                                            d                                          |k    sJ d S )Naxes.unicode_minusr   )r   r@  r   gcar   get_major_formatterformat_data_shortstrip)r.   unicode_minusrH   s      r3   test_unicode_minusz&TestScalarFormatter.test_unicode_minus2  sc     .;)*GIIO//11CCBGGMMOO     r5   zleft, right, offsetc                 p   t          j                    \  }}|j                                        }||k    rt	          j        t          d          nt                      5  |                    ||           d d d            n# 1 swxY w Y   |j        	                                 |j
        |k    sJ ||k    rt	          j        t          d          nt                      5  |                    ||           d d d            n# 1 swxY w Y   |j        	                                 |j
        |k    sJ d S )NzAttempting to set identicalr=   )r   r   r   r  r@   rW  rX  r   r   _update_ticksr   )r.   leftrightr   r   r   	formatters          r3   test_offset_valuez%TestScalarFormatter.test_offset_value:  s   ,..RH0022	  l;.KLLLL$/MM	% 	%KKe$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	   6))))  l;.KLLLL$/MM	% 	%KKt$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	   6))))))s$   BB	B"DD	D	
use_offsetc                     t          j        d|i          5  t          j                    }||                                k    sJ |j        dk    sJ 	 d d d            d S # 1 swxY w Y   d S )Nzaxes.formatter.useoffsetr   )r   r   r+   ScalarFormatterget_useOffsetr   )r.   r  tmp_forms      r3   test_use_offsetz#TestScalarFormatter.test_use_offsetK  s    ^7DEE 	( 	(.00H!7!7!9!99999?a'''''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   ;A  A$'A$use_math_textc                     t          j        d|i          5  t          j                    }||                                k    sJ 	 d d d            d S # 1 swxY w Y   d S )Naxes.formatter.use_mathtext)r   r   r+   r  get_useMathText)r.   r  r
  s      r3   test_useMathTextz$TestScalarFormatter.test_useMathTextR  s    ^:MJKK 	? 	?.00H H$<$<$>$>>>>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   .AAAc                     t          j                    }|                    d           |                                rJ |j        dk    sJ d S )Nr   )r+   r  set_useOffsetr	  r   r.   r
  s     r3   test_set_use_offset_floatz-TestScalarFormatter.test_set_use_offset_floatX  sU    *,,s###))+++++#%%%%%%r5   c                    t          j                    }|d         }|r|d         dd          g t           j        gfv rt          j        d           t          j        ddi          5  t          j                    }|	                                sJ |
                                 |j                            dd           |                    g d	           | |d
          v sJ 	 d d d            d S # 1 swxY w Y   d S )Nthousands_sepgroupingr   zLocale does not apply groupingzaxes.formatter.use_localeTr   r!   )r   r   r[   r  )locale
localeconvCHAR_MAXr@   skipr   r   r+   r  get_useLocaler  r  set_data_intervalset_locs)r.   convsepr
  s       r3   test_use_localez#TestScalarFormatter.test_use_locale^  sS    ""?# 	:d:&rss+V_4E/FFFK8999^8$?@@ 	( 	(.00H))+++++&&(((M++Ar222iii(((((3--'''''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   'A?C44C8;C8z.sci_type, scilimits, lim, orderOfMag, fewticksc                    t          j                    }|                    |           |                    |           t	          j                    \  }}|j                            |            |j        |  |r,|j        	                    t          j
        d                     |                    |j                                                   ||j        k    sJ d S )Nr   )r+   r  set_scientificset_powerlimitsr   r   r   set_major_formatterr   r  r,   r  get_majorticklocsorderOfMagnitude)	r.   sci_type	scilimitsr   
orderOfMagfewticksr
  r   r   s	            r3   test_scilimitsz"TestScalarFormatter.test_scilimitsm  s     *,,)))  +++,..R
$$X...S 	?H&&w':1'='=>>>"(4466777X6666666r5   zvalue, expectedc                     dt           j        d<   t          j                    }|                    |          |k    sJ d S )NFr  )r   r@  r+   r  format_data)r.   valuer1   sfs       r3   test_format_dataz$TestScalarFormatter.test_format_data|  s@    -2)*$&&~~e$$000000r5   zdata, expectedc                     t          j                    \  }}|                    dd           |j                                        j        } ||          |k    sJ d S )Nr   r   )r   r   r   r   r  r  )r.   r   r1   r   r   fmts         r3   test_cursor_precisionz)TestScalarFormatter.test_cursor_precision  sZ    ,..R
Bh**,,>s4yyH$$$$$$r5   c                 6   t          j                    }|                                 |j                            dd           |j        } ||          |k    sJ |j                                        dk    sJ |j                                        dk    sJ d S )Nr   r!   ri  )r+   r  r  r  r  r  get_tick_space
get_minpos)r.   r   r1   r0  r3  s        r3   test_cursor_dummy_axisz*TestScalarFormatter.test_cursor_dummy_axis  s     $&&

!!!R((("s4yyH$$$$w%%''1,,,,w!!##q((((((r5   c                    t           j                            dddd           t          t          j                  j        dk     r|t	          j        t          d          5  t          j
                    \  }}|                    g d           |j                                         d d d            d S # 1 swxY w Y   d S t	          j        t          d	          5  t	          j        t          d          5  t          j
                    \  }}|                    g d           |j                                         d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )
Nserifcmr10F)font.familyz
font.serifr  rh   zcmr10 font should ideallyr=   r  z
Glyph 8722)r   r@  updateparse_versionr@   __version__r   rW  rX  r   r   r   canvasdrawr  s      r3   test_mathtext_ticksz'TestScalarFormatter.test_mathtext_ticks  s   "!+0
 
 	 	 	 +,,2Q66k1LMMM " ",..Rjjj)))
!!!" " " " " " " " " " " " " " " " " "
 ,{,??? " ",{2MNNN" ",..Rjjj)))
!!!	" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "sJ   !AB55B9<B9E$9AE E$E	E$E	E$$E(+E(c                    t           j                            dddd           |                    t          j        d          5  t          j                    \  }}|                    ddgd	dg           |	                    d
           g d}t          j                    }|                    |t          ||                     |j                                         |j        rJ 	 d d d            d S # 1 swxY w Y   d S )Nr;  cmT)r<  zmathtext.fontsetr  zmatplotlib.mathtext)loggergQr   r  r  )r  r   r   r  )r   r@  r=  at_levelloggingWARNINGr   r   plotr  r+   LogFormatterSciNotation
set_yticksmapr@  rA  text)r.   caplogr   r   yticksr  s         r3   test_cmr10_substitutionsz,TestScalarFormatter.test_cmr10_substitutions  sE   " $+/
 
 	 	 	 __W_5J_KK 	# 	#lnnGCGGUDMB:...MM%   '''F799IMM&#i"8"8999JOO{""""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#s   B#C66C:=C:c                 x    t          j                    }|                    g             |d          dk    sJ d S )Nr    )r+   r  r  )r.   r0  s     r3   test_empty_locsz#TestScalarFormatter.test_empty_locs  s8    $&&
Br#ww"}}}}}}r5   N)rJ   rK   rL   offset_datause_offset_datauseMathText_datascilimits_datacursor_datar.  r@   rR   rS   r  r  r  r  r  r!  r,  r1  r4  r8  rB  rP  rS  r?   r5   r3   r  r    sk         KB UmOe}
 
 
N 
W				xK  K [47GI I I I [2K@@* * A@*  [\?;;( ( <;( [_.>??? ? @??
& & &( ( ( [8.J J7 7J J7 [.<<1 1 =<1
 [-{;;% % <;% [-{;;) ) <;)" " "&# # #$    r5   r  c                      e Zd Zdd ej        dd           ej        dd          g dfdd ej        dd	ej        d
ddg           ed          g dfdd ej        g de           ed          g dfgZ	dddej        ej
        gZej                            de	          ej                            de          d                         Zd ZdS )TestLogFormatterExponentTr   r  r  )z-3z-2r  0123Fr!   r   r  r`   r   gh㈵r   )0.1z1e-053.14z0.2z-0.2z-1e-05r  )r[   r    r  *   dtype)r^  51242rq   r   r  z2labelOnlyBase, exponent, locs, positions, expectedry   c                   	 t          j        ||          		                                 	j                            d||z             ||z  }	fdt          ||          D             }d |D             }||k    sJ d S )Nry   labelOnlyBaser   c                 .    g | ]\  }} ||          S r?   r?   )r   r   posr  s      r3   r   z7TestLogFormatterExponent.test_basic.<locals>.<listcomp>  s)    IIIC))As##IIIr5   c                 :    g | ]}|                     d d          S )-u   −replace)r   labels     r3   r   z7TestLogFormatterExponent.test_basic.<locals>.<listcomp>  s'    OOOUEMM#'788OOOr5   )r+   LogFormatterExponentr  r  r  r	  )
r.   ri  ry   exponentlocs	positionsr1   valslabelsr  s
            @r3   r4   z#TestLogFormatterExponent.test_basic  s    
 0d?LN N N	##%%%((D(N;;;TzIIIICi4H4HIIIOOhOOO!!!!!!r5   c                     t          j        dd          }|                                 |j                            dd            |d          dk    sJ d S )Nr!   Trh  r   g&$?rR  )r+   rq  r  r  r  )r.   r  s     r3   
test_blankz#TestLogFormatterExponent.test_blank  sb    0bMMM	##%%%((B///y!!R''''''r5   N)rJ   rK   rL   rM   rO   rN   pir|  float
param_datae	base_datar@   rR   rS   r4   rx  r?   r5   r3   rZ  rZ    s9       	q)")B$$ibiC&8&8	/	/	/	1 
HBHc7BE3hGHH	qDDD	F	HBH^^^59995588				!	J c4-I[@*N N[VY//	" 	" 0/N N	"( ( ( ( (r5   rZ  c                   |    e Zd Z ej                    Zg dZej        	                    de          d             Z
dS )TestLogFormatterMathtext))r   r   $\mathdefault{10^{0}}$)r   r   z$\mathdefault{10^{-2}}$)r   r   z$\mathdefault{10^{2}}$)r[   r   z$\mathdefault{1}$)r[   r   z$\mathdefault{0.01}$)r[   r   z$\mathdefault{100}$)r[   r   z$\mathdefault{10^{-3}}$)r[   r  z$\mathdefault{10^{3}}$zmin_exponent, value, expectedc                     t          j        d|i          5  |                     |          |k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nzaxes.formatter.min_exponent)r   r   r3  )r.   min_exponentr/  r1   s       r3   test_min_exponentz*TestLogFormatterMathtext.test_min_exponent  s    ^:LIJJ 	/ 	/88E??h.....	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/s   AAAN)rJ   rK   rL   r+   LogFormatterMathtextr3  	test_datar@   rR   rS   r  r?   r5   r3   r  r    se        
&'
&
(
(C	 	 	I [<iHH/ / IH/ / /r5   r  c                       e Zd Zg dZej                            d          ej        	                    de          d                         Z
dS )TestLogFormatterSciNotation))r   g      ?z$\mathdefault{2^{-5}}$)r   r   z$\mathdefault{2^{0}}$)r       z$\mathdefault{2^{5}}$)r   g333333?z$\mathdefault{1.2\times2^{-5}}$)r   r   z$\mathdefault{1.2\times2^{0}}$)r   g333333C@z$\mathdefault{1.2\times2^{5}}$)r!   r   z$\mathdefault{-10^{0}}$)r!   r  z$\mathdefault{10^{-5}}$)r!   r   r  )r!   r  z$\mathdefault{10^{5}}$)r!   gh㈵>z$\mathdefault{2\times10^{-5}}$)r!   r   z$\mathdefault{2\times10^{0}}$)r!   i@ z$\mathdefault{2\times10^{5}}$)r!   rg  z$\mathdefault{5\times10^{-5}}$)r!   r    z$\mathdefault{5\times10^{0}}$)r!   i  z$\mathdefault{5\times10^{5}}$defaultzbase, value, expectedc                     t          j        |          }t          j        ddi          5   ||          |k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nrx   text.usetexF)r+   rJ  r   r   )r.   ry   r/  r1   r  s        r3   r4   z&TestLogFormatterSciNotation.test_basic
  s     3>>>	^]E233 	0 	09U##x/////	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0s   AAAN)rJ   rK   rL   r  r   styler   r@   rR   rS   r4   r?   r5   r3   r  r    sp          I& 	Yy!![4i@@0 0 A@ "!0 0 0r5   r  c                      e Zd Zg dZej                            de          d             Zej                            dg d          d             ZddZ	e
j                            d	          d
             Zej                            dg d          d             Zej                            dg d          d             ZdS )TestLogFormatter))}9x ?r   z3.142e-5)Gŷ4?r   z3.142e-4)ei?r   z3.142e-3)\, ?r   z3.142e-2)s7v/?r   z3.142e-1)PERT!	@r   3.142)f)zj?@r   z3.142e1)&FYs@r   z3.142e2)WXp/@r   z3.142e3)mnL@r   z3.142e4),Ar   z3.142e5)r  r   1e-5)r   r   1e-4)r   r   1e-3)r   r   1e-2)r   r   r  )r   r   r\  )r!   r   10)r
   r   100)r  r   1000)'  r   1e4)r  r   1e5)r  r   r[  )r  r   r[  )r  r   0.003)r  r   0.031)r  r   0.314)r  r   r  )r  r   31.416)r  r   314.159)r  r   3141.593)r  r   	31415.927)r  r   
314159.265)r  r   r[  )r   r   r[  )r   r   0.001)r   r   0.01)r   r   r_  )r   r   r\  )r!   r   r  )r
   r   r  )r  r   r  )r  r   10000)r  r   100000)r  r   r[  )r  r   r[  )r  r   r  )r  r   r  )r  r   r  )r  r   r  )r  r   r  )r  r   r  )r  r   r  )r  r   r  )r  r   r  )r  r   r[  )r   r   r[  )r   r   r  )r   r   r  )r   r   r_  )r   r   r\  )r!   r   r  )r
   r   r  )r  r   r  )r  r   r  )r  r   r  )r  r    r[  )r  r    r[  )r  r    r[  )r  r    z0.03)r  r    z0.31)r  r    r`  )r  r    z31.42)r  r    z314.16)r  r    z3141.59)r  r    z31415.93)r  r    z	314159.27)r  r    r[  )r   r    r[  )r   r    r[  )r   r    r  )r   r    r_  )r   r    r\  )r!   r    r  )r
   r    r  )r  r    r  )r  r    r  )r  r    r  )r  r
   r[  )r  r
   r[  )r  r
   r[  )r  r
   r[  )r  r
   z0.3)r  r
   3.1)r  r
   z31.4)r  r
   z314.2)r  r
   z3141.6)r  r
   z31415.9)r  r
   z314159.3)r  r
   r[  )r   r
   r[  )r   r
   r[  )r   r
   r[  )r   r
   r_  )r   r
   r\  )r!   r
   r  )r
   r
   r  )r  r
   r  )r  r
   r  )r  r
   r  )r  r4  z3.1e-5)r  r4  z3.1e-4)r  r4  z3.1e-3)r  r4  z3.1e-2)r  r4  z3.1e-1)r  r4  r  )r  r4  z3.1e1)r  r4  z3.1e2)r  r4  z3.1e3)r  r4  z3.1e4)r  r4  z3.1e5)r  r4  r  )r   r4  r  )r   r4  r  )r   r4  r  )r   r4  r  )r   r4  r\  )r!   r4  r  )r
   r4  r  )r  r4  r  )r  r4  r  )r  r4  r  zvalue, domain, expectedc                 h    t          j                    }|                    ||          }||k    sJ d S N)r+   LogFormatter_pprint_val)r.   r/  domainr1   r3  rp  s         r3   test_pprintzTestLogFormatter.test_pprint  s:    "$$v..      r5   zvalue, long, short))r   r[  r[  )r   r[  r[  )r   z-10^0r  )g|=z2x10^-10z2e-10)g    _Bz10^10z1e+10c                     t          j                    \  }}|                    d           |j                                        }|                    |          |k    sJ |                    |          |k    sJ d S )Nr  )r   r   
set_xscaler   r  r.  r  )r.   r/  longshortr   r   r3  s          r3   r1  z!TestLogFormatter.test_format_data  sz     ,..R
eh**,,u%%----$$U++u444444r5   r?   c                 $   |                                 |                                }                    |           |dt          j        t          j        |                    z  z  }fd|D             }fd|D             }||k    sJ dS )z.Test whether locator marks subs to be labeled.r!   c                 2    g | ]}t          |          v S r?   )round)r   cr"  s     r3   r   z0TestLogFormatter._sub_labels.<locals>.<listcomp>  s$    :::q%((d*:::r5   c                 .    g | ]} |          d k    S rR  r?   r   r   r3  s     r3   r   z0TestLogFormatter._sub_labels.<locals>.<listcomp>  s%    888qcc!ffl888r5   N)get_minor_formatterr   r  rM   rz  r{  )r.   r  r"  minor_tlocscoefslabel_expected
label_testr3  s     `    @r3   _sub_labelszTestLogFormatter._sub_labels  s    &&((,,..[!!!b28BH[,A,A#B#BCC::::E:::8888K888
^++++++r5   r  c           	         t          j                    \  }}|                    d           |j                            t          j        dg                      |j                            t          j        dt          j	        dd                               |j        
                    t          j        d                     |j                            t          j        d                     |                    dd	           |j                                                            |j                                                   fd
|j                                        D             }t          j        |          sJ |                     |j        g            |                    dd           |                     |j        g            |                    dd           |                     |j        g            |                    dd           |                     |j        g d           |                    dd           |                     |j        t          j	        ddt&                               d S )Nr  r!   )ry   r"  r   T)ri  Fr   r/  c                 .    g | ]} |          d k    S r  r?   r  s     r3   r   z2TestLogFormatter.test_sublabel.<locals>.<listcomp>  s;     D D D!" !SVVr\ D D Dr5   r!  i   P   rh   )r   r[   r   r   r   r   rb  )r   r   r  r   r  r+   r  r   rM   rO   r%  r  set_minor_formatterr   r  r  r&  rG   r  ry  )r.   r   r   show_major_labelsr3  s       @r3   test_sublabelzTestLogFormatter.test_sublabel  so    ,..R
e
""7#52B#G#G#GHHH
""7#52;=9Q;K;K$M $M $M 	N 	N 	N
$$W%9%M%M%MNNN
$$W%9%N%N%NOOO
Ash**,,RX//11222D D D D&(h&@&@&B&BD D Dv'(((((+++ 	As+++ 	Ar+++ 	Aq555 	C	!Rs(C(C(CDDDDDr5   val)r   r!   r
   r  c                     t          j                    }|                                 |j                            dd            ||          t          |          k    sJ d S Nr   r!   )r+   r  r  r  r  strr.   r  temp_lfs      r3   test_LogFormatter_callz'TestLogFormatter.test_LogFormatter_call  sa     &((!!###&&q"---ws||s3xx''''''r5   )g       g       g       g       c                     t          j                    }|                                 |j                            dd            ||           d S r  )r+   r  r  r  r  r  s      r3   test_LogFormatter_call_tinyz,TestLogFormatter.test_LogFormatter_call_tiny  sM     &((!!###&&q"---r5   N)r?   )rJ   rK   rL   pprint_datar@   rR   rS   r  r1  r  r   r  r   r  r  r  r?   r5   r3   r  r    sJ       E E EKN [6DD! ! ED!
 [1 4 4 4  5 5 5, , , , 	Yy!!#E #E "!#EJ [U$6$6$677( ( 87( [U$F$F$FGG  HG  r5   r  c                      e Zd Zed             Zej                            dg d          d             Z e	d  e
dd          D             d  e
dd          D             z   d	gz             Zej                            d
e          d             Zej                            d
d          d             Zej                            d
dd ej         ej        ddd                     z   z            d             Zg dZej                            de          d             Zd Zd Zd Zej                            dd          d             ZdS )TestLogitFormatterc                    t          j        d|           }|ri|d         du}|d         rt          |d                   nd}|d         t          |d                   nd}|d|z  z  }|d         s|d         	|rd|z
  S |S t          j        d	|           }|r/t          |d
                   t          |d                   }}||z  S t	          d          )z
        Parser to convert string as r'$\mathdefault{1.41\cdot10^{-4}}$' in
        float 1.41e-4, as '0.5' or as r'$\mathdefault{\frac{1}{2}}$' in float
        0.5,
        zT[^\d]*(?P<comp>1-)?(?P<mant>\d*\.?\d*)?(?:\\cdot)?(?:10\^\{(?P<expo>-?\d*)})?[^\d]*$compNmantr   expor   r!   z4[^\d]*\\frac\{(?P<num>\d+)\}\{(?P<deno>\d+)\}[^\d]*$numdenozNot formatted by LogitFormatter)rU   r>   rz  ry  rW   )stringr>   r  mantissar  r/  r  r  s           r3   logit_deformatterz$TestLogitFormatter.logit_deformatter  s	     
 
  	=,D/4V}CuU6]+++!H).v)B3uV}%%%DrTz)EV} f 9 %u9$CV
 
  	eEl++U5=-A-AC::;;;r5   zfx, x))zSTUFF0.41OTHERSTUFFg=
ףp=?)zSTUFF1.41\cdot10^{-2}OTHERSTUFFg!u?)zSTUFF1-0.41OTHERSTUFFgzG?)z!STUFF1-1.41\cdot10^{-2}OTHERSTUFFgx$(~?)STUFFN)zSTUFF12.4e-3OTHERSTUFFNc                    |Nt          j        t                    5  t                              |           d d d            d S # 1 swxY w Y   d S t                              |          }t
                              ||          sJ d S r  )r@   rA   rW   r  r  r[  r]  )r.   fxr   r   s       r3   test_logit_deformaterz(TestLogitFormatter.test_logit_deformater  s     9z** 9 9"44R8889 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 #44R88A''1-------s   AAAc                     g | ]}d | z  	S )r!   r?   r   is     r3   r   zTestLogitFormatter.<listcomp>%  s    ******r5   r   r!   c                      g | ]}d d| z  z
  S )r   r!   r?   r  s     r3   r   zTestLogitFormatter.<listcomp>&  s"    
0
0
0a1rqbz>
0
0
0r5   r   r   c                     t          j        d          }|                    | j                    ||          }t                              |          }t                              ||          sJ dS )zj
        Test the formatted value correspond to the value for ideal ticks in
        logit space.
        Fuse_overlineN)r+   LogitFormatterr  decade_testr  r  r[  r]  )r.   r   r  sx2s        r3   r4   zTestLogitFormatter.test_basic*  sp     *>>>	4+,,,IaLL11!44##Ar*******r5   )r   r   r   r   r   r   c                     t          j        d          }|                    | j                    ||          }|dk    sJ dS )zl
        Test that invalid value are formatted with empty string without
        raising exception.
        Fr  rR  N)r+   r  r  r  )r.   r   r  r  s       r3   test_invalidzTestLogitFormatter.test_invalid6  sL     *>>>	4+,,,IaLLBwwwwwwr5   r|   r%  c                 d   t          j        d          }dD ]}|d|z  z   dk     r|                    |d|z  z
  ||d|z  z   g            ||          } ||d|z  z             }t                              |          t                              |          z
  }d|cxk     r	d|z  k     sn J dS )zS
        The format length should change depending on the neighbor labels.
        Fr  )	r!   r	   r  r
      r  i  i  r  r   r   r   N)r+   r  r  r  r  )r.   r   r  Nsxsx1ds          r3   test_variablelengthz&TestLogitFormatter.test_variablelengthA  s    
 *>>>	@ 		% 		%A1q5y1}}""AAIq!a!e)#<===Yq\\iAE	**&88==(::2>>?  1}}}}q1u}}}}}}		% 		%r5   ))Trh  )r  F)K   F)Trf  )r  r  T)Tre  )r  Tr  )F)r   gRQ?gp=
ף?))r%  Tr  r  zmethod, lims, casesc                    |r t          j        d          } |j        | }nt          j        |          }t          j        d          }|D ]|\  }}|                    |           |                    |          }	d |	D             }
|r t          |
          dk    sJ ||f            ]t          |
          dk    sJ ||f            }dS )z,
        Test minor/major displays.
        Tr   c                 8    g | ]}t          |          d k    |S r   r   r   fs     r3   r   z:TestLogitFormatter.test_minor_vs_major.<locals>.<listcomp>h  #    ;;;aA




r5   r   N)	r+   rl  r-   rM   rN   r  set_minor_thresholdformat_ticksr   )r.   methodrm  casesmin_locru  min_form	threshold	has_minor	formattedlabelleds              r3   test_minor_vs_majorz&TestLogitFormatter.test_minor_vs_majorY  s     	#*666G'G'.EEHTNNE)555$) 	B 	B Iy((333 --e44I;;9;;;H B8}}q(((9i*@((((8}})))Iy+A))))	B 	Br5   c                 &   t          j        d          }t          j        d          }|                    dd          }dD ]M}|                    |           |                    |          }d |D             }t          |          |k    sJ NdS )z1
        Test the parameter minor_number
        Tr   r   r   )r   r   rh   rr  c                 8    g | ]}t          |          d k    |S r   r  r  s     r3   r   z8TestLogitFormatter.test_minor_number.<locals>.<listcomp>x  r  r5   N)r+   rl  r  r-   set_minor_numberr  r   )r.   r
  r  ru  minor_numberr  r  s          r3   test_minor_numberz$TestLogitFormatter.test_minor_numbern  s     &T222)555##D(33) 	1 	1L%%l333 --e44I;;9;;;Hx==L00000		1 	1r5   c                     d}d}d}t          j        d          } ||          |k    sJ |                    d            ||          |k    sJ |                    d            ||          |k    sJ dS )z1
        Test the parameter use_overline
        r  z$\mathdefault{1-10^{-2}}$z"$\mathdefault{\overline{10^{-2}}}$Fr  TN)r+   r  r  )r.   r   fx1fx2forms        r3   test_use_overlinez$TestLogitFormatter.test_use_overline{  s     *3%5999tAww#~~~~$tAww#~~~~%   tAww#~~~~~~r5   c                     t          j                    }d |d          v sJ |                    d           d |d          v sJ |                    d           d |d          v sJ dS )z-
        Test the parameter one_half
        z\frac{1}{2}r   z1/2zone halfN)r+   r  set_one_half)r.   r  s     r3   test_one_halfz TestLogitFormatter.test_one_half  s     %''c****%   S		!!!!*%%%TT#YY&&&&&&r5   r  )r
      i  c                 P   t          j        dd|          dd         }t          j                    }|D ]q}|                    |          }|                    d          rdt          |dd                    z
  }nt          |          }t          ||z
            d|z  k     sJ rd S )Nr   r   r   z1-r   )rM   rr   r+   r  r  
startswithrz  abs)r.   r  rs  r  r   r  r  s          r3   test_format_data_shortz)TestLogitFormatter.test_format_data_short  s    {1a##AbD)%'' 	' 	'A''**B}}T"" r!""v&2YYq2v;;Q&&&&&	' 	'r5   N)rJ   rK   rL   rb  r  r@   rR   rS   r  rk  r|  r  r4   r  rM   exprr   r  lims_minor_majorr  r  r  r  r"  r?   r5   r3   r  r    s       < < \<@ [	
 	
 	

 
. .
 
. &**UU1b\\***
0
055B<<
0
0
0	1'	 K [S+..	+ 	+ /.	+ [S"?@@  A@ [S!q626;2;r1b3I3I2I+J+J'J"KLL% % ML%    [24DEEB B FEB(1 1 1  	' 	' 	' [S/22	' 	' 32	' 	' 	'r5   r  c                       e Zd Zd ZdS )TestFormatStrFormatterc                 P    t          j        d          }d |d          k    sJ d S )Nz%05d00002r   )r+   FormatStrFormatterr  s     r3   r4   z!TestFormatStrFormatter.test_basic  s1    -f55((1++%%%%%%r5   N)rJ   rK   rL   r4   r?   r5   r3   r&  r&    s#        & & & & &r5   r&  c                   ^    e Zd Zg dZej                            de          d             ZdS )TestStrMethodFormatter)){x:05d}r   Fr(  )r,  r-  Tr(  )r,  r  Fz-0002)r,  r.  Tu   −0002){x:03d}-{pos:02d}r   r   F002-01)r/  r0  Tr1  )r/  r  r   Fz-02-01)r/  r2  Tu   −02-01z&format, input, unicode_minus, expectedc                     t          j        d|i          5  t          j        |          } || |k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nr  )r   r   r+   StrMethodFormatter)r.   formatinputr  r1   r3  s         r3   r4   z!TestStrMethodFormatter.test_basic  s    ^1=ABB 	+ 	+,V44C3;(*****	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s    AA	A	N)rJ   rK   rL   r  r@   rR   rS   r4   r?   r5   r3   r+  r+    sU        	 	 	I [EyQQ+ + RQ+ + +r5   r+  c                   ^    e Zd Zg dZej                            de          d             ZdS )TestEngFormatter))FEJ)z
-1.23457 k-1 kz-1.23 k)Tr9  )u   −1.23457 k   −1 ku	   −1.23 k)FރB)z-1.23457r  z-1.23)Tr<  )u
   −1.23457r  u   −1.23)F_c97ݚ)z
-123.457 mz-123 mz	-123.46 m)Tr=  )u   −123.457 mu   −123 mu   −123.46 m)FQ^-':T)z
-1.23457 mz-1 mz-1.23 m)Tr>  )u   −1.23457 mu   −1 mu	   −1.23 m)Tg       r[  r[  z0.00Tr   r?  r@  )Tgm>)u
   1.23457 µu   1 µu   1.23 µ)Tg_c97ݚ?)z	123.457 mz123 mz123.46 m)Tr   )100 mrA  z100.00 m)Tr   )r\  r\  z1.00)TgރB?)z1.23457r\  z1.23)Tg33333?@)z999.91 kz999.90)Tg*:?@rB  rB  1.00 k)F*:?)r:  r:  z-1.00 k)TrE  )r;  r;  u	   −1.00 k)Tr  rC  )Ti  )z1.001 krB  rD  )Ti )z	100.001 kz100 kz100.00 k)TgZ$.A)z	987.654 kz988 kz987.65 k)TgCY,dRF)1230 QrF  z	1230.00 Qzunicode_minus, input, expectedc                   	
 |t           j        d<   d	d|}t          j                    t          j        d          t          j        d          f}t	          ||          D ]\  }} ||          |k    sJ 	fd|D             }t          j        	          t          j        	d	          t          j        	d	          f}t	          ||          D ]\  }} ||          |k    sJ d
D ]
	
fd|D             }t          j        	
          t          j        	d
          t          j        	d
          f}t	          ||          D ]\  }} ||          |k    sJ 
fd|D             }t          j        
          t          j        d
          t          j        d
          f}t	          ||          D ]\  }} ||          |k    sJ dS )a  
        Test the formatting of EngFormatter for various values of the 'places'
        argument, in several cases:

        0. without a unit symbol but with a (default) space separator;
        1. with both a unit symbol and a (default) space separator;
        2. with both a unit symbol and some non default separators;
        3. without a unit symbol but with some non default separators.

        Note that cases 2. and 3. are looped over several separator strings.
        r  r  
0123456789r   )placesr   c              3   F   K   | ]}|d          v r|dz   z   n|z   V  dS r    Nr?   )r   _sDIGITSUNITs     r3   	<genexpr>z/TestEngFormatter.test_params.<locals>.<genexpr>  sV       : :*, +-R&F*:*:rCx$I: : : : : :r5   )unit)rQ  rI  )rR  u    z@_@c              3   n   K   | ]/}|d          v r|z   z   n|                     d          z   V  0dS rK  rn  )r   rM  rN  rO  _seps     r3   rP  z/TestEngFormatter.test_params.<locals>.<genexpr>  sg       / /! 02"v/?/?29t++ "

3 5 5 </ / / / / /r5   )rQ  r   )rQ  rI  r   c              3   D   K   | ]}|                     d           V  dS )rL  Nrn  )r   rM  rS  s     r3   rP  z/TestEngFormatter.test_params.<locals>.<genexpr>"  s1      DDR2::c400DDDDDDr5   )r   )rI  r   N)r   r@  r+   EngFormatterr	  )r.   r  r6  r1   exp_outputs
formatters
_formatter_exp_outputrN  rO  rS  s           @@@r3   test_paramszTestEngFormatter.test_params  s    .;)*  "" *** ***


 (+:{'C'C 	4 	4#J:e$$33333
: : : : :08: : :  d+++ d1555 d1555


 (+:{'C'C 	4 	4#J:e$$33333 = 	8 	8D/ / / / / /%-/ / /K $$D999$$qdCCC$$qdCCCJ
 ,/z;+G+G 8 8'
K!z%((K77777
 EDDD8DDDK$...$A4888$A4888J
 ,/z;+G+G 8 8'
K!z%((K7777781	8 	8r5   N)rJ   rK   rL   raw_format_datar@   rR   rS   rZ  r?   r5   r3   r8  r8    s[        # # #OJ [=OOD8 D8 POD8 D8 D8r5   r8  c                     t          j                    \  } }|                    g dg d           |                    g d           t	          j        d          t	          j        d          fD ]]}|j                            |           | j        	                                 d |
                                D             }|g dk    sJ ^d S )N)r   r  r  T)usetex)useMathTextc                 6    g | ]}|                                 S r?   get_textr   labls     r3   r   z8test_engformatter_usetex_useMathText.<locals>.<listcomp>4  s     NNNT]]__NNNr5   )z$0$z$500$z$1$ k)r   r   rI  r   r+   rU  r   r%  r@  rA  get_xticklabels)r   r   r  x_tick_label_texts       r3   $test_engformatter_usetex_useMathTextrf  ,  s    lnnGCGGNNNNNN+++MM...!!!*$777*t<<<> > >	
$$Y///
NN9K9K9M9MNNN !$=$=$======> >r5   z9data_offset, noise, oom_center_desired, oom_noise_desired))g  @ROBr!   ri  r   )g  BBi r  r   )/$&;@r   r   r  )g5@r   r[   r  )g    Ar   r[   r  )p=
p@r   r   r  )g   uHBr
   ri  r[   )rg  gHz>r   i)rh  r   r   r  )rg  r   r   r  )g    @@r  r   r[   )rg  r  r   r[   )rg  r  r   r[   )rg  r
   r   r   )rg  r!   r   r   c                    d}t          j                    \  }}| t          j        ddt                    |z  z   }|                    |           t          j        d|          }d|j        d<   |j	        
                    |           |j                                         |                                }	d	 |                                D             }
|j        rW|	d
         }|j        |         }|	dt!          |          z
           }|j        |         }||k    sJ ||k    sJ |
D ]}||vsJ 	d S |dk    sJ |	dk    sJ |
D ]7}|d         dk    rdn|}|                    |j        |         |z             sJ 8d S )NeVr   r%  rb  T)	useOffsetrQ  _r   c                 6    g | ]}|                                 S r?   r`  rb  s     r3   r   z0test_engformatter_offset_oom.<locals>.<listcomp>b  s     BBBTBBBr5   r   r   rR  r[  )r   r   rM   rO   rz  rI  r+   rU  ENG_PREFIXESr   r%  r@  rA  
get_offsetget_yticklabelsr   r   endswith)data_offsetnoiseoom_center_desiredoom_noise_desiredrO  r   r   ydatar  
offset_got	ticks_gotprefix_noise_gotprefix_noise_desiredprefix_center_gotprefix_center_desiredtick
prefix_idxs                    r3   test_engformatter_offset_oomr  :  s   < DlnnGC")B777==EGGENNN$t$???I #I1H  +++JOO%%''JBBR-?-?-A-ABBBI  L%a=(56GH&r#d))|4 ) 67I J#'77777$(99999 	$ 	$Dt#####	$ 	$ "Q&&&&R 	L 	LD #1gnn2CJ==!7
!Cd!JKKKKKK		L 	Lr5   c                       e Zd Zg dZg dZg dZej                            dee          d             Z	ej                            de          d             Z
d	S )
TestPercentFormatter))r
   r   %r  r
   z120%)r
   r   r  r
   Z   z100%)r
   r   r  r  r  z90%)r
   r   r  r   r  z-2%)r
   r   r  g     V@r
   z90.0%)r
   r   r  gfffffT@r  z80.1%)r
   r   r  gQQ@r  z70.2%)r
   r   r  gxFNr  z-60.6%)r
   Nr  _   r   z95.00%)r   Nr  r[   r   z300%)      1@Nr  r   g      !@z6%)r  Nr  r   g @z5.9%)r    Nr  r  gư>z-2000.00000%)r   r   Nr   r
   z120.00)r  r[   rR  r  r
   z66.667)ra  Nz
^^Foobar$$   r  z50.0^^Foobar$$)zdecimals=0, x>100%zdecimals=0, x=100%zdecimals=0, x<100%zdecimals=0, x<0%zdecimals=1, x>100%zdecimals=1, x=100%zdecimals=1, x<100%zdecimals=1, x<0%z$autodecimal, x<100%, display_range=1z7autodecimal, x>100%, display_range=6 (custom xmax test)z;autodecimal, x<100%, display_range=8.5 (autodecimal test 1)z;autodecimal, x<100%, display_range=8.4 (autodecimal test 2)z=autodecimal, x<-100%, display_range=1e-6 (tiny display range)zNone as percent symbolzEmpty percent symbolzCustom percent symbol))FF50\{t}%)FTz50\\\{t\}\%)TFr  )TTr  z2xmax, decimals, symbol, x, display_range, expected)idsc                     t          j        |||          }t          j        ddi          5  |                    ||          |k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nr  Frcr+   PercentFormatterr   r   
format_pct)r.   xmaxdecimalssymbolr   display_ranger1   r  s           r3   r4   zTestPercentFormatter.test_basic  s    
 ,T8VDD	^u5666 	F 	F''=99XEEEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F   AA Azis_latex, usetex, expectedc                     t          j        d|          }t          j        d|i          5  |                    dd          |k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nz\{t}%)r  is_latexr  r  r  r
   r  )r.   r  r]  r1   r3  s        r3   
test_latexzTestPercentFormatter.test_latex  s    &hJJJ^v6777 	7 	7>>"c**h66666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7r  N)rJ   rK   rL   percent_datapercent_ids
latex_datar@   rR   rS   r4   r  r?   r5   r3   r  r  }  s          L.  K,  J [@k  + +F F+ +F [9:FF7 7 GF7 7 7r5   r  c                     	 t          j        t           j        d           n%# t           j        $ r t	          d           Y d S w xY wt          j        dd          } d}|                     |d          }|dk    sJ d}|                     |d          }|d	k    sJ t          j        d
d          } d}|                     |d          }|dk    sJ d S )Nzde_DE.UTF-8z9SKIP: Locale de_DE.UTF-8 is not supported on this machineT)r^  	useLocalez$\mathdefault{%1.1f}$r   z$\mathdefault{0{,}5}$z,$\mathdefault{,%1.1f},$z,$\mathdefault{,0{,}5},$Fz%1.1fz0,5)r  	setlocaleLC_ALLErrorprintr+   r  _format_maybe_minus_and_locale)ru  r3  r   s      r3   _impl_locale_commar    s   6666<   IJJJ #EEEE
"C,,S#66A(((((
%C,,S#66A+++++#FFFE
C,,S#66A::::::s   " AAc                      t           j                            t          dddi          } t	          d | j                                        D             d          }|rt          j        |           d S d S )Nr%   
MPLBACKENDAgg)timeout	extra_envc              3      K   | ]B}|                     d           |t          d           d                                         V  CdS )zSKIP:N)r   r   r  )r   lines     r3   rP  z$test_locale_comma.<locals>.<genexpr>  sb       2 2002T#g,,--(..00 2 2 2 2 2 2r5   rR  )	r   r   subprocess_run_helperr  nextstdout
splitlinesr@   r  )procskip_msgs     r3   test_locale_commar    s     ;,,-?8De7L - N ND 2 2!%!7!7!9!92 2 2  H  H r5   c                      t          j                    \  } }t          j        t                    5  |j                            t          j                               d d d            d S # 1 swxY w Y   d S r  )	r   r   r@   rA   rT   r   r%  r+   r  r   r   s     r3   test_majformatter_typer        lnnGC	y	!	! ; ;
$$W%7%9%9:::; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;   ,A))A-0A-c                      t          j                    \  } }t          j        t                    5  |j                            t          j                               d d d            d S # 1 swxY w Y   d S r  )	r   r   r@   rA   rT   r   r  r+   r  r  s     r3   test_minformatter_typer    r  r  c                      t          j                    \  } }t          j        t                    5  |j                            t          j                               d d d            d S # 1 swxY w Y   d S r  )	r   r   r@   rA   rT   r   r  r+   r  r  s     r3   test_majlocator_typer        lnnGC	y	!	! ; ;
""7#7#9#9:::; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;r  c                      t          j                    \  } }t          j        t                    5  |j                            t          j                               d d d            d S # 1 swxY w Y   d S r  )	r   r   r@   rA   rT   r   r   r+   r  r  s     r3   test_minlocator_typer    r  r  c                      t          j                    fd}  | ddd            | ddd            | ddd            | ddd           d S )Nc                 Z   | |d}t          j        |          5                      dd|          }d d d            n# 1 swxY w Y   t          |j                                                  dk    | k    sJ t          |j                                                  dk    |k    sJ d S )N)zxtick.minor.visiblezytick.minor.visibler  r   r   )r   r   add_subplotr   r   get_minor_ticksr   )xminoryminorr  r  r   r   s        r3   minorticksubplotz,test_minorticks_rc.<locals>.minorticksubplot  s    %+%+- -^r""" 	* 	*Aq))B	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* BH,,..//!3>>>>BH,,..//!3>>>>>>s   A  AAFr   Tr   r[   r   )r   figure)r  r   s    @r3   test_minorticks_rcr    s    
*,,C? ? ? ? ? UE1%%%T5!$$$UD!$$$T4#####r5   c                  
   t          j                    fd} g d}|D ]N} | dd|d            | dd|d            | dd|d            | dd|d                                            Ot          j                   d	S )
ax  
    Test toggling minor ticks

    Test `.Axis.minorticks_on()` and `.Axis.minorticks_off()`. Testing is
    limited to a subset of built-in scales - `'linear'`, `'log'`, `'asinh'`
    and `'logit'`. `symlog` scale does not seem to have a working minor
    locator and is omitted. In future, this test should cover all scales in
    `matplotlib.scale.get_scale_names()`.
    c                                         dd|          }|                    |           |                    |           | s|s|                                 | r4|s2|j                                         |j                                         | s4|r2|j                                         |j                                         | r|r|                                 t          |j                                                  dk    | k    sJ t          |j                                                  dk    |k    sJ d S )Nr   r   )	r  r  r  minorticks_offr   r   r   r   r  )r  r  scaler  r   r   s        r3   minortickstogglez0test_minorticks_toggle.<locals>.minortickstoggle  sJ   __Q1%%
e
e 	 f 	  	&& 	&H""$$$H##%%% 	%& 	%H##%%%H""$$$ 	f 	BH,,..//!3>>>>BH,,..//!3>>>>>>r5   )linearr  asinhlogitFr   Tr   r[   r   N)r   r  clearclose)r  scalesr  r   s      @r3   test_minorticks_toggler    s     *,,C? ? ? ? ?$ 100F  ua000ueQ///eQ///tUA...		IcNNNNNr5   z%remove_overlapping_locs, expected_num))Tr   )Nr   )Fri  c                    t          j        ddd          }t          j        t          |                    }t	          j                    \  }}|                    ||           |j                            t          j
                                                   |j                            t          j
                            d                     |j                            t          j
                            d                     |j                            t          j
                            d                     |j                            d           | | |j        _        |j        j        }||j                                        k    sJ t	          j        |j        |	           |j        j        }||j        j        k    sJ t          |j                                                  |k    sJ t          |j                                                  |k    sJ t          |j                                                  |k    sJ t          |j                                                  |d
z  k    sJ d S )Nz
2018-11-03z
2018-11-06
datetime64rb  z
%a)r   r   r     z%H:%Mr"   )remove_overlapping_locsr   )rM   rO   onesr   r   r   rI  r   r  r   dates
DayLocatorr%  DateFormatterr   HourLocatorr  r  r  get_remove_overlapping_locssetpr   get_minorticklabelsget_minorticklines)r  expected_numtr   r   r   currentnews           r3   test_remove_overlapr  9  s   
 		,LAAAA
AAlnnGCGGAqMMMHsy3355666H  !8!8!@!@AAAHsy44^DDEEEH  !8!8!A!ABBBHR   *+B( h.Grx;;======HRXw7777
(
*C2833333 rx))++,,<<<<rx''))**l::::rx++--..,>>>>rx**,,--a??????r5   subhiaardvark)r   r   c                     t          j                    }t          j        t                    5  |                    |            d d d            d S # 1 swxY w Y   d S )Nr!  )r+   r  r@   rA   rW   rk   )r  r=  s     r3   test_bad_locator_subsr  ^  s     
			B	z	"	"    
3                                   s   AAAr]   )r   r   r[   ri  r  c           	      2   t          j                    }|                    |            dD ]j}|                    d|          }t	          j        t	          j        |                    dd                              dk                                    sJ kd S )Nr\   )r    r%  ri  r;   r"   r  r
   r  r   r      r   )r+   r  rk   r-   rM   diffr{  rG   )r]   r=  topru  s       r3   test_small_range_loglocatorr  g  s     
			BMM8M$$$/ F Fr3''3!7!78899Q>CCEEEEEEF Fr5   c                      t          j                    }  | d          dk    sJ |                     d          dk    sJ |                     d          dk    sJ d S )Nr   rR  )r+   NullFormatterr.  r  r  s    r3   test_NullFormatterr  q  sm    %''I9S>>R  %%++++&&s++r111111r5   r  c                     d|  S )Nzval: r?   )r  s    r3   <lambda>r  y  s    KAKK r5   )r:   barc                     |                                  dk    sJ |                     d           |                                  dk    sJ d S )NrR  r   )ro  set_offset_stringr  s    r3   test_set_offset_stringr  x  sX     !!R''''&&&!!U******r5   c                  r   t          j                    \  } }|                    t          j        d          dg           |                    t          j        d          dg           |                    t          j        d          dg           |                    d           |                    d           |                                 |                                  |                                sJ t          |j
                                        t          j        j                  sJ dS )	z
    Turning on minor gridlines in a multi-Axes Figure
    that contains more than one boxplot and shares the x-axis
    should not raise an exception.
    r!   r   )rt  r   r   )whichr   N)r   r   boxplotrM   rO   r   r   draw_without_renderingget_xgridlines
isinstancer   get_minor_locatorr   tickerr   r  s     r3   test_minorticks_on_multi_figr    s    lnnGCJJry}}J,,,JJry}}J,,,JJry}}J,,,GG'GGG'G   bh0022CJ4OPPPPPPPr5   )D
contextlibr   r  r  rG  rU   packaging.versionr   r>  numpyrM   numpy.testingr   r   r@   
matplotlibr   matplotlib.pyplotpyplotr   matplotlib.tickerr  r+   r   rY   ru   r   r  rT  r[  rd  r  r  r  r  r  rZ  r  r  r  r  r&  r+  r8  rf  rR   rS   r  r  r  r  r  r  r  r  r  r  r  zerosr  r  r   r  r  FuncFormatterFixedFormatterr  r  r?   r5   r3   <module>r     s   " " " " " "       				 4 4 4 4 4 4     A A A A A A A A            # # # # # #,, ,, ,, ,, ,, ,, ,, ,,^F F F F F F F F<8! 8! 8! 8! 8! 8! 8! 8!vmH mH mH mH mH mH mH mH`L7 L7 L7 L7 L7 L7 L7 L7^       $ $ $ $ $ $ $ $"O! O! O! O! O! O! O! O!d	  	  	  	  	  	  	  	 
! 
! 
! 
! 
! 
! 
! 
!)8 )8 )8 )8 )8 )8 )8 )8Xb7 b7 b7 b7 b7 b7 b7 b7JL L L L L L L L^!( !( !( !( !( !( !( !(H/ / / / / / / /&0 0 0 0 0 0 0 08Z Z Z Z Z Z Z Zzo' o' o' o' o' o' o' o'd& & & & & & & &+ + + + + + + +&n8 n8 n8 n8 n8 n8 n8 n8b> > > ? B B B 0(L (L1 0(LVB7 B7 B7 B7 B7 B7 B7 B7J  *   ; ; ;; ; ;; ; ;; ; ;$ $ $$% % %P @&' '@ @	' '@B 	:BHV!        \\\229F F  32F2 2 2 G//00G>**', - -+ +- -+Q Q Q Q Qr5   