
    e\                         d dl Zd dlZd dlZd dl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 d dl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)CategoricalColorMapperLinearColorMapper)HoloMap	NdOverlay)Cycle)ContoursPathPolygons)property_to_dict)PolyDraw)dim   )TestBokehPlotbokeh_rendererc                   V    e 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S )TestPathPlotc                 x   t          d          t          t          ddg                    d}t          d t          d	          D                                           |          }t          j        |          j        d
         }ddg}|                     |j	        d         j
        d         |           d S )Nr   legend_limitredbluevalues)
line_colorr   r	   c           	      d    i | ],t          fd t          d          D             g          -S )c                     g | ]}|fS  r   .0jis     Llib/python3.11/site-packages/holoviews/tests/plotting/bokeh/test_pathplot.py
<listcomp>zRTestPathPlot.test_batched_path_line_color_and_color.<locals>.<dictcomp>.<listcomp>       &@&@&@!1v&@&@&@       r	   ranger    r"   s    @r#   
<dictcomp>zGTestPathPlot.test_batched_path_line_color_and_color.<locals>.<dictcomp>   Q     0 0 0!" &@&@&@&@uQxx&@&@&@%A B B 0 0 0r&   r'   r   sourcer   dictr   r   r)   optsr   get_plotsubplotsassertEqualhandlesdata)selfr0   overlayplotr   s        r#   &test_batched_path_line_color_and_colorz3TestPathPlot.test_batched_path_line_color_and_color   s    !q111eV_(E(E(EFFFH H 0 0&+Ahh0 0 0 1 115d 	&w//8<V_
h/4\BJOOOOOr&   c                    t          d          t          t          ddg                    d}t          d t          d	          D                                           |          }t          j        |          j        d
         }ddg}ddg}|                     |j	        d         j
        d         |           |                     |j	        d         j
        d         |           d S )Nr   r         ?r   r   alphar   c           	      d    i | ],t          fd t          d          D             g          -S )c                     g | ]}|fS r   r   r   s     r#   r$   zMTestPathPlot.test_batched_path_alpha_and_color.<locals>.<dictcomp>.<listcomp>   r%   r&   r'   r(   r*   s    @r#   r+   zBTestPathPlot.test_batched_path_alpha_and_color.<locals>.<dictcomp>   r,   r&   r'   r         ?#30a2da#fc4f30r-   r=   colorr.   )r6   r0   r7   r8   r=   rC   s         r#   !test_batched_path_alpha_and_colorz.TestPathPlot.test_batched_path_alpha_and_color   s    !q1115a#9#9#9:::< < 0 0&+Ahh0 0 0 1 115d 	&w//8<b	I&h/4W=uEEEh/4W=uEEEEEr&   c                    t          d          t          t          ddg                    d}t          d t          d	          D                                           |          }t          j        |          j        d
         }ddg}ddg}|                     |j	        d         j
        d         |           |                     |j	        d         j
        d         |           d S )Nr   r   r;   r   r   
