a
    ~¤bÆy  ã                   @   sÊ   d dl mZ d dlZd dlmZ d dlmZmZm	Z	m
Z
mZmZ d dlmZ z,d dlmZmZmZmZ d dlmZmZ W n   Y n0 dd	lmZmZ G d
d„ deƒZG dd„ deƒZG dd„ deƒZdS )é    )Úabsolute_importN)ÚDataset)ÚGraphÚNodesÚTriMeshÚChordÚVLineÚcircular_layout)Údim)ÚNodesAndLinkedEdgesÚEdgesAndLinkedNodesÚ	NodesOnlyÚPatches)ÚCategoricalColorMapperÚLinearColorMapperé   )ÚTestBokehPlotÚbokeh_rendererc                       sä   e Zd Z‡ fdd„Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zd1d2„ Zd3d4„ Z‡  ZS )5ÚTestBokehGraphPlotc                    sî   t t| ƒ ¡  d}ttj|tjdƒ| _tj|tjd| _tj	|tjd| _
tj |¡| _t| j| j
ffƒ| _tdgdg|d   dgd| _t| jdd| _t| j| j
f| jfƒ| _t| j| j
f| jfƒ| _t| j| j
| jffdd| _d S )	Né   )ZdtypeÚOutputÚInputr   ÚLabel©ZvdimsÚWeight)Úsuperr   ÚsetUpr	   ÚnpÚarangeZint32ÚnodesÚsourceZzerosÚtargetZrandomZrandÚweightsr   Úgraphr   Ú	node_infoÚ
node_info2Úgraph2Úgraph3Úgraph4)ÚselfÚN©Ú	__class__© úKlib/python3.9/site-packages/holoviews/tests/plotting/bokeh/testgraphplot.pyr      s     zTestBokehGraphPlot.setUpc                 C   sŽ   t  | j¡}|jd }|jd }|jd }|  |jd | j¡ |  |jd | j¡ |  |jd | j¡ dd„ | jj 	¡ D ƒ}|  |j
|¡ d S )	NÚscatter_1_sourceÚmulti_line_1_sourceÚlayout_sourceÚindexÚstartÚendc                 S   s$   i | ]\}}}t t|ƒƒ||f“qS r-   ©ÚstrÚint©Ú.0ÚxÚyÚzr-   r-   r.   Ú
<dictcomp>*   ó    z=TestBokehGraphPlot.test_plot_simple_graph.<locals>.<dictcomp>)r   Úget_plotr#   ÚhandlesÚassertEqualÚdatar    r!   r   ÚarrayÚgraph_layout©r)   ÚplotÚnode_sourceÚedge_sourcer1   Úlayoutr-   r-   r.   Útest_plot_simple_graph"   s    


z)TestBokehGraphPlot.test_plot_simple_graphc                 C   sd   t  tdƒ| j ¡}|jd }|jd }|  |jd¡ |  |jd¡ |  |jd¡ |  |jd¡ d S )Nr   Úx_rangeéÿÿÿÿr   )r   r?   r   r#   r@   rA   r3   r4   )r)   rF   rK   Zy_ranger-   r-   r.   Ú"test_plot_graph_annotation_overlay-   s    

z5TestBokehGraphPlot.test_plot_graph_annotation_overlayc                 C   sì   | j  | j j| j j| j jf¡}t |¡}|jd }|jd }|jd }|  |jd | j	¡ |  |jd | j	¡ |  |jd | j
¡ |j ¡ }|  |jd dd	„ |D ƒ¡ |  |jd
 dd	„ |D ƒ¡ dd„ | j j ¡ D ƒ}|  |j|¡ d S )Nr/   r0   r1   r2   r3   r4   Zxsc                 S   s   g | ]}|  d ¡‘qS )r   ©Zdimension_values©r9   Úpathr-   r-   r.   Ú
<listcomp>@   r>   zATestBokehGraphPlot.test_plot_graph_with_paths.<locals>.<listcomp>Zysc                 S   s   g | ]}|  d ¡‘qS )r   rN   rO   r-   r-   r.   rQ   A   r>   c                 S   s$   i | ]\}}}t t|ƒƒ||f“qS r-   r5   r8   r-   r-   r.   r=   B   r>   zATestBokehGraphPlot.test_plot_graph_with_paths.<locals>.<dictcomp>)r#   ZclonerB   r   Z	edgepathsr   r?   r@   rA   r    r!   ÚsplitrC   rD   )r)   r#   rF   rG   rH   r1   ÚedgesrI   r-   r-   r.   Útest_plot_graph_with_paths6   s    




