
    P/PhH                        d dl Z d dlmZ d dlZd dlZd dlmZ d dl	m
Z d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ  d dl!Z"d dl#m$Z$m%Z% d Z&d Z' e%dgd          d	             Z( e$d
g          d             Z)d Z* e%dgdd          d             Z+d Z, e%dgdd          d             Z-d Z.d Z/d Z0ej1        2                    dg d          d             Z3d Z4d Z5d Z6d Z7d Z8d  Z9d! Z:d" Z;d# Z<d$ Z=dS )%    N)chain)check_figures_equalimage_comparisonc                     t          j                    } |                     dd           |                     dd           d}| j                            |          }t          j        |dddd          }|                     |           |j	        | j        k    sJ t          j        |dddd d	          }|
                                sJ |                     |           t          |j	        t          j                  sJ t          j        |d
d
t          j                    d          }|                     |           t          |j	        t          j                  sJ t          j        |dddd          }|                                }|
                                rJ |                     |           |                                |k    sJ |
                                sJ |j	        | j        k    sJ d S )N         r
   yellow      ?)widthheightfcalphax   coral)r   r   r   	transformr   d   )r   r   r   r   )pltaxesset_xlimset_ylim	transDatar   mpatchesEllipse	add_patch
_transformis_transform_set
isinstancemtransformsIdentityTransformget_transform)axxy_dataxy_pixeintermediate_transforms        \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/matplotlib/tests/test_artist.pytest_patch_transform_of_noner)      s     
BKK1KK1 G\##G,,F 	!LLLALLOOO<2<'''' 	s37#'s	4 	4 	4ALLOOOalK$ABBBBB 	s3#.#@#B#B#	O 	O 	OALLOOOalK$ABBBBB 	s37"	$ 	$ 	$A__..!!#####LLOOO?? 66666<2<''''''    c                     t          j                    } |                     dd           |                     dd           d}| j                            |          }t          j        |dd          }t          j	        |gdd          }| 
                    |           |                                |                                z   | j        k    sJ t          j        |dd          }t          j	        |gd	d          }|                    d            | 
                    |           t          |                                t          j                  sJ t          j        |d
d
          }t          j	        |gt          j                    d          }| 
                    |           t          |                                t          j                  sJ d S )Nr   r   r	   )r   r   r   r   )	facecolorr   r   r   r   )r   r   )r   r   r   r   r   r   r   r   mcollectionsPatchCollectionadd_collectionget_offset_transformr"   set_transformr   r    r!   )r#   r$   r%   r&   cs        r(   !test_collection_transform_of_noner3   ?   s    