line_widthr   c           	      d    i | ],t          fd t          d          D             g          -S )c                     g | ]}|fS r   r   r   s     r#   r$   zRTestPathPlot.test_batched_path_line_width_and_color.<locals>.<dictcomp>.<listcomp>*   r%   r&   r'   r(   r*   s    @r#   r+   zGTestPathPlot.test_batched_path_line_width_and_color.<locals>.<dictcomp>*   r,   r&   r'   r   r@   rA   rB   r-   rG   rC   r.   )r6   r0   r7   r8   rG   rC   s         r#   &test_batched_path_line_width_and_colorz3TestPathPlot.test_batched_path_line_width_and_color'   s    !q111c1X(>(>(>???A A 0 0&+Ahh0 0 0 1 115d 	&w//8<2Y
I&h/4\BJOOOh/4W=uEEEEEr&   c                     t          d t          d          D             dg          }ddgiddid	}|                    |          }|                     |d
g           d S )Nc           	      l    i | ]1}|t          t          j                            d d          g          2S )
   r'   )r	   nprandomrandr*   s     r#   r+   z8TestPathPlot.test_path_overlay_hover.<locals>.<dictcomp>3   s5    KKKQD")..A"6"6!788KKKr&      Testkdimstoolshoverr   r   )r	   r   rR   z@{Test}r   r)   r0   _test_hover_infor6   objr0   s      r#   test_path_overlay_hoverz$TestPathPlot.test_path_overlay_hover2   s    KK%((KKK%h( ( ( 7),,a02 2hhtnnc$7#899999r&   c           	      ,   g d}|d d d         }g d}g d}||||d}t          |gddg                              dd	g
          }t          j        |          }|j        d         }|                     |j        d         t          j        ddg          t          j        ddg          t          j        ddg          g           |                     |j        d         t          j        ddg          t          j        ddg          t          j        ddg          g           |                     |j        d         t          j        g d                     |                     |j        d         t          j        g d                     d S )Nr   r'         r         ?r;   g      ?ABCDxyrC   otherrC   rl   vdimsrV   )color_indexrU   r-   xsr   r'   r_   r`   ysre   rf   rg   )r   rc   r;   	r	   r0   r   r1   r4   r3   r5   rN   array	r6   rp   rq   rC   rl   r5   pathr8   r-   s	            r#   ,test_path_colored_and_split_with_extra_vdimsz9TestPathPlot.test_path_colored_and_split_with_extra_vdims:   s   \\"X$$$$$$b55AATF77"344499y : 
 
 &t,,h'T*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccT*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccW-rx/H/HIIIW-rx/G/GHHHHHr&   c           	      L   g d}|d d d         }g d}g d}||||d}t          |gddg                              t          d          d	z  d
g          }t          j        |          }|j        d         }|                     |j        d         t          j	        dd	g          t          j	        d	dg          t          j	        ddg          g           |                     |j        d         t          j	        ddg          t          j	        dd	g          t          j	        d	dg          g           |                     |j        d         t          j	        g d                     |                     |j        d         t          j	        g d                     d S )Nr^   ra   rb   rd   ri   rC   rl   rm   r'   rV   )rC   rU   r-   rp   r   r_   r`   rq   rr   )r   r;   r   )
r	   r0   r   r   r1   r4   r3   r5   rN   rt   ru   s	            r#   ,test_path_colored_dim_split_with_extra_vdimsz9TestPathPlot.test_path_colored_dim_split_with_extra_vdimsK   s   \\"X$$$$$$b55AATF77"344499g,,q.	 : 
 
 &t,,h'T*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccT*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccW-rx/H/HIIIW-rx/D/DEEEEEr&   c           	      X   g d}|d d d         }g d}t          j        t          j        ddd                    }||||d}g d}g d	}t	          |gd
dg                              d
||dg          }t          j        |          }	|	j        d         }
|	j        d         }| 	                    |
j
        d         t          j        ddg          t          j        ddg          t          j        ddg          g           | 	                    |
j
        d         t          j        ddg          t          j        ddg          t          j        ddg          g           | 	                    |
j
        d
         t          j        g d                     | 	                    |
j
        d         t          j        |gdz                       | 	                    |j        d           | 	                    |j        d           | 	                    |j        |dd                     d S )Nr^   ra   )    r{   r{        r   rj   rk   rC   dater   &   I   _   n         r|   z#5ebaffz#00faf4z#ffffccz#ffe775z#ffc140z#ff8f20z#ff6060rC   r   rm   rV   )ro   color_levelscmaprU   r-   color_mapperrp   r'   r_   r`   rq   r{   r|   r{   r{   r|   rN   
datetime64dtdatetimer	   r0   r   r1   r4   r3   r5   rt   lowhighpaletter6   rp   rq   rC   r   r5   levelscolorsrv   r8   r-   cmappers               r#   (test_path_colored_by_levels_single_valuez5TestPathPlot.test_path_colored_by_levels_single_value\   s    \\"X$$$}R[q!4455b5$??444^^^TF7F"344499f6' : T T&t,,h',~.T*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccT*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccW-rx/H/HIIIV,bhvax.@.@AAAc***s+++&+66666r&   c           	      X   g d}|d d d         }g d}t          j        t          j        ddd                    }||||d}g d}g d	}t	          |gd
dg                              d
||dg          }t          j        |          }	|	j        d         }
|	j        d         }| 	                    |
j
        d         t          j        ddg          t          j        ddg          t          j        ddg          g           | 	                    |