z-TestBokehGraphPlot.test_plot_graph_with_pathsc                 C   sP   t  | j¡}|jd }|jd }|  |jt¡ |  |jdg¡ |  	||j
¡ d S )NÚglyph_rendererÚhover)r2   z@{index_hover})r   r?   r#   r@   ÚassertIsInstanceÚinspection_policyr   rA   ÚtooltipsÚassertInÚ	renderers©r)   rF   ÚrendererrV   r-   r-   r.   Ú"test_graph_inspection_policy_nodesE   s    

z5TestBokehGraphPlot.test_graph_inspection_policy_nodesc                 C   s`   t  | jjtddd¡}|jd }|jd }|  |jt¡ |  	|j
ddg¡ |  ||j¡ d S )NrS   ©rX   ©rF   rU   rV   )r3   z@{start_values})r4   z@{end_values})r   r?   r#   ÚoptsÚdictr@   rW   rX   r   rA   rY   rZ   r[   r\   r-   r-   r.   Ú"test_graph_inspection_policy_edgesM   s    

z5TestBokehGraphPlot.test_graph_inspection_policy_edgesc                 C   sn   | j jddd}t |jtddd¡}|jd }|jd }|  |jt	¡ |  
|jd	d
g¡ |  ||j¡ d S )Nr    r!   )r3   r4   rS   r_   r`   rU   rV   )r    z	@{source})r!   z	@{target})r#   Zredimr   r?   ra   rb   r@   rW   rX   r   rA   rY   rZ   r[   )r)   r#   rF   r]   rV   r-   r-   r.   Ú4test_graph_inspection_policy_edges_non_default_namesU   s    

zGTestBokehGraphPlot.test_graph_inspection_policy_edges_non_default_namesc                 C   s6   t  | jjtd dd¡}|jd }|  |jt¡ d S )Nr_   r`   rU   )	r   r?   r#   ra   rb   r@   rW   rX   r   ©r)   rF   r]   r-   r-   r.   Ú!test_graph_inspection_policy_none^   s    
z4TestBokehGraphPlot.test_graph_inspection_policy_nonec                 C   s@   t  | j¡}|jd }|jd }|  |jt¡ |  ||j¡ d S )NrU   rV   )	r   r?   r#   r@   rW   Úselection_policyr   rZ   r[   r\   r-   r-   r.   Ú!test_graph_selection_policy_nodesc   s
    

z4TestBokehGraphPlot.test_graph_selection_policy_nodesc                 C   sN   t  | jjtddd¡}|jd }|jd }|  |jt¡ |  	||j
¡ d S )NrS   ©rg   r`   rU   rV   )r   r?   r#   ra   rb   r@   rW   rg   r   rZ   r[   r\   r-   r-   r.   Ú!test_graph_selection_policy_edgesj   s
    

