
    G8c                        d dl Z d dl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.d/ff	      d0        Zd1 Z ed2g3      d4        Zy)5    N)Sankey)check_figures_equalc                  8    t               } | j                          y )N)r   add)sankeys    >/usr/lib/python3/dist-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_errorsr1      s2     
z	-   s   1:trunklengthz'trunklength' is negative皙?g333333?)r   priorzThe scaled sum of the connectedr4   z*The index of the prior diagram is negativez#The index of the prior diagram is 1)r   r    )connectr4   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    皙ɿ)r5   r4   r   r   zThe value of orientations)r5   r4   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*   r3   r7   )r   r   )r   r,   r-   r.   r   )r/   r0   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        j                  t        j                  t        j
                  d      |d   j                              sJ |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        j                  t        j
                  d      |d   j                        sJ t        g ddgdgd      } | j                         }t        j                  t        j                  t        j
                  d      |d   j                              sJ |d   j                  g dk(  sJ t        j                  t        j
                  d      |d   j                        sJ y c c}w c c}w )N)r         п      ?      Foor   Bar)r   r   r   unitr   )r    r6   r    r6   r6    )g      g=ä࿩g      ?g6	t)迩g      gՁAڿg      ?gqXu)r   r<   r   r=   r>   )r    r6   Nr    r6   )rD   rE   )r   r   rF   rG   )r   finishnpallequalarrayr   anglesr   r   textallclosetips)r   sfrN   s      r   test_sankey2rR   B   s   -ugDu	.A	
B66"((288$<=r!u{{KLLLa5<<<'''"Q%++F$!$-FGGG"Q%++F$$-FGGGa5:: B&&&;;rxx !5 6 !uzz	# # # 	0%Du	.A	
B66"((288$?@"Q%++NOOOa5<<----;;rxx !5 6
 !uzz# # # GFs   HH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   )rV   r%   )gcar   rH   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,   numpyrI   matplotlib.sankeyr   matplotlib.testing.decoratorsr   r	   r   r   markparametrizer1   r:   rR   r^   r   r
   r   <module>rd      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
   