j
        d         t          j        ddg          t          j        ddg          t          j        ddg          g           | 	                    |
j
        d
         t          j        g d                     | 	                    |
j
        d         t          j        |gdz                       | 	                    |j        d           | 	                    |j        d           | 	                    |j        |dd                     d S )Nr^   ra   )r{   r|   r{     r}   r~   r   r   r   r   rC   r   rm   rV   )rC   r   r   rU   r-   color_color_mapperrp   r'   r_   r`   rq   r   r   r|   r   r   s               r#   'test_path_continuously_varying_color_opz4TestPathPlot.test_path_continuously_varying_color_opr   s!   \\"X$$$}R[q!4455b5$??444^^^TF7F"344499VG9 : N N&t,,h',34T*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccT*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccW-rx/H/HIIIV,bhvax.@.@AAAc***s+++&+66666r&   c           	         g d}|d d d         }g d}|||d}t          |gd                              d          }t          j        |          }|j        d         }|                     |j        d	         t          j        d
dg          t          j        ddg          t          j        ddg          g           |                     |j        d         t          j        ddg          t          j        ddg          t          j        dd
g          g           |                     |j        d         t          j        g d                     d S )Nr^   ra   )皙?ffffff?333333?g?)rj   rk   r=   r=   rm   r<   r-   rp   r   r'   r_   r`   rq   )r   r   r   rs   )r6   rp   rq   r=   r5   rv   r8   r-   s           r#   'test_path_continuously_varying_alpha_opz4TestPathPlot.test_path_continuously_varying_alpha_op   sL   \\"X$$$b511TF'***//g/>>&t,,h'T*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccT*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccW-rx/H/HIIIIIr&   c           	         g d}|d d d         }g d}|||d}t          |gd                              d          }t          j        |          }|j        d         }|                     |j        d	         t          j        d
dg          t          j        ddg          t          j        ddg          g           |                     |j        d         t          j        ddg          t          j        ddg          t          j        dd
g          g           |                     |j        d         t          j        g d                     d S )Nr^   ra   )r      r_   r'   )rj   rk   rG   rG   rm   rF   r-   rp   r   r'   r_   r`   rq   )r   r   r_   rs   )r6   rp   rq   rG   r5   rv   r8   r-   s           r#   ,test_path_continuously_varying_line_width_opz9TestPathPlot.test_path_continuously_varying_line_width_op   sJ   \\"X!\\
b
;;TF,///444MM&t,,h'T*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bcccT*RXq!f-=-=rxA?O?OQSQY[\^_Z`QaQa,bccc\2BHYYY4G4GHHHHHr&   c           	         g dg dg dd}g d}g d}t          |d                              dt          t          ||                    dd	
          }t	          j        |          }|j        j        d         j        d         }ddi}| 	                    t          |j                  |           | 	                    |j        |j        d         g           d S )N	r   r'   r_   r`   rQ      r   r~   	   	r   r   r'   r   r   r'   r   r   r'   rj   rk   catz#FF0000z#00FF00z#0000FFr   r   r'   r_   r   rm   r`   T)rC   r   rG   show_legendr   fieldcolor_str__glyph_renderer)r	   r0   r/   zipr   r1   statelegenditemsr3   r   label	renderersr4   )r6   r5   r   r   rv   r8   itemr   s           r#   +test_path_continuously_varying_color_legendz8TestPathPlot.test_path_continuously_varying_color_legend   s    $$$&&&&&&
 
 322yyD&&&++%d3vvCVCV>W>Wdesw+xx&t,,z #)!,=))$*55v>>>$,7G*H)IJJJJJr&   c           
      &   g dg dg dd}g d}g d}t          |d                              dt          t          ||                    dd	d