z4TestBokehGraphPlot.test_graph_selection_policy_edgesc                 C   s6   t  | jjtd dd¡}|jd }|  |jt¡ d S )Nri   r`   rU   )	r   r?   r#   ra   rb   r@   rW   rg   r   re   r-   r-   r.   Ú test_graph_selection_policy_noneq   s    
z3TestBokehGraphPlot.test_graph_selection_policy_nonec                 C   s’   | j jtddtddd}t |¡}|jd }|jd }|jd }|  |t¡ |  |j	d	d
g¡ |  |j
d | jd ¡ |  |jd|dœ¡ d S )Nr   ©Úcolor_indexZSet1©Úcmap©rF   ÚstyleÚcolor_mapperr/   Úscatter_1_glyphr   r   ©ÚfieldZ	transform)r&   ra   rb   r   r?   r@   rW   r   rA   ÚfactorsrB   r$   Ú
fill_color©r)   ÚgrF   ÚcmapperrG   Úglyphr-   r-   r.   Ú(test_graph_nodes_categorical_colormappedv   s    



z;TestBokehGraphPlot.test_graph_nodes_categorical_colormappedc                 C   s¨   | j jtddtddd}t |¡}|jd }|jd }|jd }|  |t¡ |  |j	| j
 ¡ ¡ |  |j| j
 ¡ ¡ |  |jd | jd ¡ |  |jd|d	œ¡ d S )
Nr   rl   Zviridisrn   rp   rr   r/   rs   rt   )r'   ra   rb   r   r?   r@   rW   r   rA   Úlowr"   ÚminÚhighÚmaxrB   r%   rw   rx   r-   r-   r.   Ú(test_graph_nodes_numerically_colormapped   s    



z;TestBokehGraphPlot.test_graph_nodes_numerically_colormappedc                 C   s”   | j jtddtddgdd}t |¡}|jd }|jd }|jd	 }|  |t¡ g d
¢}|  |j	|¡ |  |j
d |¡ |  |jd|dœ¡ d S )Nr3   ©Zedge_color_indexú#FFFFFFú#000000©Ú	edge_cmaprp   Úedge_colormapperr0   Úmulti_line_1_glyph)Ú0Ú1Ú2Ú3Ú4Ú5Ú6Ú7Ústart_str__rt   )r'   ra   rb   r   r?   r@   rW   r   rA   rv   rB   Ú
line_color©r)   ry   rF   rz   rH   r{   rv   r-   r-   r.   Ú(test_graph_edges_categorical_colormapped   s    ÿ



z;TestBokehGraphPlot.test_graph_edges_categorical_colormappedc                 C   s¬   | j jtddtddgdd}t |¡}|jd }|jd }|jd	 }|  |t¡ |  |j	| j
 ¡ ¡ |  |j| j
 ¡ ¡ |  |jd | jd ¡ |  |jd|d
œ¡ d S )Nr   r‚   rƒ   r„   r…   rp   r‡   r0   rˆ   rt   )r(   ra   rb   r   r?   r@   rW   r   rA   r}   r"   r~   r   r€   rB   r%   r’   ©r)   ry   rF   rz   rH   r{   r-   r-   r.   Ú(test_graph_edges_numerically_colormappedš   s    ÿ



z;TestBokehGraphPlot.test_graph_edges_numerically_colormappedc                 C   sŠ   ddg}t g d¢dd}t||fƒjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd¡ |  |j	d
 t
 g d¢¡¡ d S )N©r   r   ©r   é   ))r   r   r   Úred)r   r   r   Úgreen)r   r   r™   ÚblueÚcolorr   ©Ú
node_colorr/   rs   ru   rŸ   Úblack©rš   r›   rœ   ©r   r   Úoptionsr   r?   r@   rA   rw   r’   rB   r   rC   ©r)   rS   r   r#   rF   Úcdsr{   r-   r-   r.   Útest_graph_op_node_color«   s    ÿ


z+TestBokehGraphPlot.test_graph_op_node_colorc                 C   s–   ddg}t g d¢dd}t||fƒjdd}t |¡}|jd }|jd }|jd	 }|  |jd
|dœ¡ |  |jd¡ |  |j	d
 t
 g d¢¡¡ d S )Nr—   r˜   ))r   r   r   ç      à?)r   r   r   ç      ø?)r   r   r™   ç      @r   r   rž   r/   rs   Únode_color_color_mapperrŸ   rt   r    )r§   r¨   r©   r¢   ©r)   rS   r   r#   rF   r¥   r{   rz   r-   r-   r.   Útest_graph_op_node_color_linear·   s    ÿ



z2TestBokehGraphPlot.test_graph_op_node_color_linearc                 C   s–   ddg}t g d¢dd}t||fƒjdd}t |¡}|jd }|jd }|jd	 }|  |jd
|dœ¡ |  |jd¡ |  |j	d
 t
 g d¢¡¡ d S )Nr—   r˜   ))r   r   r   ÚA)r   r   r   ÚB)r   r   r™   ÚCr   r   rž   r/   rs   rª   rŸ   rt   r    ©r­   r®   r¯   r¢   r«   r-   r-   r.   Ú$test_graph_op_node_color_categoricalÄ   s    ÿ



z7TestBokehGraphPlot.test_graph_op_node_color_categoricalc                 C   s|   ddg}t g d¢dd}t||fƒjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd
 t	 
g d¢¡¡ d S )Nr—   r˜   ©)r   r   r   r™   )r   r   r   é   )r   r   r™   é   Úsizer   ©Ú	node_sizer/   rs   ru   r·   ©r™   r³   r´   )r   r   r£   r   r?   r@   rA   rµ   rB   r   rC   r¤   r-   r-   r.   Útest_graph_op_node_sizeÑ   s    ÿ


z*TestBokehGraphPlot.test_graph_op_node_sizec                 C   sŽ   ddg}t g d¢dd}t||fƒjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd	d
i¡ |  |j	d
 t
 g d¢¡¡ d S )Nr—   r˜   ))r   r   r   çš™™™™™É?)r   r   r   ç333333ã?)r   r   r™   r   Úalphar   ©Ú
node_alphar/   rs   ru   r¾   )rº   r»   r   )r   r   r£   r   r?   r@   rA   Ú
fill_alphaÚ
line_alpharB   r   rC   r¤   r-   r-   r.   Útest_graph_op_node_alphaÜ   s    


z+TestBokehGraphPlot.test_graph_op_node_alphac                 C   s|   ddg}t g d¢dd}t||fƒjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd
 t	 
g d¢¡¡ d S )Nr—   r˜   r²   Ú
line_widthr   ©Únode_line_widthr/   rs   ru   rÄ   r¸   )r   r   r£   r   r?   r@   rA   rÂ   rB   r   rC   r¤   r-   r-   r.   Útest_graph_op_node_line_widthç   s    


z0TestBokehGraphPlot.test_graph_op_node_line_widthc                 C   sl   g d¢}t |ddjdd}t |¡}|jd }|jd }|  |jddi¡ |  |jd t 	g d	¢¡¡ d S )
N))r   r   rš   )r   r™   r›   )r   é   rœ   r   r   ©Ú
edge_colorr0   rˆ   ru   rÈ   r¡   ©
r   r£   r   r?   r@   rA   r’   rB   r   rC   ©r)   rS   r#   rF   r¥   r{   r-   r-   r.   Útest_graph_op_edge_colorñ   s    


z+TestBokehGraphPlot.test_graph_op_edge_colorc                 C   sx   g d¢}t |ddjdd}t |¡}|jd }|jd }|jd }|  |jd|d	œ¡ |  |jd t 	g d
¢¡¡ d S )N)©r   r   r™   ©r   r™   r§   )r   rÆ   rÆ   r   r   rÇ   r0   rˆ   Úedge_color_color_mapperrÈ   rt   )r™   r§   rÆ   rÉ   ©r)   rS   r#   rF   r¥   r{   rz   r-   r-   r.   Útest_graph_op_edge_color_linearú   s    



z2TestBokehGraphPlot.test_graph_op_edge_color_linearc                 C   sx   g d¢}t |ddjdd}t |¡}|jd }|jd }|jd }|  |jd|d	œ¡ |  |jd t 	g d
¢¡¡ d S )N))r   r   r¯   )r   r™   r®   )r   rÆ   r­   r   r   rÇ   r0   rˆ   rÎ   rÈ   rt   )r¯   r®   r­   rÉ   rÏ   r-   r-   r.   Ú$test_graph_op_edge_color_categorical  s    



z7TestBokehGraphPlot.test_graph_op_edge_color_categoricalc                 C   sl   g d¢}t |ddjdd}t |¡}|jd }|jd }|  |jddi¡ |  |jd t 	g d	¢¡¡ d S )
N))r   r   çš™™™™™¹?rÍ   )r   rÆ   ç333333Ó?r¼   r   ©Ú
edge_alphar0   rˆ   ru   rÕ   )rÒ   r§   rÓ   )
r   r£   r   r?   r@   rA   rÀ   rB   r   rC   rÊ   r-   r-   r.   Útest_graph_op_edge_alpha  s    


z+TestBokehGraphPlot.test_graph_op_edge_alphac                 C   sl   g d¢}t |ddjdd}t |¡}|jd }|jd }|  |jddi¡ |  |jd t 	g d	¢¡¡ d S )
N)rÌ   )r   r™   é
   )r   rÆ   r´   rÂ   r   ©Úedge_line_widthr0   rˆ   ru   rÙ   )r™   r×   r´   )
r   r£   r   r?   r@   rA   rÂ   rB   r   rC   rÊ   r-   r-   r.   Útest_graph_op_edge_line_width  s    


z0TestBokehGraphPlot.test_graph_op_edge_line_width)Ú__name__Ú
__module__Ú__qualname__r   rJ   rM   rT   r^   rc   rd   rf   rh   rj   rk   r|   r   r”   r–   r¦   r¬   r±   r¹   rÁ   rÅ   rË   rÐ   rÑ   rÖ   rÚ   Ú__classcell__r-   r-   r+   r.   r      s4   		
	

	r   c                       s¤   e Zd Z‡ fdd„Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Z‡  ZS )%ÚTestBokehTriMeshPlotc                    sN   t t| ƒ ¡  g d¢| _ddg| _t| j| jfƒ| _t| j| jfdd| _d S )N))r   r   r   )r§   r   r   )g      ð?r   r™   )r¨   r   rÆ   )r   r   r™   r   )r   r™   rÆ   r   Úweightr   )r   rß   r   r   Z	simplicesr   ÚtrimeshÚtrimesh_weighted©r)   r+   r-   r.   r   #  s
    

zTestBokehTriMeshPlot.setUpc                 C   sœ   t  | j¡}|jd }|jd }|jd }|  |jd t d¡¡ |  |jd t d¡¡ |  |jd t d	d
¡¡ dd„ | jj 	¡ D ƒ}|  |j
|¡ d S )Nr/   r0   r1   r2   r³   r3   r™   r4   r   rÆ   c                 S   s$   i | ]\}}}t t|ƒƒ||f“qS r-   r5   r8   r-   r-   r.   r=   3  r>   zATestBokehTriMeshPlot.test_plot_simple_trimesh.<locals>.<dictcomp>)r   r?   rá   r@   rA   rB   r   r   r   rC   rD   rE   r-   r-   r.   Útest_plot_simple_trimesh+  s    


z-TestBokehTriMeshPlot.test_plot_simple_trimeshc                 C   s¼   t  | jjtddd¡}|jd }|jd }|jd }|  |jd t¡ |  |j	d t
 d	¡¡ |  |j	d
 t
 d¡¡ |  |j	d t
 dd¡¡ dd„ | jj ¡ D ƒ}|  |j|¡ d S )NT)Úfilledr`   r/   Úpatches_1_sourcer1   Úpatches_1_glyphr2   r³   r3   r™   r4   r   rÆ   c                 S   s$   i | ]\}}}t t|ƒƒ||f“qS r-   r5   r8   r-   r-   r.   r=   ?  r>   zHTestBokehTriMeshPlot.test_plot_simple_trimesh_filled.<locals>.<dictcomp>)r   r?   rá   ra   rb   r@   rW   r   rA   rB   r   r   r   rC   rD   rE   r-   r-   r.   Útest_plot_simple_trimesh_filled6  s    


