
    eY}                         d dl Zd dlmZmZmZmZ d dlmZm	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 d dlmZ dd	lmZmZ  G d
 de          Z G d de          Z G d de          ZdS )    N)EdgesAndLinkedNodesNodesAndLinkedEdges	NodesOnlyPatches)CategoricalColorMapperLinearColorMapper)Dataset)ChordGraphNodesTriMeshVLinecircular_layout)property_to_dict)dim   )TestBokehPlotbokeh_rendererc                        e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z xZS )TestBokehGraphPlotc                 6   t                                                       d}t          t          j        |t          j                            | _        t          j        |t          j                  | _        t          j        |t          j                  | _	        t          j
                            |          | _        t          | j        | j	        ff          | _        t          dgdg|dz
  z  z   dg          | _        t          | j        d          | _        t          | j        | j	        f| j        f          | _        t          | j        | j	        f| j        f          | _        t          | j        | j	        | j        ffd          | _        d S )	N   )dtypeOutputInputr   LabelvdimsWeight)supersetUpr   nparangeint32nodessourcezerostargetrandomrandweightsr   graphr	   	node_info
node_info2graph2graph3graph4)selfN	__class__s     Mlib/python3.11/site-packages/holoviews/tests/plotting/bokeh/test_graphplot.pyr!   zTestBokehGraphPlot.setUp   s<   $RYq%A%A%ABB
i222hq111y~~a((T[$+6899
 (WIqsO!;G9MMM!$,h???dk4;7HIIdk4;7IJJdk4;EGxXXX    c                    t          j        | j                  }|j        d         }|j        d         }|j        d         }|                     |j        d         | j                   |                     |j        d         | j                   |                     |j        d         | j                   d | j        j        	                                D             }|                     |j
        |           d S )Nscatter_1_sourcemulti_line_1_sourcelayout_sourceindexstartendc                      i | ]\  }}}|||fS  r?   .0xyzs       r5   
<dictcomp>z=TestBokehGraphPlot.test_plot_simple_graph.<locals>.<dictcomp>&   $    DDD1a!aVDDDr6   )r   get_plotr,   handlesassertEqualdatar&   r(   r%   arraygraph_layoutr2   plotnode_sourceedge_sourcer:   layouts         r5   test_plot_simple_graphz)TestBokehGraphPlot.test_plot_simple_graph   s    &tz22l#56l#89_5)'2DK@@@)'2DK@@@)%0$+>>>DD4:+;+A+A+C+CDDD3V<<<<<r6   c                 d   t          j        t          d          | j        z            }|j        d         }|j        d         }|                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           d S )Nr   x_ranger   )r   rG   r   r,   rH   rI   r<   r=   )r2   rN   rT   y_ranges       r5   "test_plot_graph_annotation_overlayz5TestBokehGraphPlot.test_plot_graph_annotation_overlay*   s    &uQxx$*'<==,y),y)+++a(((+++a(((((r6   c                 :   | j                             | j         j        | j         j        | j         j        f          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     |j        d         | j	                   |                     |j        d         | j	                   |                     |j        d         | j
                   |j                                        }|                     |j        d         d |D                        |                     |j        d	         d
 |D                        d | j         j                                        D             }|                     |j        |           d S )Nr8   r9   r:   r;   r<   r=   xsc                 8    g | ]}|                     d           S )r   dimension_valuesrA   paths     r5   