BKK1KK1 G\##G,,F 	!444A$aSHCHHHAa!!##aoo&7&772<GGGG 	s3777A$aSG+.	0 	0 	0AOODaaoo'')FGGGGG 	s3777A$aS/:/L/N/N+.	0 	0 	0A aa,,..0MNNNNNNNr*   clip_path_clippingT)remove_textc                     t           j                                                                        } | xj        dz  c_        | xj        dz  c_        t           j                                                                        }|j        d d d         |_        t           j                            | |          }t           j                            d                                          }|xj        dz  c_        t          j	        dddd          \  }\  }}t          j        |gd	d
ddd          }|                    ||j                   |                    |           t          j        |d	d
ddd          }|                    ||j                   |                    |           |                    ddg           |                    ddg           d S )N   r
      g@r   T)sharexsharey   blueredgffffff?*)lw	edgecolorr,   r   hatchr   )mpathPathunit_rectangledeepcopyverticesunit_circlemake_compound_pathunit_regular_starr   subplotsr-   PathCollectionset_clip_pathr   r/   r   	PathPatchr   r   r   )	exteriorinterior	clip_pathstarfigax1ax2colpatchs	            r(   test_clippingrY   c   s   z((**3355Hz%%''0022H )$$B$/H
--hAAI:''**3355DMMSMMl1aTBBBOC#s

%tff05SM M MCi///stVu%(5 5 5E		3=111MM%LL"aLL"ar*   png)
extensionsc                    |                      g d          }|                    ddgddg          \  }t          j        ddgddgddgddgddgg          }t	          j        ||j                  }|                    |           |                     g d          }|                    ddgddg           |                    dd           |                    dd           d S )	N)r   r   r   r   rC   r   r   r   )r   )r   g      ?)xlimylim)	add_axesplotrD   rE   r   rO   r   rN   set)fig_testfig_refax_testlpax_refs         r(   test_clipping_zoomrh      s     --G	r1gAw	'	'BA 	
QFQFQFQFQF;<<A1(9:::AOOAlll++F
KKQ"a!!!
JJKkJ222KK[{K33333r*   c                  L   t           j                            d          } t           j                            d          }t          j                    \  }}|                    | |d           |                    dd           t          j                    }|                    |d           t          |
                                          dk     sJ t          j                    }|                    |d           t          |
                                          dk     sJ d S )	Ni N  zk.r
   r   pdf)formati@  svg)nprandomr   rL   r`   r   ioBytesIOsavefiglengetvalue)xyrT   r#   rj   rl   s         r(   test_cull_markersrv      s    
	A
	AlnnGCGGAq$KK1
*,,CKKEK"""s||~~%%%%
*,,CKKEK"""s||~~&&&&&&r*   hatchingdefault)r5   stylec                     t          j        dd          \  } }t          j        dddd          }|                    |           t          j        ddgdg|j        d	          }|                    |           t          j        d
dddd          }|                    |           t          j        ddgdg|j        dd          }|                    |           |	                    dd           |
                    dd           d S )Nr   r   r   r   r7   /)rB   i>  )g      ?      @)sizesoffsetsoffset_transformrB   )r7   r   C1)rB   rA   )g      @r}   )r~   r   r   rB   rA   r      	   )r   rL   r   	Rectangler   r-   RegularPolyCollectionr   r/   r   r   )rT   r#   rect1rect2rect3rect4s         r(   test_hatchingr      s!   l1a  GC vq!3777ELL.	%:,  E e vq!3$GGGELL.	%:,T# # #E eKK1KK1r*   c                     t          j                    \  } }|                    t          j        d                              dd                    }|                    t          d                    \  }| j        sJ |j        sJ | j	        
                                 | j        rJ |j        rJ |j        rJ ||j        v sJ ||j        vsJ |j        |u sJ |                                 |                                 ||fD ]!}|j        J |                                J "||j        vsJ | j        sJ |j        sJ d S )N$   r9   r<   )r   rL   imshowrm   arangereshaper`   rangestalecanvasdraw_mouseover_setr   remove