ddd          }t	          j        |          }|j        d         }|j        j        d         j	        d         }ddi}| 
                    |j        d         g d           | 
                    t          |j                  |           | 
                    |j        |j        d         g           d S )Nr   r   r   r   r   r   rm   r`   Tre   rf   rg   )r   r   r'   )rC   r   rG   r   legend_labelscdsr   r   _color_str___labels)re   rf   rg   re   rf   rg   re   rf   r   )r	   r0   r/   r   r   r1   r4   r   r   r   r3   r5   r   r   r   )	r6   r5   r   r   rv   r8   r   r   r   s	            r#   7test_path_continuously_varying_color_legend_with_labelszDTestPathPlot.test_path_continuously_varying_color_legend_with_labels   sR   $$$&&&&&&
 
 322yyD&&&++%d3vvCVCV>W>Wdesw  LO  TW  \_  H`  H`+  a  a&t,,l5!z #)!,01"78:b:b:bccc)$*55v>>>$,7G*H)IJJJJJr&   N)__name__
__module____qualname__r9   rD   rJ   r\   rw   ry   r   r   r   r   r   r   r   r&   r#   r   r      s        P P P	F 	F 	F	F 	F 	F: : :I I I"F F F"7 7 7,7 7 7,
J 
J 
J
I 
I 
IK K K"K K K K Kr&   r   c                   h    e 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S )TestPolygonPlotc                     t          d t          d          D             dg          }ddgiddid	}|                    |          }|                     |d
dg           d S )Nc           	      x    i | ]7}|t          t          j                            d d          ddgdg          8S )rM   r'   r   )rj   rk   zr   rm   )r
   rN   rO   rP   r*   s     r#   r+   z?TestPolygonPlot.test_polygons_overlay_hover.<locals>.<dictcomp>   sV     , , , H29>>"Q3G3Ga&P&P%QZ]Y^___ , , ,r&   rQ   rR   rS   rU   rV   r   r   )r
   r   rW   )r   z@{z}rX   rZ   s      r#   test_polygons_overlay_hoverz+TestPolygonPlot.test_polygons_overlay_hover   s     , ,"'((, , ,4:8= = =$wi0,a02 2hhtnnc$7#GHHHHHr&   c                    t          d t          d          D                       }t          j        |          }t	          |j                                                  D ]\  }}|j        d         }|                     |j	        d           |                     |j
        d           |j        d         }|                     |j        d         t          j        |g                     d S )Nc           	      h    i | ].t          fd t          d          D             gd          /S )c                      g | ]
}|z  |fS r   r   r    r"   r!   s     r#   r$   zDTestPolygonPlot.test_polygons_colored.<locals>.<dictcomp>.<listcomp>   #    +L+L+LQQT1aL+L+L+Lr&   rM   Valuerm   r
   r)   r    r!   s    @r#   r+   z9TestPolygonPlot.test_polygons_colored.<locals>.<dictcomp>   W     1 1 1"#  +L+L+L+L%))+L+L+L*MU\!]!]!] 1 1 1r&   rQ   r   r   r`   r-   r   )r   r)   r   r1   	enumerater2   r   r4   r3   r   r   r5   rN   rt   )r6   polygonsr8   r"   splotr   r-   s          r#   test_polygons_coloredz%TestPolygonPlot.test_polygons_colored   s     1 1',Qxx1 1 1 2 2&x00!$-"6"6"8"899 	B 	BHAumN3GW[!,,,W\1---]8,FV[128QC==AAAA	B 	Br&   c                 r   t          d t          d          D                                           d          }t          t	          t          j        |          j                                                            }|j	        d         }| 
                    |j        d           | 
                    |j        d           |j	        d         }| 
                    |j	        d         j        d	         |           | 
                    |j        d
         t          t          d                               d S )Nc           	      h    i | ].t          fd t          d          D             gd          /S )c                      g | ]
}|z  |fS r   r   r   s     r#   r$   zLTestPolygonPlot.test_polygons_colored_batched.<locals>.<dictcomp>.<listcomp>   r   r&   rM   r   rm   r   r   s    @r#   r+   zATestPolygonPlot.test_polygons_colored_batched.<locals>.<dictcomp>   r   r&   rQ   r   r   r   r`   r-   glyph	transformr   )r   r)   r0   nextiterr   r1   r2   r   r4   r3   r   r   
fill_colorr5   listr6   r   r8   r   r-   s        r#   test_polygons_colored_batchedz-TestPolygonPlot.test_polygons_colored_batched   s    1 1',Qxx1 1 1 2 226$A$2F2F 	D0::CJJLLMMNN,~.a(((q)))h'g.9+FPPPW-tE!HH~~>>>>>r&   c                    t          d t          d          D                                           d          }t          t	          t          j        |          j                                                            }|j	        d         }| 
                    |j        d           | 
                    |j        d           |j	        d         }| 
                    |j        d         d	 t          d          D                        d S )