<listcomp>zATestBokehGraphPlot.test_plot_graph_with_paths.<locals>.<listcomp>=   &    1]1]1]t$2G2G2J2J1]1]1]r6   ysc                 8    g | ]}|                     d           S )r   r[   r]   s     r5   r_   zATestBokehGraphPlot.test_plot_graph_with_paths.<locals>.<listcomp>>   r`   r6   c                      i | ]\  }}}|||fS r?   r?   r@   s       r5   rE   zATestBokehGraphPlot.test_plot_graph_with_paths.<locals>.<dictcomp>?   rF   r6   )r,   clonerJ   r%   	edgepathsr   rG   rH   rI   r&   r(   splitrK   rL   )r2   r,   rN   rO   rP   r:   edgesrQ   s           r5   test_plot_graph_with_pathsz-TestBokehGraphPlot.test_plot_graph_with_paths3   st   
  $*/4:3CTZEY!Z[[&u--l#56l#89_5)'2DK@@@)'2DK@@@)%0$+>>>%%'')$/1]1]W\1]1]1]^^^)$/1]1]W\1]1]1]^^^DD4:+;+A+A+C+CDDD3V<<<<<r6   c                    t          j        | j                  }|j        d         }|j        d         }|                     |j        t                     |                     |j        dg           | 	                    ||j
                   d S )Nglyph_rendererhover)r;   z@{index_hover})r   rG   r,   rH   assertIsInstanceinspection_policyr   rI   tooltipsassertIn	renderersr2   rN   rendererrk   s       r5   "test_graph_inspection_policy_nodesz5TestBokehGraphPlot.test_graph_inspection_policy_nodesB   s    &tz22< 01W%h8:MNNN*E)FGGGh00000r6   c                 D   t          j        | j                            d                    }|j        d         }|j        d         }|                     |j        t                     |                     |j	        ddg           | 
                    ||j                   d S )Nrg   rm   rj   rk   )r<   z@{start_values})r=   z@{end_values})r   rG   r,   optsrH   rl   rm   r   rI   rn   ro   rp   rq   s       r5   "test_graph_inspection_policy_edgesz5TestBokehGraphPlot.test_graph_inspection_policy_edgesJ   s    &tz'Q'QRR< 01W%h8:MNNN*FH`)abbbh00000r6   c                 r   | j                             dd          }t          j        |                    d                    }|j        d         }|j        d         }|                     |j        t                     | 	                    |j
        dd	g           |                     ||j                   d S )
Nr&   r(   )r<   r=   rg   ru   rj   rk   )r&   z	@{source})r(   z	@{target})r,   redimr   rG   rv   rH   rl   rm   r   rI   rn   ro   rp   )r2   r,   rN   rr   rk   s        r5   4test_graph_inspection_policy_edges_non_default_nameszGTestBokehGraphPlot.test_graph_inspection_policy_edges_non_default_namesR   s    
  xX >>&uzzGz'L'LMM< 01W%h8:MNNN*ACZ)[\\\h00000r6   c                     t          j        | j                            d                     }|j        d         }|                     |j        t                     d S )Nru   rj   )r   rG   r,   rv   rH   rl   rm   r   r2   rN   rr   s      r5   !test_graph_inspection_policy_nonez4TestBokehGraphPlot.test_graph_inspection_policy_none[   sN    &tz'N'NOO< 01h8)DDDDDr6   c                     t          j        | j                  }|j        d         }|j        d         }|                     |j        t                     |                     ||j                   d S )Nrj   rk   )	r   rG   r,   rH   rl   selection_policyr   ro   rp   rq   s       r5   !test_graph_selection_policy_nodesz4TestBokehGraphPlot.test_graph_selection_policy_nodes`   sc    &tz22< 01W%h79LMMMh00000r6   c                 
   t          j        | j                            d                    }|j        d         }|j        d         }|                     |j        t                     |                     ||j	                   d S )Nrg   r   rj   rk   )
r   rG   r,   rv   rH   rl   r   r   ro   rp   rq   s       r5   !test_graph_selection_policy_edgesz4TestBokehGraphPlot.test_graph_selection_policy_edgesg   sq    &tz'P'PQQ< 01W%h79LMMMh00000r6   c                     t          j        | j                            d                     }|j        d         }|                     |j        t                     d S )Nr   rj   )r   rG   r,   rv   rH   rl   r   r   r|   s      r5    test_graph_selection_policy_nonez3TestBokehGraphPlot.test_graph_selection_policy_nonen   sN    &tz'M'MNN< 01h7CCCCCr6   c                    | j                             dd          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     |t                     |                     |j        ddg           |                     |j	        d         | j
        d                    |                     t          |j                  d|d	           d S )
Nr   Set1color_indexcmapcolor_mapperr8   scatter_1_glyphr   r   field	transform)r/   rv   r   rG   rH   rl   r   rI   factorsrJ   r-   r   
fill_colorr2   grN   cmapperrO   glyphs         r5   (test_graph_nodes_categorical_colormappedz;TestBokehGraphPlot.test_graph_nodes_categorical_colormappeds   s    Kv>>&q)),~.l#56./g'=>>>8W*=>>>)'2DN74KLLL)%*:;;w]d=e=efffffr6   c                 `   | j                             dd          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     |t                     |                     |j        | j	        
                                           |                     |j        | j	                                                   |                     |j        d         | j        d                    |                     t          |j                  d|d           d S )Nr   viridisr   r   r8   r   r   )r0   rv   r   rG   rH   rl   r   rI   lowr+   minhighmaxrJ   r.   r   r   r   s         r5   (test_graph_nodes_numerically_colormappedz;TestBokehGraphPlot.test_graph_nodes_numerically_colormapped~   s   K	BB&q)),~.l#56./g'8999dl&6&6&8&8999t|'7'7'9'9:::)(3T_X5NOOO)%*:;;x^e=f=fgggggr6   c                    | j                             dddg          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     |t                     g d}|                     |j        |           |                     |j	        d	         |           |                     t          |j                  d	|d
           d S )Nr<   #FFFFFF#000000edge_color_index	edge_cmapedge_colormapperr9   multi_line_1_glyph)01234567start_str__r   )r0   rv   r   rG   rH   rl   r   rI   r   rJ   r   
