
    P/Ph<                        d dl Z d dlmZmZ d dlmZ d dlmZ d Zd Z	d Z
e j                            dd	d
idfddddfdd
idfdd
idfdd
gg dddfdd
gg dddff          d             Ze j                            ddd
idfddgd dd fd!d
id"fd!did#fd$d d%d&fd'd d%d(fd)d d%d*fd+d d,dgdgd-d.fd+d d,dgdgd/d0ff	          d1             Zd2 Z ed3g4          d5             ZdS )6    N)assert_allcloseassert_array_equal)Sankey)check_figures_equalc                  J    t                      } |                                  d S )N)r   add)sankeys    \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/matplotlib/tests/test_sankey.pytest_sankeyr      s    XXF
JJLLLLL    c                      t          dgdgdg          } | j        d         j        d                                         dk    sJ d S )N      ?First)flowslabelsorientationsr   z
First
0.25r   diagramstextsget_text)ss    r
   
test_labelr      sM    dVWIRDAAAA:a=q!**,,======r   c                      d } t          dgdgdg|           }|j        d         j        d                                         dk    sJ d S )Nc                 
    | dS )Nz.3f )values    r
   show_three_decimal_placesz=test_format_using_callable.<locals>.show_three_decimal_places   s    ~~r   r   r   r   )r   r   r   formatr   zFirst
0.250r   )r   r   s     r
   test_format_using_callabler       si       	dVWIRD/	1 	1 	1A :a=q!**,,>>>>>>r   zkwargs, msggapr   z'gap' is negative      )r!   radiusz'radius' is greater than 'gap'
head_anglez'head_angle' is negative	tolerancez'tolerance' is negative)r   r   r"   r   r   z/The shapes of 'flows' \(2,\) and 'orientations')abc)r   r   z)The shapes of 'flows' \(2,\) and 'labels'c                     t          j        t          |          5  t          di |  d d d            d S # 1 swxY w Y   d S )Nmatchr   )pytestraises
ValueErrorr   )kwargsmsgs     r
   test_sankey_errorsr3      s     
z	-	-	-                   s   6::trunklengthz'trunklength' is negative皙?g333333?)r   priorzThe scaled sum of the connectedr6   z*The index of the prior diagram is negativez#The index of the prior diagram is 1)r   r"   )connectr6   zAt least one of the connection)r#   r"   z"The connection index to the source)r"      z The connection index to this dia)r"   r"   皙ɿ)r7   r6   r   r   zThe value of orientations)r7   r6   r   pathlengthszThe lengths of 'flows'c                     t                      }t          j        t          |          5  |                    ddg            |j        di |  d d d            d S # 1 swxY w Y   d S )Nr,   r5   r9   )r   r   )r   r.   r/   r0   r   )r1   r2   r	   s      r
   test_sankey_add_errorsr<   .   s     XXF	z	-	-	-  

#t
%%%
V                 s   &AA!$A!c                     t          g ddgdgd          } |                                 }t          |d         j        g d           |d         j        g dk    sJ t          d |d         j        D                       sJ t          d	 |d         j        D                       sJ |d         j                                        d
k    sJ t          |d         j
        g d           t          g ddgdgd          } |                                 }t          |d         j        g d           |d         j        g dk    sJ t          |d         j
        g d           d S )N)r         п      ?      Foor   Bar)r   r   r   unitr   )r"   r8   r"   r8   c                 N    g | ]"}|                                 d d         dk    #S )r   r8   rA   r   .0texts     r
   
<listcomp>z test_sankey2.<locals>.<listcomp>H   s.    FFF$!$-FFFr   c                 N    g | ]"}|                                 d d         dk    #S )NrB   rE   rF   s     r
   rI   z test_sankey2.<locals>.<listcomp>I   s.    FFF$$-FFFr    )g      g=ä࿩g      ?g6	t)迩g      gՁAڿg      ?gqXu)r   r>   r   r?   r@   )r"   r8   Nr"   r8   )rM   rN   )r   r   rO   rP   )r   finishr   r   anglesallr   rH   r   r   tips)r   sfs     r
   test_sankey2rV   B   s   ---ugDu	. 	. 	.A	
Br!u{$<$<$<===a5<<<<''''FF"Q%+FFFGGGGGFF"Q%+FFFGGGGGa5:  B&&&&BqEJ) ) )* * * 	000%Du	. 	. 	.A	
Br!u{$?$?$?@@@a5<-------BqEJ) ) )* * * * *r   png)
extensionsc                 (   |                                  }t          |g dg d          }|                                 |                                 }t          |          }|                    g dg d           |                                 d S )N)r   r>   r>   r   r?   r@   )r"   r   r"   r   r   r   )axr   r   )rZ   r'   )gcar   rQ   r   )fig_testfig_refax_tests_testax_refs_refs         r
   test_sankey3rb   ^   s    llnnGw&K&K&K!5!5!57 7 7F
MMOOO[[]]FfE	II999///  1 1 1	LLNNNNNr   )r.   numpy.testingr   r   matplotlib.sankeyr   matplotlib.testing.decoratorsr   r   r   r    markparametrizer3   r<   rV   rb   r   r   r
   <module>rh      sN    = = = = = = = = $ $ $ $ $ $ = = = = = =  > > >
	? 	? 	? R[%&!>?B342122w


33792w///2213	) 	 	 	 	
 R56SzA&&(IJr]@Aq\891%%'GH!$$&JK!$$&HI!tSkc 79!tSkS 35)    * * *8 (((
 
 )(
 
 
r   