z4TestBokehTriMeshPlot.test_plot_simple_trimesh_filledc                 C   s¢   | j jtddtddgdd}t |¡}t|jƒ |jd }|jd }|jd	 }|  |t¡ g d
¢}|  	|j
|¡ |  	|jd ddg¡ |  	|jd|dœ¡ d S )NZnode1r‚   rƒ   r„   r…   rp   r‡   r0   rˆ   )r‰   rŠ   r‹   rŒ   Znode1_str__r‰   rŠ   rt   )rá   ra   rb   r   r?   Úprintr@   rW   r   rA   rv   rB   r’   r“   r-   r-   r.   Ú*test_trimesh_edges_categorical_colormappedB  s    ÿ




z?TestBokehTriMeshPlot.test_trimesh_edges_categorical_colormappedc                 C   s¤   | j jtddtddgdd}t |¡}|jd }|jd }|jd	 }|  |t¡ |  |j	d
¡ |  |j
d¡ |  |jd t d
dg¡¡ |  |jd|dœ¡ d S )Nrà   r‚   rƒ   r„   r…   rp   r‡   r0   rˆ   r   r   rt   )râ   ra   rb   r   r?   r@   rW   r   rA   r}   r   rB   r   rC   r’   r•   r-   r-   r.   Ú*test_trimesh_nodes_numerically_colormappedP  s    ÿ