get_figure)rT   r#   imlnarts        r(   test_remover      sd   lnnGC	29R==((A..	/	/B
''%((

CB98OOOJOOyxx"""""R&&&&&7b====IIKKKIIKKKBx ( (x~~''''R&&&&&98OOOOOr*   zdefault_edges.pngc            	      X   dt           j        d<   t          j        dd          \  } \  \  }}\  }}|                    t	          j        d          t	          j        d          dt	          j        d          dz   t	          j        d          d           |                    t	          j        d          t	          j        d          d	           |                    d
d
ddt          d                     |	                    d           |
                    d           t          j        t          j        g dt          j        j        t          j        j        t          j        j        t          j        j        g          d|j                  }|                    |           d S )Nr9   ztext.kerning_factorr
   
   rt   r   oedge)alignr   BOX   sawtooth)boxstyle)sizebbox)r8   r   )r{   r   r   r   r   r{   none)r   r   )r   rcParamsrL   r`   rm   r   bartextdictr   r   r   rO   rD   rE   MOVETOCURVE3	CLOSEPOLYr   r   )rT   rU   rV   ax3ax4pp1s         r(   test_default_edgesr      sd    +,CL&'$'LA$6$6!C	!*3jsCHHRYr]]BIbMM3Yr]]Q	"s4 4 4GGBIbMM29R==G777HHQ5rj(A(A(AHBBBLLLL


333J%uz'8J%uz';=	> 	> S]	, , ,C
 MM#r*   c                  X    t          j        g g           } |                                  d S N)mlinesLine2D
properties)r   s    r(   test_propertiesr      s$    	r2		BMMOOOOOr*   c                  6   t          j        g            t          j        g g           t          j                    \  } }|                    t	          d                    }|                    t	          d                    }t          j        t          ||          dd           t          j        |j                                        d           t          j
                    }t          j        |d|           |                                dk    sJ d S )	Nr   r@   r<   green)colorzorder)filez  zorder: float
)r   setprL   r`   r   martistr   spinesvaluesro   StringIOrs   )rT   r#   lines1lines2sios        r(   	test_setpr      s    HRLLLHbTNNN lnnGCWWU1XXFWWU1XXFLvv&&a000HRYw//// +--CHVXC((((<<>>0000000r*   c                     t          j                    \  } }|                    t          d          d           \  }|                                t
          j        j        k    sJ |                    d           |                                dk    sJ |                    d            |                                t
          j        j        k    sJ d S )Nr<   )r   i@ )	r   rL   r`   r   
get_zorderr   r   r   
set_zorder)rT   r#   r   s      r(   test_None_zorderr     s    lnnGC
''%((4'
(
(CB==??fm22222MM&==??f$$$$MM$==??fm2222222r*   zaccept_clause, expected)) unknown)zACCEPTS: [ '-' | '--' | '-.' ]z[ '-' | '--' | '-.' ])zACCEPTS: Some description.Some description.)z.. ACCEPTS: Some description.r   )z	arg : intint)z
*arg : intr   )z"arg : int
ACCEPTS: Something else.zSomething else. c                      G d dt           j                  }d| z  |j        _        t          j        |                              d          }||k    sJ d S )Nc                       e Zd Zd ZdS ):test_artist_inspector_get_valid_values.<locals>.TestArtistc                     d S r    )selfargs     r(   set_fz@test_artist_inspector_get_valid_values.<locals>.TestArtist.set_f      Dr*   N)__name__
__module____qualname__r   r   r*   r(   
TestArtistr     #        	 	 	 	 	r*   r   z
    Some text.

    %s
    f)r   Artistr   __doc__ArtistInspectorget_valid_values)accept_clauseexpectedr   valid_valuess       r(   &test_artist_inspector_get_valid_valuesr     s|        W^     	 J
 *:66GGLLL8######r*   c                      t          j        t          j                  } |                                 }|d         dhk    sJ d S )N	linewidthr@   )r   r   r   r   get_aliases)aialiasess     r(   !test_artist_inspector_get_aliasesr   '  sA    		 	/	/BnnG;D6))))))r*   c                     t          j                    } t          j        t          d          5  |                     d           d d d            n# 1 swxY w Y   t          j        t          d          5  |                     g d           d d d            n# 1 swxY w Y   t          j        t          d          5  |                     d           d d d            n# 1 swxY w Y   t          j        t          d          5  |                     t          j                   d d d            d S # 1 swxY w Y   d S )N^alpha must be numeric or Nonematchstring)r   r
   r   outside 0-1 range皙?)	r   r   pytestraises	TypeError	set_alpha
ValueErrorrm   nanr   s    r(   test_set_alphar   .  s   
.

C	y(H	I	I	I    h                             	y(H	I	I	I ! !iii   ! ! ! ! ! ! ! ! ! ! ! ! ! ! !	z)<	=	=	=  c              	z)<	=	=	=  bf                 sG   AAA7BB"BC##C'*C'	 D66D:=D:c                  .   t          j                    } t          j        t          d          5  |                     d           d d d            n# 1 swxY w Y   t          j        t          d          5  |                     d           d d d            n# 1 swxY w Y   t          j        t          d          5  |                     t          j                   d d d            n# 1 swxY w Y   t          j        t          d          5  |                     ddg           d d d            n# 1 swxY w Y   t          j        t          d          5  |                     dt          j        g           d d d            d S # 1 swxY w Y   d S )Nr   r   r   r   r   zalpha must be between 0 and 1r   )	r   r   r   r   r   _set_alpha_for_arrayr   rm   r   r   s    r(   test_set_alpha_for_arrayr   :  s   
.

C	y(H	I	I	I + +  ***+ + + + + + + + + + + + + + +	z)<	=	=	= & &  %%%& & & & & & & & & & & & & & &	z)<	=	=	= ) )  ((() ) ) ) ) ) ) ) ) ) ) ) ) ) )	z)H	I	I	I - -  #s,,,- - - - - - - - - - - - - - -	z)H	I	I	I 0 0  #rv///0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0sY   AAA7BB B? C++C/2C/D55D9<D9"F

FFc                  |   fdd_         t          j                    } |                               }j         dk    sJ |                                  j         dk    sJ |                     d           j         dk    sJ |                     |           |                                  j         dk    sJ d S )Nc                 (    xj         dz  c_         d S )Nr   )counter)artistfuncs    r(   r  ztest_callbacks.<locals>.funcI  s    r*   r   r   r   r
   )r  r   r   add_callbackpchangedr   remove_callback)r   oidr  s     @r(   test_callbacksr  H  s         DL
.

C


4
 
 C<1LLNNN<1NN2<1LLNNN<1r*   c                      G d dt           j                  } t          | j        d          sJ d| j        j        v sJ  G d d|           }t          |j        d          sJ d|j        j        v sJ d|j        j        v sJ dS )	z3Test autogenerated ``set()`` for Artist subclasses.c                       e Zd Zd ZdS )%test_set_signature.<locals>.MyArtist1c                     d S r   r   r   vals     r(   set_myparam1z2test_set_signature.<locals>.MyArtist1.set_myparam1]  r   r*   N)r   r   r   r  r   r*   r(   	MyArtist1r  \  r   r*   r  _autogenerated_signaturemyparam1c                       e Zd Zd ZdS )%test_set_signature.<locals>.MyArtist2c                     d S r   r   r  s     r(   set_myparam2z2test_set_signature.<locals>.MyArtist2.set_myparam2d  r   r*   N)r   r   r   r  r   r*   r(   	MyArtist2r  c  r   r*   r  myparam2Nr   r   hasattrra   r   )r  r  s     r(   test_set_signaturer  Z  s        GN    9="<=====.....    I    9="<=====............r*   c                       G d dt           j                  } t          | j        d          rJ | j        j        dk    sJ  G d d|           }|j        | j        u sJ dS )z=set() defined in Artist subclasses should not be overwritten.c                       e Zd Zd ZdS )*test_set_is_overwritten.<locals>.MyArtist3c                     dS )Not overwritten.Nr   )r   kwargss     r(   ra   z.test_set_is_overwritten.<locals>.MyArtist3.setp  s      r*   N)r   r   r   ra   r   r*   r(   	MyArtist3r  n  s#        	# 	# 	# 	# 	#r*   r"  r  r   c                       e Zd ZdS )*test_set_is_overwritten.<locals>.MyArtist4Nr   r   r   r   r*   r(   	MyArtist4r$  v  s        r*   r&  Nr  )r"  r&  s     r(   test_set_is_overwrittenr'  l  s    # # # # #GN # # #
 y}&@AAAAA= $66666    I    =IM))))))r*   c                  ,   t          j        d          } d| d<   d| d<   d| d<   d| d	<   d
| d<   d| d<   d| d<   d| d<   d| d<   t          j                    \  }}|                    d           t          j        t          j        ddd          d          }|                    | d|          }g d}t          | j
        |          D ] \  }}|                    |          |k    sJ !t          j                     t          j                    \  }}|                    d           t          j        d                             d          }t          j        t          j        ddd          d          }|                    | ||          }g d}t          | j
        |          D ] \  }}|                    |          |k    sJ !t          j                     t          j                    \  }}|                    d           t          j        d                             d          }t          j        t          j        ddd          d          }|                    | ||          }g d}t          | j
        |          D ] \  }}|                    |          |k    sJ !t          j                     t          j        d           } d!| d
<   d"| d<   d#| d$<   d%| d&<   d| d'<   d(| d)<   d*| d+<   g d,}t          j                    \  }}|                    d-           t          j        t          j        d
dd'd./          dd0d12          }|                    | d|          }t          | j
        |          D ] \  }}|                    |          |k    sJ !t          j                     t          j                    \  }}|                    d3           t          j        t          j        d
dd'd./          dd0d42          }|                    | d|          }t          | j
        |          D ] \  }}|                    |          |k    sJ !t          j                     t          j                    \  }}|                    d5           t          j        t          j        d
dd'd./          dd0d62          }|                    | d|          }t          | j
        |          D ] \  }}|                    |          |k    sJ !t          j                     t          j                    \  }}|                    d7           t          j        t          j        d
dd'd./          dd0d82          }|                    | d|          }t          | j
        |          D ] \  }}|                    |          |k    sJ !t          j                     t          j                    \  }}|                    d9           t          j        t          j        d
dd'd./          dd.d12          }|                    | d|          }t          | j
        |          D ] \  }}|                    |          |k    sJ !t          j                     d:S );z7Test if cursor data is correct when using BoundaryNorm.)r   r   g?r{   gGz?)r   r   g+?)r   r
   r8   r   r   r   r   )r   r
   g
ףp=
?)r
   r   g;On?)r
   r   gH}M?r	   z-1..1 to 0..256 in 0.1      RdBu_r)cmapnorm)	[0.9][1.]r/  [-1.0][0.0][1.0][0.09][0.009][0.0009]z-1..1 to 0..256 in 0.01   )	z[0.90]z[0.99]r2  z[-1.00]z[0.00]z[1.00]r3  r4  r5  z-1..1 to 0..256 in 0.001i  )	z[0.900]z[0.990]z[0.999]z[-1.000]z[0.000]z[1.000]z[0.090]r4  r5  )r   r   g      g        g?r
   r   r   r7   g      ?r<   g       @r9   )r0  r1  z[0.1]z[0.5]r.  r2  z[2.0]znoclip, neitherT)endpointFneither)clipextendznoclip, minminznoclip, maxmaxznoclip, bothbothzclip, neitherN)rm   emptyr   rL   suptitlemcolorsBoundaryNormlinspacer   zipflatformat_cursor_dataclosempl	colormaps	resampled)	XrT   r#   r-  imglabels_listvlabelr,  s	            r(   $test_format_cursor_data_BoundaryNormrO  |  s   
AAdGAdGAdGAdGAdGAdGAdGAdGAdG lnnGCLL)***B2 6 6<<D
))AH4)
0
0C
 
 
K ,, 2 25%%a((E11111IKKK lnnGCLL*+++=",,S11DB3 7 7==D
))ADt)
,
,C
 
 
K ,, 2 25%%a((E11111IKKK lnnGCLL+,,,=",,T22DB4 8 8$??D
))ADt)
,
,C
 
 
K ,, 2 25%%a((E11111IKKK 	AAaDAaDAaDAaDAaDAaDAaD  K lnnGCLL"###
Aq!d+++SuYP P PD
))AH4)
0
0C,, 2 25%%a((E11111IKKKlnnGCLL
Aq!d+++SuUL L LD
))AH4)
0
0C,, 2 25%%a((E11111IKKKlnnGCLL
Aq!d+++SuUL L LD
))AH4)
0
0C,, 2 25%%a((E11111IKKKlnnGCLL   
Aq!d+++SuVM M MD
))AH4)
0
0C,, 2 25%%a((E11111IKKKlnnGCLL!!!
Aq!d+++StIO O OD
))AH4)
0
0C,, 2 25%%a((E11111IKKKKKr*   c                       G d dt           j                  } d| j        v sJ | j        d         | j        u sJ  G d d|           }d|j        vsJ |j        | j        u sJ d S )Nc                       e Zd ZdS )$test_auto_no_rasterize.<locals>.Gen1Nr%  r   r*   r(   Gen1rR            r*   rS  r   c                       e Zd ZdS )$test_auto_no_rasterize.<locals>.Gen2Nr%  r   r*   r(   Gen2rV  $  rT  r*   rW  )r   r   __dict__r   )rS  rW  s     r(   test_auto_no_rasterizerY    s        w~    T]""""= DI----    t    &&&&9	!!!!!!r*   c                       G d dt           j                  }  |             }t          j                    }d|                    |d          k    sJ d|                    |d          k    sJ d S )Nc                       e Zd Zd ZdS )1test_draw_wraper_forward_input.<locals>.TestKlassc                     |S r   r   )r   rendererextras      r(   r   z6test_draw_wraper_forward_input.<locals>.TestKlass.draw-  s    Lr*   N)r   r   r   r   r   r*   r(   	TestKlassr\  ,  s#        	 	 	 	 	r*   r`  aardvark)r_  )r   r   mbackend_basesRendererBaser   )r`  r   r^  s      r(   test_draw_wraper_forward_inputrd  +  s        GN    )++C*,,H(J777777(*========r*   c                     t          j                    } |                                 }|                                }|                                }|                     d          | u sJ |                     d          | u sJ |                                |u sJ |                    d          |u sJ |                    d          | u sJ |                    d          |u sJ |                    d          | u sJ t          j        t          j                  5  |                                | u sJ 	 d d d            n# 1 swxY w Y   |                                | u sJ t          j
        g g           }|                    d          J |                    d          J |j        |u sJ | j        | u sJ |j        | u sJ d S )NT)rootF)r   figure