Nc           	      h    i | ].t          fd t          d          D             dg          /S )c                 F    g | ]}fd t          d          D             S )c                      g | ]
}|z  |fS r   r   r   s     r#   r$   zcTestPolygonPlot.test_polygons_colored_batched_unsanitized.<locals>.<dictcomp>.<listcomp>.<listcomp>   r   r&   rM   )r)   r   s     r#   r$   zXTestPolygonPlot.test_polygons_colored_batched_unsanitized.<locals>.<dictcomp>.<listcomp>   s5    *_*_*_QR+L+L+L+L%))+L+L+L*_*_*_r&   r'   zsome ? unescaped namerm   r   r   s    @r#   r+   zMTestPolygonPlot.test_polygons_colored_batched_unsanitized.<locals>.<dictcomp>   sd     1 1 1"#  *_*_*_*_V[\]V^V^*_*_*_1H0I"K "K "K 1 1 1r&   rQ   r   r   r   r`   r-   !some_question_mark_unescaped_namec                      g | ]}||fD ]}|S r   r   r   s      r#   r$   zMTestPolygonPlot.test_polygons_colored_batched_unsanitized.<locals>.<listcomp>   s)    >>>1v>>!!>>>>r&   )r   r)   r0   r   r   r   r1   r2   r   r4   r3   r   r   r5   r   s        r#   )test_polygons_colored_batched_unsanitizedz9TestPolygonPlot.test_polygons_colored_batched_unsanitized   s    1 1',Qxx1 1 1 2 226$A$2F2F 	 D0::CJJLLMMNN,~.a(((q)))h'%HI>>U1XX>>>	@ 	@ 	@ 	@ 	@r&   c                    t          g dg          }t          j        |          }|j        d         }|                     t          |j        d                   d           |                     t          |j        d                   d           |                     t          |j        d                   d           d S N	Intensityrm   r-   rp   r   rq   )r
   r   r1   r4   r3   lenr5   )r6   polyr8   r-   s       r#   test_empty_polygons_plotz(TestPolygonPlot.test_empty_polygons_plot   s    ;-000&t,,h'V[.//333V[.//333V[566:::::r&   c           	         g d}g d}g dg dgg}t          |||dg          }t          j        |          }|j        d         }|                     |j        d         t          j        g d          t          j        g d	          t          j        g d
          ggg           |                     |j        d         t          j        g d          t          j        g d          t          j        g d          ggg           d S )N)r   r'   r_   )r'   r   r   )      ?r'   )r'   r_   )皙?r   ) @      @)      @rQ   )ffffff@      @rj   rk   holesr-   rp   r   r'   r_   r   r   r'   r   r   r   r   r   r   rq   r'   r   r   r'   r'   r_   r   r'   r   rQ   r   r   )r
   r   r1   r4   r3   r5   rN   rt   r6   rp   rq   r   r   r8   r-   s          r#   test_polygon_with_hole_plotz+TestPolygonPlot.test_polygon_with_hole_plot   sJ   YYYY0002T2T2TUVrU;;<==&t,,h'T*rx/E/ErxPbPbPbGcGc.0h7K7K7K.L.L/N .O -P 	Q 	Q 	QT*rx/E/ErxP^P^P^G_G_.0h7I7I7I.J.J/L .M -N 	O 	O 	O 	O 	Or&   c           	         dddt           j        dddg}dddt           j        dddg}g dg d	gg g}t          |||d