line_colorr2   r   rN   r   rP   r   r   s          r5   (test_graph_edges_categorical_colormappedz;TestBokehGraphPlot.test_graph_edges_categorical_colormapped   s    Kg)YAWXX&q)),12l#8912g'=>>>:::'222)-8'BBB)%*:;;}cj=k=klllllr6   c                 d   | j                             dddg          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     |t                     |                     |j        | j	        
                                           |                     |j        | j	                                                   |                     |j        d         | j        d                    |                     t          |j                  d|d           d S )	Nr   r   r   r   r   r9   r   r   )r1   rv   r   rG   rH   rl   r   rI   r   r+   r   r   r   rJ   r.   r   r   r2   r   rN   r   rP   r   s         r5   (test_graph_edges_numerically_colormappedz;TestBokehGraphPlot.test_graph_edges_numerically_colormapped   s   Kh9iBXYY&q)),12l#8912g'8999dl&6&6&8&8999t|'7'7'9'9:::)(3T_X5NOOO)%*:;;x^e=f=fgggggr6   c                    ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     |j	        d           |                     |j
        d
         t          j        g d                     d S )Nr   r   r      ))r   r   r   red)r   r   r   green)r   r   r   bluecolorr   
node_colorr8   r   r   r   blackr   r   r   r   r   rv   r   rG   rH   rI   r   r   r   rJ   r"   rK   r2   rg   r%   r,   rN   cdsr   s          r5   test_graph_op_node_colorz+TestBokehGraphPlot.test_graph_op_node_color   s     OOO#% % %uen%%**g*>>&u--l-../)%*:;;g|=TUUU)7333,/:R:R:R1S1STTTTTr6   c                    ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|j        d         }|j        d	         }|                     t          |j                  d
|d           |                     |j	        d           |                     |j
        d
         t          j        g d                     d S )Nr   r   )r   r   r         ?)r   r   r         ?)r   r   r         @r   r   r   r8   r   node_color_color_mapperr   r   r   )r   r   r   r   r2   rg   r%   r,   rN   r   r   r   s           r5   test_graph_op_node_color_linearz2TestBokehGraphPlot.test_graph_op_node_color_linear        FFF#% % %uen%%**g*>>&u--l-../,89)%*:;;|bi=j=jkkk)7333,////1J1JKKKKKr6   c                     ddg}t          g dd          }t          ||f                              dd          }t          j        |          }d|j        v sJ |j        d         j        |j        d	         u sJ d S )
Nr   r   r   r   r   T)r   colorbarnode_color_colorbarr   )r   r   rv   r   rG   rH   r   )r2   rg   r%   r,   rN   s        r5   !test_graph_op_node_color_colorbarz4TestBokehGraphPlot.test_graph_op_node_color_colorbar   s     FFF#% % %uen%%**g*MM&u--$4444|12?4<PiCjjjjjjjr6   c                    ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|j        d         }|j        d	         }|                     t          |j                  d
|d           |                     |j	        d           |                     |j
        d
         t          j        g d                     d S )Nr   r   ))r   r   r   A)r   r   r   B)r   r   r   Cr   r   r   r8   r   r   r   r   r   r   r   r   r   r   s           r5   $test_graph_op_node_color_categoricalz7TestBokehGraphPlot.test_graph_op_node_color_categorical   r   r6   c                    ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     |j	        d
         t          j        g d                     d S )Nr   r   )r   r   r   r   )r   r   r      )r   r   r      sizer   	node_sizer8   r   r   r   r   r   r   )r   r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r   s          r5   test_graph_op_node_sizez*TestBokehGraphPlot.test_graph_op_node_size   s     @@@"$ $ $uen%%**V*<<&u--l-../)%*557MNNN+.0C0CDDDDDr6   c                    ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     t          |j	                  d	d
i           |                     |j
        d
         t          j        g d                     d S )Nr   r   ))r   r   r   皙?)r   r   r   333333?)r   r   r   r   alphar   
