
    g<                        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                  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                  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y)6    N)assert_allcloseassert_array_equal)Sankey)check_figures_equalc                  8    t               } | j                          y )N)r   add)sankeys    Y/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/matplotlib/tests/test_sankey.pytest_sankeyr      s    XF
JJL    c                      t        dgdgdg      } | j                  d   j                  d   j                         dk(  sJ y )N      ?First)flowslabelsorientationsr   z
First
0.25r   diagramstextsget_text)ss    r
   
test_labelr      s@    dVWIRDAA::a=q!**,===r   c                      d } t        dgdgdg|       }|j                  d   j                  d   j                         dk(  sJ y )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       sN     	dVWIRD/	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                 z    t        j                  t        |      5  t        di |  d d d        y # 1 sw Y   y xY w)Nmatchr   )pytestraises
ValueErrorr   )kwargsmsgs     r
   test_sankey_errorsr3      s2     
z	-   s   1: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  |j	                  ddg        |j                  di |  d d d        y # 1 sw Y   y xY w)Nr,   r5   r9   )r   r   )r   r.   r/   r0   r   )r1   r2   r	   s      r
   test_sankey_add_errorsr<   .   sQ     XF	z	- 

#t
%

V  s   'AAc                     t        g ddgdgd      } | j                         }t        |d   j                  g d       |d   j                  g dk(  sJ t        |d   j                  D cg c]  }|j                         dd dk(   c}      sJ t        |d   j                  D cg c]  }|j                         d	d  dk(   c}      sJ |d   j                  j                         d
k(  sJ t        |d   j                  g d       t        g ddgdgd      } | j                         }t        |d   j                  g d       |d   j                  g dk(  sJ t        |d   j                  g d       y c c}w c c}w )N)r         п      ?      Foor   Bar)r   r   r   unitr   )r"   r8   r"   r8   r8    )g      g=ä࿩g      ?g6	t)迩g      gՁAڿg      ?gqXu)r   r>   r   r?   r@   )r"   r8   Nr"   r8   )rF   rG   )r   r   rH   rI   )r   finishr   r   anglesallr   r   textr   tips)r   sfrM   s      r
   test_sankey2rP   B   sY   -ugDu	.A	
Br!u{{$<=a5<<<'''"Q%++F$!$-FGGG"Q%++F$$-FGGGa5:: B&&&BqEJJ)* 	0%Du	.A	
Br!u{{$?@a5<<----BqEJJ)* GFs   +E:'E?png)
extensionsc                     | j                         }t        |g dg d      }|j                          |j                         }t        |      }|j                  g dg d       |j                          y )N)r   r>   r>   r   r?   r@   )r"   r   r"   r   r   r   )axr   r   )rT   r'   )gcar   rJ   r   )fig_testfig_refax_tests_testax_refs_refs         r
   test_sankey3r\   ^   s]    llnGw&K!57F
MMO[[]FfE	II9/  1	LLNr   )r.   numpy.testingr   r   matplotlib.sankeyr   matplotlib.testing.decoratorsr   r   r   r    markparametrizer3   r<   rP   r\   r   r   r
   <module>rb      s    = $ =>
	? R[%&!>?B342122w
3792w/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   