subfiguresrL   r   r   warnsrG  MatplotlibDeprecationWarningr   r   )rT   sfig1sfig2r#   r   s        r(   test_get_figurerm  7  sF   
*,,CNNEE			B>>t>$$++++>>u>%%,,,,==??e####==e=$$----==d=##s**** ''50000&&#----	c6	7	7 ) )!!S((((() ) ) ) ) ) ) ) ) ) ) ) ) ) ) $$$$ 
r2		B==d=##+++==e=$$,,, 9:<3s   "EEE)>ro   	itertoolsr   numpyrm   r   matplotlib.colorscolorsr@  matplotlib.pyplotpyplotr   matplotlib.patchespatchesr   matplotlib.lineslinesr   matplotlib.pathpathrD   matplotlib.transforms
transformsr    matplotlib.collectionscollectionsr-   matplotlib.artistr  r   matplotlib.backend_basesbackend_basesrb  
matplotlibrG  matplotlib.testing.decoratorsr   r   r)   r3   rY   rh   rv   r   r   r   r   r   r   markparametrizer   r   r   r   r  r  r'  rO  rY  rd  rm  r   r*   r(   <module>r     s   				            # # # # # #       % % % % % % ! ! ! ! ! !       + + + + + + - - - - - - # # # # # # 1 1 1 1 1 1     O O O O O O O O'( '( '(T!O !O !OH '(d;;;  <;6 (((4 4 )(4$' ' '" :,D	BBB  CB2  : &'TKKK  LK(  
1 1 1$3 3 3 2 5 5 5  $ $ $* * *	 	 	0 0 0  $/ / /$* * * ^ ^ ^B" " "	> 	> 	>    r*   