g          }t          j        |          }|j        d         }|                     |j        d         t          j        g d          t          j        g d          t          j        g d          gt          j        g d          ggg           |                     |j        d         t          j        g d          t          j        g d          t          j        g d          gt          j        g d          ggg           d S )Nr   r'   r_   r   r   r   rQ   r   r   r   r-   rp   r   r   r   )r_   r   r   r_   rq   r   r   r   )r'   rQ   r   r'   )	rN   nanr
   r   r1   r4   r3   r5   rt   r   s          r#   test_multi_polygon_hole_plotz,TestPolygonPlot.test_multi_polygon_hole_plot  s   Arvq!Q'Arvq!Q'+++-O-O-OP
 rU;;<==&t,,h'T*rx/E/ErxPbPbPbGcGc/1x8L8L8L/M/M/OQSQYZfZfZfQgQgPh.j -k 	l 	l 	lT*rx/E/ErxP^P^P^G_G_/1x8J8J8J/K/K/MOQxXdXdXdOeOeNf.h -i 	j 	j 	j 	j 	jr&   c                 &   t          g dddg dddgd                              ddg	          }t          j        |          }|j        d
         }|j        d         }|                     |j        d           |                     t          |j                  ddi           |                     |j	        d         t          j        ddg                     |                     |j	        d         t          j        ddg                     d S )N)r   r   r   r   r   r   greenr   rC   r  )r   r   r  r   rC   rm   rV   )r   rU   r-   r   blackr   r   r
   r0   r   r1   r4   r3   r   r   r   r5   rN   rt   r6   r   r8   r   r   s        r#   test_polygons_hover_color_opz,TestPolygonPlot.test_polygons_hover_color_op  s"   111GDD111EBB
    $''$CC 	 &x00l8$W%)7333)%*:;;g|=TUUU'*BHgu5E,F,FGGG,/7E:J1K1KLLLLLr&   c                    t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|                     |j        d           |                     t          |j                  ddi           |                     |j	        d         t          j        ddg                     d S )Nr  r	  r
  r  r   rC   rm   rC   r-   r   r  r   r  r  s        r#   test_polygons_color_opz&TestPolygonPlot.test_polygons_color_op!  s    111GDD111EBB
    $W$-- 	 &x00l8$W%)7333)%*:;;gw=OPPP'*BHgu5E,F,FGGGGGr&   c                 v   t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|j        d         }|                     |j        d           |                     t          |j                  d|d           |                     |j	        d         t          j        ddg                     |                     |t                     |                     |j        d           |                     |j        d           d S )Nr  r   r
  r  r_   rC   rm   r  r-   r   r   r  r   r   )r
   r0   r   r1   r4   r3   r   r   r   r5   rN   rt   assertIsInstancer   r   r   r6   r   r8   r   r   r   s         r#   test_polygons_linear_color_opz-TestPolygonPlot.test_polygons_linear_color_op-  sI   111A>>111A>>
    $W$-- 	 &x00l8$W%,34)7333)%*:;;w]d=e=efff'*BHaV,<,<===g'8999a(((q)))))r&   c                 D   t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|j        d         }|                     |j        d           |                     t          |j                  d|d           |                     |j	        d         t          j        ddg                     |                     |t                     |                     |j        ddg           d S )Nr  br
  r  arC   rm   r  r-   r   r   r  r  )r
   r0   r   r1   r4   r3   r   r   r   r5   rN   rt   r  r   factorsr  s         r#   "test_polygons_categorical_color_opz2TestPolygonPlot.test_polygons_categorical_color_op=  s5   111C@@111C@@
    $W$-- 	 &x00l8$W%,34)7333)%*:;;w]d=e=efff'*BHc3Z,@,@AAAg'=>>>3*55555r&   c                    t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|                     t          |j                  ddi           |                     t          |j                  ddi           |                     |j	        d         t          j        ddg                     d S Nr  r   )r   r=   r  r   r=   rm   r<   r-   r   r   )r
   r0   r   r1   r4   r3   r   