node_alphar8   r   r   r   )r   r   r   )r   r   rv   r   rG   rH   rI   r   
fill_alpha
line_alpharJ   r"   rK   r   s          r5   test_graph_op_node_alphaz+TestBokehGraphPlot.test_graph_op_node_alpha   s     DDDGTTTuen%%**g*>>&u--l-../)%*:;;g|=TUUU)%*:;;g|=TUUU,/---1H1HIIIIIr6   c                    ddg}t          g dd          }t          ||f                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     |j	        d
         t          j        g d                     d S )Nr   r   r   
line_widthr   node_line_widthr8   r   r   r   r   )r   r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r   s          r5   test_graph_op_node_line_widthz0TestBokehGraphPlot.test_graph_op_node_line_width   s     @@@UUUuen%%**<*HH&u--l-../)%*:;;gGX=YZZZ"34bhyyy6I6IJJJJJr6   c                 r   g d}t          |d                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  ddi           |                     |j        d         t          j
        g d	                     d S )
N))r   r   r   )r   r   r   )r      r   r   r   
edge_colorr9   r   r   r   r   r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r2   rg   r,   rN   r   r   s         r5   test_graph_op_edge_colorz+TestBokehGraphPlot.test_graph_op_edge_color   s    @@@e7+++00G0DD&u--l0112)%*:;;g|=TUUU,/:R:R:R1S1STTTTTr6   c                    g d}t          |d                              d          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     t          |j                  d|d	           |                     |j        d         t          j
        g d
                     d S )Nr   r   r   r   r   r   )r   r   r   r   r   r   r9   r   edge_color_color_mapperr   r   )r   r   r   r   r2   rg   r,   rN   r   r   r   s          r5   test_graph_op_edge_color_linearz2TestBokehGraphPlot.test_graph_op_edge_color_linear   s    333e7+++00G0DD&u--l0112,89)%*:;;|bi=j=jkkk,/+++1F1FGGGGGr6   c                     g d}t          |d                              dd          }t          j        |          }d|j        v sJ |j        d         j        |j        d         u sJ d S )Nr   r   r   T)r   r   edge_color_colorbarr   )r   rv   r   rG   rH   r   )r2   rg   r,   rN   s       r5   !test_graph_op_edge_color_colorbarz4TestBokehGraphPlot.test_graph_op_edge_color_colorbar  s    333e7+++00Gd0SS&u--$4444|12?4<PiCjjjjjjjr6   c                    g d}t          |d                              d          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     t          |j                  d|d	           |                     |j        d         t          j
        g d
                     d S )N))r   r   r   )r   r   r   )r   r   r   r   r   r   r9   r   r   r   r   )r   r   r   r   r   s          r5   $test_graph_op_edge_color_categoricalz7TestBokehGraphPlot.test_graph_op_edge_color_categorical  s    777e7+++00G0DD&u--l0112,89)%*:;;|bi=j=jkkk,////1J1JKKKKKr6   c                 r   g d}t          |d                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  ddi           |                     |j        d         t          j
        g d	                     d S )
N))r   r   皙?r   )r   r   333333?r   r   
edge_alphar9   r   r   r  )r  r   r  )r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r   s         r5   test_graph_op_edge_alphaz+TestBokehGraphPlot.test_graph_op_edge_alpha  s    777e7+++00G0DD&u--l0112)%*:;;g|=TUUU,////1J1JKKKKKr6   c                 r   g d}t          |d                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  ddi           |                     |j        d         t          j
        g d	                     d S )
N)r   )r   r   
   )r   r   r   r   r   edge_line_widthr9   r   r   r  )r   r	  r   )r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r   s         r5   test_graph_op_edge_line_widthz0TestBokehGraphPlot.test_graph_op_edge_line_width"  s    222e<00055l5SS&u--l0112)%*:;;gGX=YZZZ"34bhzzz6J6JKKKKKr6   ) __name__
__module____qualname__r!   rR   rW   rh   rs   rw   rz   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  __classcell__r4   s   @r5   r   r      s       Y Y Y Y Y
= 
= 
=) ) )= = =1 1 11 1 11 1 1E E E
1 1 11 1 1D D D
	g 	g 	g