z?TestBokehTriMeshPlot.test_trimesh_nodes_numerically_colormappedc                 C   sŠ   ddg}g d¢}t |t|ddfƒjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd¡ |  |j	d
 t
 g d¢¡¡ d S )NrÌ   ©r   r™   rÆ   ))rL   rL   r   rš   )r   r   r   r›   )r   r   r™   rœ   )r   r   rÆ   r    r   r   rž   r/   rs   ru   rŸ   r    )rš   r›   rœ   r    ©r   r   r£   r   r?   r@   rA   rw   r’   rB   r   rC   ©r)   rS   r   rá   rF   r¥   r{   r-   r-   r.   Útest_trimesh_op_node_colora  s    


z/TestBokehTriMeshPlot.test_trimesh_op_node_colorc                 C   s²   ddg}g d¢}t |t|ddfƒjdd}t |¡}|jd }|jd }|jd	 }|  |jd
|dœ¡ |  |jd¡ |  |j	d
 t
 g d¢¡¡ |  |jd¡ |  |jd¡ d S )NrÌ   rì   ©)rL   rL   r   r™   )r   r   r   r   )r   r   r™   rÆ   ©r   r   rÆ   r³   r   r   rž   r/   rs   rª   rŸ   rt   r    )r™   r   rÆ   r³   r   r³   )r   r   r£   r   r?   r@   rA   rw   r’   rB   r   rC   r}   r   ©r)   rS   r   rá   rF   r¥   r{   rz   r-   r-   r.   Ú!test_trimesh_op_node_color_linearl  s    



z6TestBokehTriMeshPlot.test_trimesh_op_node_color_linearc                 C   s–   ddg}g d¢}t |t|ddfƒjdd}t |¡}|jd }|jd }|jd	 }|  |jd
|dœ¡ |  |jd¡ |  |j	d
 t
 g d¢¡¡ d S )NrÌ   rì   ))rL   rL   r   r®   )r   r   r   r¯   ©r   r   r™   r­   )r   r   rÆ   r®   r   r   rž   r/   rs   rª   rŸ   rt   r    )r®   r¯   r­   r®   rí   rò   r-   r-   r.   Ú&test_trimesh_op_node_color_categoricalz  s    



