Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Sep 3, 2020
1 parent 4ebe06e commit 0d7dc57
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion holoviews/tests/plotting/bokeh/testpathplot.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import datetime as dt

import numpy as np

from holoviews.core import NdOverlay, HoloMap
from holoviews.core.options import Cycle
from holoviews.element import Path, Polygons, Contours
from holoviews.streams import PolyDraw
from holoviews.util.transform import dim

from .testplot import TestBokehPlot, bokeh_renderer

Expand Down Expand Up @@ -71,6 +73,21 @@ def test_path_colored_and_split_with_extra_vdims(self):
self.assertEqual(source.data['other'], np.array(['A', 'B', 'C']))
self.assertEqual(source.data['color'], np.array([0, 0.25, 0.5]))

def test_path_colored_dim_split_with_extra_vdims(self):
xs = [1, 2, 3, 4]
ys = xs[::-1]
color = [0, 0.25, 0.5, 0.75]
other = ['A', 'B', 'C', 'D']
data = {'x': xs, 'y': ys, 'color': color, 'other': other}
path = Path([data], vdims=['color','other']).options(color=dim('color')*2, tools=['hover'])
plot = bokeh_renderer.get_plot(path)
source = plot.handles['source']

self.assertEqual(source.data['xs'], [np.array([1, 2]), np.array([2, 3]), np.array([3, 4])])
self.assertEqual(source.data['ys'], [np.array([4, 3]), np.array([3, 2]), np.array([2, 1])])
self.assertEqual(source.data['other'], np.array(['A', 'B', 'C']))
self.assertEqual(source.data['color'], np.array([0, 0.5, 1]))

def test_path_colored_by_levels_single_value(self):
xs = [1, 2, 3, 4]
ys = xs[::-1]
Expand Down Expand Up @@ -114,7 +131,7 @@ def test_path_continuously_varying_color_op(self):
self.assertEqual(cmapper.low, 994)
self.assertEqual(cmapper.high, 999)
self.assertEqual(cmapper.palette, colors[-1:])

def test_path_continuously_varying_alpha_op(self):
xs = [1, 2, 3, 4]
ys = xs[::-1]
Expand Down

0 comments on commit 0d7dc57

Please sign in to comment.