a
    Nˆc£  ã                   @   s\  d dl Z d dlZd dlmZ d dlmZ dd„ Zdd„ Zd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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d0œd1fd.d d/d gdgd2œd3ff	¡d4d5„ ƒZd6d7„ Zed8gd9�d:d;„ ƒZdS )<é    N)ÚSankey)Úcheck_figures_equalc                  C   s   t ƒ } |  ¡  d S )N)r   Úadd)Úsankey© r   ú_/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/matplotlib/tests/test_sankey.pyÚtest_sankey   s    r   c                  C   s4   t dgdgdgd�} | jd jd  ¡ dks0J ‚d S )Nç      Ð?ÚFirstéÿÿÿÿ)ÚflowsÚlabelsÚorientationsr   z
First
0.25©r   ZdiagramsÚtextsÚget_text)Úsr   r   r   Ú
test_label   s    r   c                  C   s>   dd„ } t dgdgdg| d�}|jd jd  ¡ dks:J ‚d S )	Nc                 S   s   | d›S )Nz.3fr   )Úvaluer   r   r   Úshow_three_decimal_places   s    z=test_format_using_callable.<locals>.show_three_decimal_placesr	   r
   r   )r   r   r   Úformatr   zFirst
0.250r   )r   r   r   r   r   Útest_format_using_callable   s
    ÿr   zkwargs, msgÚgapr   z'gap' is negativeé   é   )r   Zradiusz'radius' is greater than 'gap'Z
head_anglez'head_angle' is negativeZ	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                 C   s@   t jt|d�� tf i | ¤Ž W d   ƒ n1 s20    Y  d S )N©Úmatch)ÚpytestÚraisesÚ
ValueErrorr   )ÚkwargsÚmsgr   r   r   Útest_sankey_errors   s    r&   Ztrunklengthz'trunklength' is negativeçš™™™™™É?g333333Ó?)r   ÚpriorzThe scaled sum of the connectedr(   z*The index of the prior diagram is negativez#The index of the prior diagram is 1)r   r   )Úconnectr(   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   çš™™™™™É¿)r)   r(   r   r   zThe value of orientations)r)   r(   r   ZpathlengthszThe lengths of 'flows'c                 C   sX   t ƒ }tjt|d��0 |jddgd� |jf i | ¤Ž W d   ƒ n1 sJ0    Y  d S )Nr   r'   r+   )r   )r   r!   r"   r#   r   )r$   r%   r   r   r   r   Útest_sankey_add_errors.   s    r,   c                  C   s@  t g d¢dgdgdd�} |  ¡ }t t t d¡|d j¡¡sBJ ‚|d jg d¢ksXJ ‚tdd	„ |d jD ƒƒstJ ‚td
d	„ |d jD ƒƒs�J ‚|d j	 
¡ dks¦J ‚t t d¡|d j¡sÂJ ‚t g d¢dgdgdd�} |  ¡ }t t t d¡|d j¡¡�sJ ‚|d jg d¢k�sJ ‚t t d¡|d j¡�s<J ‚d S )N)r	   ç      Ð¿ç      à?ç      à¿ÚFoor   ÚBar)r   r   r   Úunitr   )r   r*   r   r*   c                 S   s    g | ]}|  ¡ d d… dk‘qS )r   r*   r0   ©r   ©Ú.0Útextr   r   r   Ú
<listcomp>H   ó    z test_sankey2.<locals>.<listcomp>c                 S   s    g | ]}|  ¡ d d… dk‘qS )éýÿÿÿNr1   r3   r4   r   r   r   r7   I   r8   Ú )©g      ö¿g=§Ã¤à¿©g      ö?g6µ	ƒt)è¿©g      è¿gƒÕ�A“Ú¿©g      è?g±qXu±„ë¿)r	   r-   r   r.   r/   )r   r*   Nr   r*   )r;   r<   )r   r   r=   r>   )r   ÚfinishÚnpÚallÚequalÚarrayr   Zanglesr   r6   r   ZallcloseZtips)r   Zsfr   r   r   Útest_sankey2B   s*    ÿ"üÿ$ûrD   Zpng)Ú
extensionsc                 C   sZ   |   ¡ }t|g d¢g d¢d�}| ¡  |  ¡ }t|d�}|jg d¢g d¢d� | ¡  d S )N)r	   r-   r-   r	   r.   r/   )r   r   r   r   r   r   )Úaxr   r   )rF   r   )Zgcar   r?   r   )Zfig_testZfig_refZax_testZs_testZax_refZs_refr   r   r   Útest_sankey3^   s    
ÿ

ÿrG   )r!   Únumpyr@   Zmatplotlib.sankeyr   Zmatplotlib.testing.decoratorsr   r   r   r   ÚmarkZparametrizer&   r,   rD   rG   r   r   r   r   Ú<module>   sT   


ÿÿù





ÿÿ
ÿÿö