z;TestBokehTriMeshPlot.test_trimesh_op_node_color_categoricalc                 C   s|   ddg}g d¢}t |t|ddfƒjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd
 t	 
g d¢¡¡ d S )NrÌ   rì   ))rL   rL   r   rÆ   )r   r   r   r™   )r   r   r™   r   rñ   rµ   r   r¶   r/   rs   ru   r·   )rÆ   r™   r   r³   )r   r   r£   r   r?   r@   rA   rµ   rB   r   rC   rî   r-   r-   r.   Útest_trimesh_op_node_size†  s    


z.TestBokehTriMeshPlot.test_trimesh_op_node_sizec                 C   sŽ   ddg}g d¢}t |t|ddfƒjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd	d
i¡ |  |j	d
 t
 g d¢¡¡ d S )NrÌ   rì   ©)rL   rL   r   rº   )r   r   r   r»   )r   r   r™   r   )r   r   rÆ   rÓ   r¼   r   r½   r/   rs   ru   r¾   ©rº   r»   r   rÓ   )r   r   r£   r   r?   r@   rA   r¿   rÀ   rB   r   rC   rî   r-   r-   r.   Útest_trimesh_op_node_alpha  s    


z/TestBokehTriMeshPlot.test_trimesh_op_node_alphac                 C   s|   ddg}g d¢}t |t|ddfƒjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd
 t	 
g d¢¡¡ d S )NrÌ   rì   r÷   rÂ   r   rÃ   r/   rs   ru   rÄ   rø   )r   r   r£   r   r?   r@   rA   rÂ   rB   r   rC   rî   r-   r-   r.   Útest_trimesh_op_node_line_width›  s    


z4TestBokehTriMeshPlot.test_trimesh_op_node_line_widthc                 C   s¤   ddg}g d¢}t |t|ddfƒjdd}t |¡}|jd }|jd }|jd	 }|  |jd
|dœ¡ |  |jd
 t	 
ddg¡¡ |  |jd¡ |  |jd¡ d S )NrÌ   rì   rð   r   r   rÇ   r0   rˆ   rÎ   rÈ   rt   r™   gUUUUUU@r   r³   )r   r   r£   r   r?   r@   rA   r’   rB   r   rC   r}   r   rò   r-   r-   r.   Ú+test_trimesh_op_edge_color_linear_mean_node¥  s    



z@TestBokehTriMeshPlot.test_trimesh_op_edge_color_linear_mean_nodec                 C   sx   ddg}g d¢}t ||fddjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd
 t 	ddg¡¡ d S )N)r   r   r™   rš   )r   r™   rÆ   rœ   ©)rL   rL   r   )r   r   r   rÌ   )r   r   rÆ   r   r   rÇ   r0   rˆ   ru   rÈ   rš   rœ   )
r   r£   r   r?   r@   rA   r’   rB   r   rC   rî   r-   r-   r.   Útest_trimesh_op_edge_color²  s    


z/TestBokehTriMeshPlot.test_trimesh_op_edge_colorc                 C   s    ddg}g d¢}t ||fddjdd}t |¡}|jd }|jd }|jd	 }|  |jd
|dœ¡ |  |jd
 t 	ddg¡¡ |  |j