h 
h 
h
m 
m 
m
h 
h 
h 
U 
U 
UL L Lk k kL L L	E 	E 	E	J 	J 	JK K KU U UH H Hk k kL L LL L LL L L L L L Lr6   r   c                        e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Z xZS )TestBokehTriMeshPlotc                     t                                                       g d| _        ddg| _        t	          | j        | j        f          | _        t	          | j        | j        f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%   	simplicesr   trimeshtrimesh_weightedr2   r4   s    r5   r!   zTestBokehTriMeshPlot.setUp.  si    FFF
&5
;<< '(DH U U Ur6   c                 @   t          j        | j                  }|j        d         }|j        d         }|j        d         }|                     |j        d         t          j        d                     |                     |j        d         t          j        d                     |                     |j        d         t          j        d	d
                     d | j        j        	                                D             }|                     |j
        |           d S )Nr8   r9   r:   r;   r   r<   r   r=   r   r   c                      i | ]\  }}}|||fS r?   r?   r@   s       r5   rE   zATestBokehTriMeshPlot.test_plot_simple_trimesh.<locals>.<dictcomp>>  $    FFF1a!aVFFFr6   )r   rG   r  rH   rI   rJ   r"   r#   r%   rK   rL   rM   s         r5   test_plot_simple_trimeshz-TestBokehTriMeshPlot.test_plot_simple_trimesh6  s    &t|44l#56l#89_5)'2BIaLLAAA)'2BIaLLAAA)%0")Aq//BBBFF4<+=+C+C+E+EFFF3V<<<<<r6   c                    t          j        | j                            d                    }|j        d         }|j        d         }|j        d         }|                     |j        d         t                     |                     |j        d         t          j
        d                     |                     |j        d	         t          j
        d
                     |                     |j        d         t          j
        dd                     d | j        j                                        D             }|                     |j        |           d S )NT)filledr8   patches_1_sourcer:   patches_1_glyphr;   r   r<   r   r=   r   r   c                      i | ]\  }}}|||fS r?   r?   r@   s       r5   rE   zHTestBokehTriMeshPlot.test_plot_simple_trimesh_filled.<locals>.<dictcomp>J  r  r6   )r   rG   r  rv   rH   rl   r   rI   rJ   r"   r#   r%   rK   rL   rM   s         r5   test_plot_simple_trimesh_filledz4TestBokehTriMeshPlot.test_plot_simple_trimesh_filledA  s    &t|'8'8'8'E'EFFl#56l#56_5dl+<=wGGG)'2BIaLLAAA)'2BIaLLAAA)%0")Aq//BBBFF4<+=+C+C+E+EFFF3V<<<<<r6   c                    | j                             dddg          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     |t                     g d}|                     |j        |           |                     |j	        d	         d
dg           |                     t          |j                  d	|d           d S )Nnode1r   r   r   r   r9   r   )r   r   r   r   node1_str__r   r   r   )r  rv   r   rG   rH   rl   r   rI   r   rJ   r   r   r   s          r5   *test_trimesh_edges_categorical_colormappedz?TestBokehTriMeshPlot.test_trimesh_edges_categorical_colormappedM  s    L$I0F  
 
 &q)),12l#8912g'=>>>&&&'222)-83*EEE)%*:;;}cj=k=klllllr6   c                    | j                             dddg          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     |t                     |                     |j        d           |                     |j	        d	           |                     |j
        d         t          j        dd	g                     |                     t          |j                  d|d
           d S )Nr  r   r   r   r   r9   r   r   r   r   )r  rv   r   rG   rH   rl   r   rI   r   r   rJ   r"   rK   r   r   r   s         r5   *test_trimesh_nodes_numerically_colormappedz?TestBokehTriMeshPlot.test_trimesh_nodes_numerically_colormapped[  s   !&&%)Y1G ' 
 
 &q)),12l#8912g'8999a(((q))))(3RXq!f5E5EFFF)%*:;;x^e=f=fgggggr6   c                    ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     |j	        d           |                     |j
        d
         t          j        g d                     d S )Nr   r   r   r   ))rU   rU   r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   r   r   r   r8   r   r   r   r   )r   r   r   r   r   r   rv   r   rG   rH   rI   r   r   r   rJ   r"   rK   r2   rg   r%   r  rN   r   r   s          r5   test_trimesh_op_node_colorz/TestBokehTriMeshPlot.test_trimesh_op_node_colorm  s    I&___5%W"="="=>??DDPWDXX&w//l-../)%*:;;g|=TUUU)7333,/:[:[:[1\1\]]]]]r6   c                 V   ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|j        d         }|j        d	         }|                     t          |j                  d
|d           |                     |j	        d           |                     |j
        d
         t          j        g d                     |                     |j        d           |                     |j        d           d S )Nr   r+  )rU   rU   r   r   )r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r8   r   r   r   r   r   )r   r   r   r   r   r   )r   r   rv   r   rG   rH   rI   r   r   r   rJ   r"   rK   r   r   r2   rg   r%   r  rN   r   r   r   s           r5   !test_trimesh_op_node_color_linearz6TestBokehTriMeshPlot.test_trimesh_op_node_color_linearx  s$   I&JJJ5%W"="="=>??DDPWDXX&w//l-../,89)%*:;;|bi=j=jkkk)7333,/,,,1G1GHHHa(((q)))))r6   c                    ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|j        d         }|j        d	         }|                     t          |j                  d
