
    ^j                         d dl Zd dlZd dlmZ d dlmZ d dlm	Z	m
Z
 d Z e
dgd      d        Z e
d	gd      d
        Z e	       d        Z e
dgd      d        Zd Z e
dgd      d        Zd Zd Zy)    N)Spines)check_figures_equalimage_comparisonc                      G d d      }  |         |         |         |        d}t        di |}|d   |d   u sJ |j                  |d   u sJ |ddg   j                  d       |j                  j                  dk(  sJ |j                  j                  dk(  sJ |j
                  j                  J |j                  j                  J |dd j                  d       t        d	 |j                         D              sJ |dd j                  d
       t        d |j                         D              sJ t        j                  t        d      5  |j                   ddd       t        j                  t        d      5  |d    ddd       t        j                  t        d      5  |g d    ddd       t        j                  t        d      5  |d    ddd       t        j                  t        d      5  |dd  ddd       t        j                  t        d      5  |dd  ddd       y# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   cxY w# 1 sw Y   yxY w)z)Test Spines and SpinesProxy in isolation.c                       e Zd Zd Zd Zd Zy)#test_spine_class.<locals>.SpineMockc                     d | _         y Nval)selfs    g/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/matplotlib/tests/test_spines.py__init__z,test_spine_class.<locals>.SpineMock.__init__   s	    DH    c                 8    t        |       j                  |       y r
   )varsupdate)r   kwargss     r   setz'test_spine_class.<locals>.SpineMock.set   s    Jf%r   c                     || _         y r
   r   )r   r   s     r   set_valz+test_spine_class.<locals>.SpineMock.set_val   s	    DHr   N)__name__