d¡ |  |jd¡ d S )N©r   r   r™   ç333333@©r   r™   rÆ   çÍÌÌÌÌÌ@rü   r   r   rÇ   r0   rˆ   rÎ   rÈ   rt   rÿ   r  )r   r£   r   r?   r@   rA   r’   rB   r   rC   r}   r   rò   r-   r-   r.   Ú!test_trimesh_op_edge_color_linear¼  s    



z6TestBokehTriMeshPlot.test_trimesh_op_edge_color_linearc                 C   s°   ddg}g d¢}t ||fddjddd}t |¡}|jd }|jd	 }|jd
 }|  |jd|dœ¡ |  |jd¡ |  |jd t	 
ddg¡¡ |  |jd¡ |  |jd¡ d S )Nrþ   r   rü   r   r   T)rÈ   rå   ræ   rç   rÎ   rÈ   rt   r    rÿ   r  )r   r£   r   r?   r@   rA   rw   r’   rB   r   rC   r}   r   rò   r-   r-   r.   Ú(test_trimesh_op_edge_color_linear_filledÉ  s    



z=TestBokehTriMeshPlot.test_trimesh_op_edge_color_linear_filledc                 C   s–   ddg}g d¢}t ||fddjdd}t |¡}|jd }|jd }|jd	 }|  |jd
|dœ¡ |  |jd
 t 	ddg¡¡ |  |j
ddg¡ d S )Nrô   )r   r™   rÆ   r®   rü   r   r   rÇ   r0   rˆ   rÎ   rÈ   rt   r­   r®   )r   r£   r   r?   r@   rA   r’   rB   r   rC   rv   rò   r-   r-   r.   Ú&test_trimesh_op_edge_color_categorical×  s    



z;TestBokehTriMeshPlot.test_trimesh_op_edge_color_categoricalc                 C   sx   ddg}g d¢}t ||fddjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd
 t 	ddg¡¡ d S )N)r   r   r™   çffffffæ?)r   r™   rÆ   rÓ   rü   r¼   r   rÔ   r0   rˆ   ru   rÕ   r  rÓ   )
r   r£   r   r?   r@   rA   rÀ   rB   r   rC   rî   r-   r-   r.   Útest_trimesh_op_edge_alphaã  s    


z/TestBokehTriMeshPlot.test_trimesh_op_edge_alphac                 C   sx   ddg}g d¢}t ||fddjdd}t |¡}|jd }|jd }|  |jd	d
i¡ |  |jd
 t 	ddg¡¡ d S )N)r   r   r™   é   )r   r™   rÆ   rÆ   rü   rÂ   r   rØ   r0   rˆ   ru   rÙ   r  rÆ   )
r   r£   r   r?   r@   rA   rÂ   rB   r   rC   rî   r-   r-   r.   Útest_trimesh_op_edge_line_widthí  s    


z4TestBokehTriMeshPlot.test_trimesh_op_edge_line_width)rÛ   rÜ   rÝ   r   rä   rè   rê   rë   rï   ró   rõ   rö   rù   rú   rû   rý   r  r  r  r  r  rÞ   r-   r-   r+   r.   rß   !  s$   



rß   c                       s\   e Zd Z‡ fdd„Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Z‡  ZS )ÚTestBokehChordPlotc                    s@   t t| ƒ ¡  g d¢| _tg d¢ddƒ| _t| j| jfƒ| _d S )N))r   r   r   )r   r™   r™   rì   ))r   r­   )r   r®   )r™   r¯   r2   r   )r   r	  r   rS   r   r   r   Úchordrã   r+   r-   r.   r   ú  s    
zTestBokehChordPlot.setUpc                 C   sF   t  | j¡}|jj}|jd }|jd }|  | |¡| |¡k ¡ d S )NrU   Zmulti_line_2_glyph_renderer)r   r?   r
  Ústater[   r@   Ú
assertTruer2   )r)   rF   r[   Úgraph_rendererZarc_rendererr-   r-   r.   Útest_chord_draw_order   s
    

z(TestBokehChordPlot.test_chord_draw_orderc                 C   sR   | j jdd}t |¡}|jj}|jd }|jd }|  | |¡| |¡k ¡ d S )Nr   ©ÚlabelsrU   Ztext_1_glyph_renderer)	r
  r£   r   r?   r  r[   r@   r  r2   )r)   ry   rF   r[   r  Zlabel_rendererr-   r-   r.   Útest_chord_label_draw_order  s    


z.TestBokehChordPlot.test_chord_label_draw_orderc                 C   sB   | j jtddd}t |¡}|jd }|  |jd g d¢¡ d S )Nr   )Úlabel_indexr`   Útext_1_sourceÚtextr°   ©r
  ra   rb   r   r?   r@   rA   rB   ©r)   ry   rF   r    r-   r-   r.   Útest_chord_nodes_label_text  s    

z.TestBokehChordPlot.test_chord_nodes_label_textc                 C   sB   | j jtddd}t |¡}|jd }|  |jd g d¢¡ d S )Nr   r  r`   r  r  r°   r  r  r-   r-   r.   Útest_chord_nodes_labels_mapping  s    