line_alpha
fill_alphar5   rN   rt   r  s        r#   test_polygons_alpha_opz&TestPolygonPlot.test_polygons_alpha_opL  s    111C@@111C@@
    $W$-- 	 &x00l8$W%)%*:;;gw=OPPP)%*:;;gw=OPPP'*BHc3Z,@,@AAAAAr&   c                    t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|                     t          |j                  ddi           |                     |j        d         t          j
        ddg                     d S Nr  r   )r   rG   r  r_   rG   rm   rF   r-   r   r   )r
   r0   r   r1   r4   r3   r   rG   r5   rN   rt   r  s        r#   test_polygons_line_width_opz+TestPolygonPlot.test_polygons_line_width_opX      111CC111CC
     $t|t<< 	 &x00l8$W%)%*:;;g|=TUUU,/1a&1A1ABBBBBr&   c                 ~   ddl m} dddt          j        dddg}dddt          j        dddg}g d	g d
gg g}t	          t          |||dg          t          ||dg          d          }t          j        |          }|j        d         }| 	                    |j
                   |                     ||           d S )Nr   )MultiPolygonsr   r'   r_   r   r   rQ   r   r   r   r   r  r   )bokeh.modelsr'  rN   r  r   r
   r   r1   r4   
assertTrue
_has_holesr  )r6   r'  rp   rq   r   r   r8   r   s           r#   test_polygons_holes_initializez.TestPolygonPlot.test_polygons_holes_initializec  s    ......Arvq!Q'Arvq!Q'+++-O-O-OP
 82B%G%G$HII#2B%7%7$899; ; < <&t,,W%(((e]33333r&   c                    ddl m} dddt          j        dddg}dddt          j        dddg}g d	g d
gg g}t	          t          |||dg          t          ||dg          d          }t          |           t          j        |          }|j	        d         }| 
                    |j                   |                     ||           d S )Nr   )Patchesr   r'   r_   r   r   rQ   r   r   r   r   r  )r-   r   )r(  r-  rN   r  r   r
   r   r   r1   r4   assertFalser*  r  )r6   r-  rp   rq   r   r   r8   r   s           r#   %test_polygons_no_holes_with_draw_toolz5TestPolygonPlot.test_polygons_no_holes_with_draw_toolr  s   ((((((Arvq!Q'Arvq!Q'+++-O-O-OP
 82B%G%G$HII#2B%7%7$899; ; < <&t,,W%)))eW-----r&   N)r   r   r   r   r   r   r   r   r  r  r  r  r  r  r!  r$  r+  r/  r   r&   r#   r   r      s       I I I	B 	B 	B	? 	? 	?