|d           |                     |j	        d           |                     |j
        d
         t          j        g d                     d S )Nr   r+  ))rU   rU   r   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r8   r   r   r   r   r   )r   r   r   r   r,  r2  s           r5   &test_trimesh_op_node_color_categoricalz;TestBokehTriMeshPlot.test_trimesh_op_node_color_categorical  s    I&RRR5%W"="="=>??DDPWDXX&w//l-../,89)%*:;;|bi=j=jkkk)7333,/:N:N:N1O1OPPPPPr6   c                    ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     |j	        d
         t          j        g d                     d S )Nr   r+  ))rU   rU   r   r   )r   r   r   r   )r   r   r   r   r1  r   r   r   r8   r   r   r   )r   r   r   r   )r   r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r-  s          r5   test_trimesh_op_node_sizez.TestBokehTriMeshPlot.test_trimesh_op_node_size  s    I&JJJ5%V"<"<"<=>>CCfCUU&w//l-../)%*557MNNN+.0F0FGGGGGr6   c                    ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     t          |j	                  d	d
i           |                     |j
        d
         t          j        g d                     d S )Nr   r+  )rU   rU   r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r  r   r   r   r8   r   r   r   r   r   r   r  )r   r   rv   r   rG   rH   rI   r   r   r   rJ   r"   rK   r-  s          r5   test_trimesh_op_node_alphaz/TestBokehTriMeshPlot.test_trimesh_op_node_alpha  s    I&PPP5%W"="="=>??DDPWDXX&w//l-../)%*:;;g|=TUUU)%*:;;g|=TUUU,/:L:L:L1M1MNNNNNr6   c                    ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     |j	        d
         t          j        g d                     d S )Nr   r+  r:  r   r   r   r8   r   r   r   r;  )r   r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r-  s          r5   test_trimesh_op_node_line_widthz4TestBokehTriMeshPlot.test_trimesh_op_node_line_width  s    I&PPP5%\"B"B"BCDDIIZfIgg&w//l-../)%*:;;gGX=YZZZ"34bh?Q?Q?Q6R6RSSSSSr6   c                     ddg}g d}t          |t          |d          f                              d          }t          j        |          }|j        d         }|j        d         }|j        d	         }|                     t          |j                  d
|d           |                     |j	        d
         t          j        ddg                     |                     |j        d           |                     |j        d           d S )Nr   r+  r0  r   r   r   r9   r   r   r   r   r   gUUUUUU@r   r   )r   r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r   r   r2  s           r5   +test_trimesh_op_edge_color_linear_mean_nodez@TestBokehTriMeshPlot.test_trimesh_op_edge_color_linear_mean_node  s   I&JJJ5%W"="="=>??DDPWDXX&w//l0112,89)%*:;;|bi=j=jkkk,/1d)1D1DEEEa(((q)))))r6   c                 ~   ddg}g d}t          ||fd                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     |j        d
         t          j
        ddg                     d S )N)r   r   r   r   )r   r   r   r   )rU   rU   r   )r   r   r   r   )r   r   r   r   r   r   r9   r   r   r   r   r   )r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r-  s          r5   test_trimesh_op_edge_colorz/TestBokehTriMeshPlot.test_trimesh_op_edge_color  s    !#45>>>5%.888===QQ&w//l0112)%*:;;g|=TUUU,/5&/1J1JKKKKKr6   c                    ddg}g d}t          ||fd                              d          }t          j        |          }|j        d         }|j        d         }|j        d	         }|                     t          |j                  d
|d           |                     |j        d
         t          j
        ddg                     |                     |j        d           |                     |j        d           d S )Nr   r   r   333333@r   r   r   @rB  r   r   r   r9   r   r   r   r   rF  rH  )r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r   r   r2  s           r5   !test_trimesh_op_edge_color_linearz6TestBokehTriMeshPlot.test_trimesh_op_edge_color_linear  s   0>>>5%.888===QQ&w//l0112,89)%*:;;|bi=j=jkkk,/3*1E1EFFFc***s+++++r6   c                 >   ddg}g d}t          ||fd                              dd          }t          j        |          }|j        d         }|j        d	         }|j        d
         }|                     t          |j                  d|d           |                     |j        d           |                     |j	        d         t          j        ddg                     |                     |j        d           |                     |j        d           d S )NrE  rG  rB  r   r   T)r   r  r   r!  r   r   r   r   rF  rH  )r   rv   r   rG   rH   rI   r   r   r   rJ   r"   rK   r   r   r2  s           r5   (test_trimesh_op_edge_color_linear_filledz=TestBokehTriMeshPlot.test_trimesh_op_edge_color_linear_filled  s   0>>>5%.888==Y]=^^&w//l-../,89)%*:;;|bi=j=jkkk)7333,/3*1E1EFFFc***s+++++r6   c                    ddg}g d}t          ||fd                              d          }t          j        |          }|j        d         }|j        d         }|j        d	         }|                     t          |j                  d