z2TestBokehChordPlot.test_chord_nodes_labels_mappingc                 C   sÔ   | j jtdddtg d¢dd}t |¡}|jd }|jd }|jd }|jd	 }|  |t¡ |  |j	g d
¢¡ |  |j
g d¢¡ |  |jd t g d
¢¡¡ |  |jd t g d
¢¡¡ |  |jd|dœ¡ d S )Nr   )rm   r  ©rƒ   z#888888r„   rn   rp   rr   r/   Úmulti_line_2_sourcers   r°   rt   )r
  ra   rb   r   r?   r@   rW   r   rA   rv   ÚpaletterB   r   rC   rw   )r)   ry   rF   rz   r    Ú
arc_sourcer{   r-   r-   r.   Ú*test_chord_nodes_categorically_colormapped  s    ÿ




z=TestBokehChordPlot.test_chord_nodes_categorically_colormappedc                 C   sò   | j jtddtdg d¢dd}t |¡}|jd }|jd }|jd }|jd	 }|jd
 }|  |t¡ |  |j	g d¢¡ |  |j
g d¢¡ |  |jd t g d¢¡¡ |  |jd t g d¢¡¡ |  |jd|dœ¡ |  |jd|dœ¡ d S )Nr   r  r  )rŸ   ro   rp   rª   r/   r  rs   Zmulti_line_2_glyphr°   rŸ   rt   )r
  ra   rb   r   r?   r@   rW   r   rA   rv   r  rB   r   rC   rw   r’   )r)   ry   rF   rz   r    r  r{   Z	arc_glyphr-   r-   r.   Ú1test_chord_nodes_style_map_node_color_colormapped*  s     ÿ





zDTestBokehChordPlot.test_chord_nodes_style_map_node_color_colormappedc                 C   s¦   | j jtddtddgdd}t |¡}|jd }|jd }|jd	 }|  |t¡ |  |j	g d
¢¡ |  |j
g d¢¡ |  |jd g d¢¡ |  |jd|dœ¡ d S )Nr3   r‚   rƒ   r„   r…   rp   r‡   r0   rˆ   ©rƒ   r„   rƒ   ©r‰   rŠ   r‹   r‘   ©r‰   r‰   rŠ   rt   )r
  ra   rb   r   r?   r@   rW   r   rA   r  rv   rB   r’   r•   r-   r-   r.   Ú*test_chord_edges_categorically_colormapped;  s    ÿ



z=TestBokehChordPlot.test_chord_edges_categorically_colormappedc                 C   s°   | j jttdƒ t¡ddgdd}t |¡}|jd }|jd }|jd }|  	|t
¡ |  |jg d	¢¡ |  |jg d
¢¡ |  |jd t g d¢¡¡ |  |jd|dœ¡ d S )Nr3   rƒ   r„   )rÈ   r†   )rq   rÎ   r0   rˆ   r  r   rÈ   r!  rt   )r
  ra   rb   r
   Zastyper6   r   r?   r@   rW   r   rA   r  rv   rB   r   rC   r’   r•   r-   r-   r.   Ú#test_chord_edge_color_style_mappingH  s    $



z6TestBokehChordPlot.test_chord_edge_color_style_mapping)rÛ   rÜ   rÝ   r   r  r  r  r  r  r  r"  r#  rÞ   r-   r-   r+   r.   r	  ø  s   r	  )Z
__future__r   Znumpyr   Zholoviews.core.datar   Zholoviews.elementr   r   r   r   r   r	   Zholoviews.util.transformr
   Zbokeh.modelsr   r   r   r   Zbokeh.models.mappersr   r   Ztestplotr   r   r   rß   r	  r-   r-   r-   r.   Ú<module>   s        X