@ 
@ 
@; ; ;
O 
O 
Oj j jM M M
H 
H 
H* * * 6 6 6
B 
B 
B	C 	C 	C4 4 4. . . . .r&   r   c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )
TestContoursPlotc                    t          g dg          }t          j        |          }|j        d         }|                     t          |j        d                   d           |                     t          |j        d                   d           |                     t          |j        d                   d           d S r   )r   r   r1   r4   r3   r   r5   )r6   contoursr8   r-   s       r#   test_empty_contours_plotz)TestContoursPlot.test_empty_contours_plot  s    B{m444&x00h'V[.//333V[.//333V[566:::::r&   c                    t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|                     t          |j                  ddi           |                     |j        d         t          j
        ddg                     d S )Nr  r	  r
  r  r   rC   rm   r  r-   r   r   )r   r0   r   r1   r4   r3   r   r   r5   rN   rt   r6   r3  r8   r   r   s        r#   test_contours_color_opz'TestContoursPlot.test_contours_color_op  s    111GDD111EBB
    $W$-- 	 &x00l8$W%)%*:;;gw=OPPP'*BHgu5E,F,FGGGGGr&   c                 @   t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|j        d         }|                     t          |j                  d|d           |                     |j        d         t          j
        ddg                     |                     |t                     |                     |j        d           |                     |j        d           d S )Nr  r   r
  r  r_   rC   rm   r  r-   r   r   r  )r   r0   r   r1   r4   r3   r   r   r5   rN   rt   r  r   r   r   r6   r3  r8   r   r   r   s         r#   test_contours_linear_color_opz.TestContoursPlot.test_contours_linear_color_op  s0   111A>>111A>>
    $W$-- 	 &x00l8$W%,34)%*:;;w]d=e=efff'*BHaV,<,<===g'8999a(((q)))))r&   c           
         t          t          j        g g d          t          j        t          j                            d          t          j                            d          dgdz  dgdz  dg d          gddg                              dd	          }t          j        |          }|j	        d
         }| 
                    |j        d           | 
                    |j        d           d S )N)rj   rk   rC   rG   )columnsrM   r   r_   rC   rG   rm   )rC   rG   r   )r   pd	DataFramerN   rO   rP   r0   r   r1   r4   r3   r   rG   )r6   r3  r8   r   s       r#   test_contours_empty_pathz)TestContoursPlot.test_contours_empty_path  s   L%F%F%FGGGLry~~b11	r8J8J$)72:aSVE E!B!B!BD D D

 <(* * *
 +/$l +/ +4 +4 	 &x00W%)5111)1-----r&   c           	         t          t          g dddg dddgd          t          g dddg dd	dgd          d
                              dd          }t          j        |          }|j        d         }|j        d         }|j        d         }|                    d           |                     t          |j	                  d|d           |                     |j
        d         t          j        ddg                     |                     |j        d           |                     |j        d           |                    d           |                     |j
        d         t          j        dd	g                     |                     |j        d	           |                     |j        d           d S )Nr  r   r
  r  r_   rC   rm   rQ   r'   r  T)rC   	framewiser-   r   r   )r   r  )r   )r   r   r0   r   r1   r4   updater3   r   r   r5   rN   rt   r   r   r9  s         r#   $test_contours_linear_color_op_updatez5TestContoursPlot.test_contours_linear_color_op_update  s   555BB555BB    555BB555BB         !%7d C C 	 &x00l8$W%,34D)%*:;;w]d=e=efff'*BHaV,<,<===a(((q)))D'*BHaV,<,<===a(((q)))))r&   c                    t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|j        d         }|                     t          |j                  d|d           |                     |j        d         t          j
        ddg                     |                     |t                     |                     |j        ddg           d S )Nr  r  r
  r  r  rC   rm   r  r-   r   r   r  )r   r0   r   r1   r4   r3   r   r   r5   rN   rt   r  r   r  r9  s         r#   "test_contours_categorical_color_opz3TestContoursPlot.test_contours_categorical_color_op  s   111C@@111C@@
    $W$-- 	 &x00l8$W%,34)%*:;;w]d=e=efff'*BHc3Z,@,@AAAg'=>>>3*55555r&   c                    t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|                     t          |j                  ddi           |                     |j        d         t          j
        ddg                     d S r  )r   r0   r   r1   r4   r3   r   r  r5   rN   rt   r6  s        r#   test_contours_alpha_opz'TestContoursPlot.test_contours_alpha_op  s    111C@@111C@@
    $W$-- 	 &x00l8$W%)%*:;;gw=OPPP'*BHc3Z,@,@AAAAAr&   c                    t          g dddg dddgd                              d          }t          j        |          }|j        d	         }|j        d
         }|                     t          |j                  ddi           |                     |j        d         t          j
        ddg                     d S r#  )r   r0   r   r1   r4   r3   r   rG   r5   rN   rt   r6  s        r#   test_contours_line_width_opz,TestContoursPlot.test_contours_line_width_op  r%  r&   N)r   r   r   r4  r7  r:  r?  rC  rE  rG  rI  r   r&   r#   r1  r1    s        ; ; ;	H 	H 	H* * *. . .* * *06 6 6	B 	B 	B	C 	C 	C 	C 	Cr&   r1  )r   r   numpyrN   pandasr=  r(  r   r   holoviews.corer   r   holoviews.core.optionsr   holoviews.elementr   r	   r
   holoviews.plotting.bokeh.utilr   holoviews.streamsr   holoviews.util.transformr   	test_plotr   r   r   r   r1  r   r&   r#   <module>rS     s               B B B B B B B B - - - - - - - - ( ( ( ( ( ( 6 6 6 6 6 6 6 6 6 6 : : : : : : & & & & & & ( ( ( ( ( ( 4 4 4 4 4 4 4 4qK qK qK qK qK= qK qK qKh{. {. {. {. {.m {. {. {.~lC lC lC lC lC} lC lC lC lC lCr&   