|d           |                     |j        d
         t          j
        ddg                     |                     |j        ddg           d S )Nr5  )r   r   r   r   rB  r   r   r   r9   r   r   r   r   r   r   )r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r   r2  s           r5   &test_trimesh_op_edge_color_categoricalz;TestBokehTriMeshPlot.test_trimesh_op_edge_color_categorical  s    0>>>5%.888===QQ&w//l0112,89)%*:;;|bi=j=jkkk,/3*1E1EFFF3*55555r6   c                 ~   ddg}g d}t          ||fd                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     |j        d
         t          j
        ddg                     d S )N)r   r   r   ffffff?)r   r   r   r  rB  r   r   r  r9   r   r   r  rO  r  )r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r-  s          r5   test_trimesh_op_edge_alphaz/TestBokehTriMeshPlot.test_trimesh_op_edge_alpha  s    0>>>5%.888===QQ&w//l0112)%*:;;g|=TUUU,/3*1E1EFFFFFr6   c                 ~   ddg}g d}t          ||fd                              d          }t          j        |          }|j        d         }|j        d         }|                     t          |j                  d	d
i           |                     |j        d
         t          j
        ddg                     d S )N)r   r   r      )r   r   r   r   rB  r   r   r
  r9   r   r   r  rR  r   )r   rv   r   rG   rH   rI   r   r   rJ   r"   rK   r-  s          r5   test_trimesh_op_edge_line_widthz4TestBokehTriMeshPlot.test_trimesh_op_edge_line_width  s    |,>>>5%.===BBS_B``&w//l0112)%*:;;gGX=YZZZ"34bh1v6F6FGGGGGr6   )r  r  r  r!   r  r#  r'  r)  r.  r3  r6  r8  r<  r>  r@  rC  rI  rK  rM  rP  rS  r  r  s   @r5   r  r  ,  s^       V V V V V	= 	= 	=
= 
= 
=m m mh h h$	^ 	^ 	^* * *
Q 
Q 
QH H H	O 	O 	OT T T* * *L L L, , ,, , ,
6 
6 
6G G GH H H H H H Hr6   r  c                   N     e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Z xZS )
TestBokehChordPlotc                     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   r;   r   )r    r!   rg   r	   r%   r
   chordr  s    r5   r!   zTestBokehChordPlot.setUp  sW    666
;;;WgNN
DJ
344