__module____qualname__r   r   r    r   r   	SpineMockr      s    		&	r   r   )leftrighttopbottomr   r   xNyc              3   :   K   | ]  }|j                   d k(    yw)r"   Nr   .0spines     r   	<genexpr>z#test_spine_class.<locals>.<genexpr>'   s     =EuyyC=   barfooc              3   :   K   | ]  }|j                   d k(    yw)r)   Nr*   r$   s     r   r'   z#test_spine_class.<locals>.<genexpr>*   s     ?euyyE!?r(   r+   )matchzfoo, bar)r   r+   r   r)   zsingle list)r   r   zSpines does not support slicingr   r   )r   r   r   r   r   r   r    allvaluesr   pytestraisesAttributeErrorr+   KeyError
ValueError)r   spines_dictspiness      r   test_spine_classr7   	   s9     {+	K "k"F&>[0000;;+f----
FG%%c*;;??c!!!<<s"""::>>!!!==$$$
1Ic=V]]_====
1IMMeM?v}}????	~U	3 

	xu	- u	xz	2 0./0	z	7   	z)J	K vg	z)J	K uv   0 0     sH   H9I-III)*I59IIII&)I25I>zspines_axes_positions.pngmpl20)stylec                     t        j                         } t        j                  ddt        j                  z  d      }dt        j
                  |      z  }| j                  ddd      }|j                  d       |j                  ||       |j                  j                  j                  d       |j                  j                  d       |j                  j                  j                  d       |j                  j                  d	       |j                  j                   j#                  d
       |j                  j$                  j#                  d
       y )Nr      d      zcentered spines)axes皙?r   )r>   g      ?r   none)pltfigurenplinspacepisinadd_subplot	set_titleplotr6   r   set_positionyaxisset_ticks_positionr   xaxisr   	set_colorr    )figr!   r"   axs       r   test_spines_axes_positionsrQ   :   s     **,C
Aqw$A	"&&)A	Aq	!BLL"#GGAqMIIOO  /HH(IIMM~.HH&IINNV$IIv&r   zspines_data_positions.pngc                     t        j                         \  } }|j                  j                  j	                  d       |j                  j
                  j	                  d       |j                  j                  j	                  d       |j                  j                  j	                  d       |j                  ddg       |j                  ddg       |j                  j                  d       |j                  j                  d       y )N)datag      )rS   g      ?)rS   g      zeror;   both)rA   subplotsr6   r   rJ   r   r   r    set_xlimset_ylimrM   rL   rK   rO   rP   s     r   test_spines_data_positionsr[   K   s    llnGCIINN/IIMM}-IIOO  0II!!&)KKQKKQHH'HH'r   c                 H   t         j                  j                  d       | j                         }|j	                  dd       |j
                  j                  j                  d       |j
                  j                  j                  d       |j
                  j                  j                  d       |j                  dd	d
       |j                         }|j	                  dd       |j
                  j                  j                  d       |j                  dd	d	d       y )Ndefaultlog)r?   r=   )xscalexlim)rS   r=   r;   )rS   r?   r"   Fin)axis	labelleft	directionT)rb   rc   r   r   )rA   r9   userG   r   r6   r   rJ   set_linewidthr   tick_params)fig_testfig_refrP   s      r   #test_spine_nonlinear_data_positionsrj   X   s    IIMM)				BFF%gF&
 IINN,IINN  #IIOO  .NNuN=				BFF%gF&IIOO!!!$NNu5NEr   zspines_capstyle.png_classic_testc                      t        j                  dd       t        j                         \  } }|j                  g        |j	                  g        y )Nr>      )	linewidth)rA   rcrW   
set_xticks
set_yticksrZ   s     r   test_spines_capstylerr   m   s9     FF6R llnGCMM"MM"r   c                  D   t        j                         \  } }t        j                  dd       |j                  t	        j
                  d             |j                  j                  d       |j                  j                  j                  d       |j                  j                  j                  d       |j                  d       |j                  j                  d       |j                  j                  j                  d       |j                  j                   j                  d       |j#                  d	       |j                  j%                  g        |j                  j%                  g        t        j&                          |j                  j                  }|j)                         j+                  |j-                               j/                         }|j                  j0                  j3                         d
   |j4                  k  sJ d       |j                  j                  }|j)                         j+                  |j-                               j/                         }|j                  j0                  j3                         d   |j6                  k  sJ d       y )Ng333333?)r   r    
   r   )outward   Fzy labelr    zx labelr   z"Y-Axis label not left of the spiner=   z X-Axis label not below the spine)rA   rW   subplots_adjustrI   rC   arangerK   rL   r6   r   rJ   r   set_visible
set_ylabelrM   r    r   
set_xlabel	set_ticksdrawget_transformtransform_pathget_pathget_extentslabelget_positionxminymin)rO   rP   r&   	spinebboxs       r   test_label_without_ticksr   v   s   llnGCS-GGBIIbMHH'IINN0IIOO&MM)HH)II!!/2IIMMe$MM)HHrHHrHHJIINNE##%44%+- 88>>&&(+inn< -,-< IIE##%44%+- 88>>&&(+inn< +*+<r   zblack_axes.pngc                  J   dt         j                  d<   dt         j                  d<   t        j                  dd      } | j                  d      }|j	                  g        |j                  g        |j                  g        |j                  g        |j                  d       y )	Nr   zsavefig.pad_inchestightzsavefig.bbox)   r   )figsize)r   r   r=   r=   )r   r   r   )	rA   rcParamsrB   add_axesset_xticklabelsset_yticklabelsrp   rq   set_facecolorrZ   s     r   test_spines_black_axesr      s     *+CLL%&#*CLL 
**Q
'C	l	#BrrMM"MM"Yr   c                      t        j                         } | j                  d      }|j                  d   }|j	                  d        |j                  d   j
                  J | j                          y )Npolar)
projectioninner)rA   rB   rG   r6   register_axisrb   draw_without_rendering)rO   rP   inner_spines      r   test_arc_spine_inner_no_axisr      sb     **,C	G	,B))G$Kd#99W""*** r   c                  B   t        j                         \  } }t        j                  ddd      }t        j                  |      }|j                  ||       |j                  j                  }|j                  j                  }|j                  d   j                  dd       |j                  d   j                  dd       |j                  d   j                         }|d   J d	       t        j                  |d   d      sJ d
       t        j                  |d   |d         sJ d       |j                  d   j                         }|d   |d   J d       t        j                  |d   |d         sJ d       t        j                  |d   |d         sJ d       y)z?Test that set_bounds(None, ...) uses original axis view limits.r   rt   r<   r    r;   Nr   r=   zHigher bound should be numericz'Lower bound should match provided valuez'Upper bound should match original valuezleft bound should be numericz'Lower bound should match original value)rA   rW   rC   rD   rF   rI   viewLim	intervalx	intervalyr6   
set_bounds
get_boundsisclose)rO   rP   r!   r"   r`   ylimbottom_bound
left_bounds           r   test_spine_set_bounds_with_noner      s   llnGC 	Ar3A
q	AGGAqM::D::DIIh""1d+IIf  t, 99X&113L?&H(HH&::l1oq)T+TT)::l1oAw  K!JK   6"--/JqM%JqM,E '&'F::jmT!W-X/XX-::jmT!W-X/XX-r   )numpyrC   r0   matplotlib.pyplotpyplotrA   matplotlib.spinesr   matplotlib.testing.decoratorsr   r   r7   rQ   r[   rj   rr   r   r   r   r   r   r   r   <module>r      s       $ O.b ./w?' @'  ./w?	( @	( F F( ()A B+: #$O<
  =
 	!Yr   