r6   c                    t          j        | j                  }|j        j        }|j        d         }|j        d         }|                     |                    |          |                    |          k                d S )Nrj   multi_line_2_glyph_renderer)r   rG   rW  staterp   rH   
assertTruer;   )r2   rN   rp   graph_rendererarc_renderers        r5   test_chord_draw_orderz(TestBokehChordPlot.test_chord_draw_order  sm    &tz22J(	&67|$AB	55ioon6U6UUVVVVVr6   c                 .   | j                             d          }t          j        |          }|j        j        }|j        d         }|j        d         }|                     |                    |          |                    |          k                d S )Nr   labelsrj   text_1_glyph_renderer)	rW  rv   r   rG   rZ  rp   rH   r[  r;   )r2   r   rN   rp   r\  label_renderers         r5   test_chord_label_draw_orderz.TestBokehChordPlot.test_chord_label_draw_order  s    JOO7O++&q))J(	&67&=>	77	8W8WWXXXXXr6   c                     | j                             d          }t          j        |          }|j        d         }|                     |j        d         g d           d S )Nr   )label_indextext_1_sourcetextr   rW  rv   r   rG   rH   rI   rJ   r2   r   rN   r&   s       r5   test_chord_nodes_label_textz.TestBokehChordPlot.test_chord_nodes_label_text  sZ    JOOO00&q))o.V,ooo>>>>>r6   c                     | j                             d          }t          j        |          }|j        d         }|                     |j        d         g d           d S )Nr   r`  rg  rh  r   ri  rj  s       r5   test_chord_nodes_labels_mappingz2TestBokehChordPlot.test_chord_nodes_labels_mapping!  sZ    JOO7O++&q))o.V,ooo>>>>>r6   c                    | j                             ddg d          }t          j        |          }|j        d         }|j        d         }|j        d         }|j        d         }|                     |t                     |                     |j        g d           |                     |j	        g d           |                     |j
        d         t          j        g d                     |                     |j
        d         t          j        g d                     |                     t          |j                  d|d	           d S )
Nr   r   z#888888r   )r   rf  r   r   r8   multi_line_2_sourcer   r   r   )rW  rv   r   rG   rH   rl   r   rI   r   paletterJ   r"   rK   r   r   )r2   r   rN   r   r&   
arc_sourcer   s          r5   *test_chord_nodes_categorically_colormappedz=TestBokehChordPlot.test_chord_nodes_categorically_colormapped'  sH   JOOW;\;\;\  
 
 &q)),~.01\"78
./g'=>>>///:::*K*K*KLLLW-rx/H/HIII128OOO3L3LMMM)%*:;;w]d=e=efffffr6   c                    | j                             ddg d          }t          j        |          }|j        d         }|j        d         }|j        d         }|j        d         }|j        d         }|                     |t                     |                     |j        g d	           |                     |j	        g d           |                     |j
        d         t          j        g d	                     |                     |j
        d         t          j        g d	                     |                     t          |j                  d
|d           |                     t          |j                  d
|d           d S )Nr   ro  )ra  r   r   r   r8   rp  r   multi_line_2_glyphr   r   r   )rW  rv   r   rG   rH   rl   r   rI   r   rq  rJ   r"   rK   r   r   r   )r2   r   rN   r   r&   rr  r   	arc_glyphs           r5   1test_chord_nodes_style_map_node_color_colormappedzDTestBokehChordPlot.test_chord_nodes_style_map_node_color_colormapped7  s   JOOw5V5V5V  
 
 &q)),8901\"78
./L!56	g'=>>>///:::*K*K*KLLLW-rx/H/HIII128OOO3L3LMMM)%*:;;|bi=j=jkkk))*>??<fmAnAnooooor6   c                    | j                             dddg          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     |t                     |                     |j        g d           |                     |j	        g d	           |                     |j
        d
         g d           |                     t          |j                  d
|d           d S )Nr<   r   r   r   r   r9   r   r   r   r   r   r   r   r   r   r   r   r   )rW  rv   r   rG   rH   rl   r   rI   rq  r   rJ   r   r   r   s         r5   *test_chord_edges_categorically_colormappedz=TestBokehChordPlot.test_chord_edges_categorically_colormappedI  s   JOO$I0F  
 
 &q)),12l#8912g'=>>>*K*K*KLLL///:::)-8///JJJ)%*:;;}cj=k=klllllr6   c                 l   | j                             t          d                              t                    ddg          }t          j        |          }|j        d         }|j        d         }|j        d         }|                     |t                     | 
                    |j        g d           | 
                    |j        g d	           | 
                    |j        d
         t          j        g d                     | 
                    t!          |j                  d
|d           d S )Nr<   r   r   )r   r   r   r9   r   ry  rz  r   r{  r   )rW  rv   r   astypestrr   rG   rH   rl   r   rI   rq  r   rJ   r"   rK   r   r   r   s         r5   #test_chord_edge_color_style_mappingz6TestBokehChordPlot.test_chord_edge_color_style_mappingW  s"   JOO7||**3//Iy;Q  
 
 &q)),89l#8912g'=>>>*K*K*KLLL///:::),7///9R9RSSS)%*:;;|bi=j=jkkkkkr6   )r  r  r  r!   r^  rd  rk  rm  rs  rw  r|  r  r  r  s   @r5   rU  rU    s        5 5 5 5 5W W WY Y Y? ? ?? ? ?g g g p p p$m m ml l l l l l lr6   rU  )numpyr"   bokeh.modelsr   r   r   r   bokeh.models.mappersr   r   holoviews.core.datar	   holoviews.elementr
   r   r   r   r   r   holoviews.plotting.bokeh.utilr   holoviews.util.transformr   	test_plotr   r   r   r  rU  r?   r6   r5   <module>r     s       U U U U U U U U U U U U J J J J J J J J ' ' ' ' ' ' R R R R R R R R R R R R R R R R : : : : : : ( ( ( ( ( ( 4 4 4 4 4 4 4 4\L \L \L \L \L \L \L \L~UH UH UH UH UH= UH UH UHp_l _l _l _l _l _l _l _l _l _lr6   