Skip to content

Commit

Permalink
Add unit tests for bokeh legends and OverlayPlot updates
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Feb 25, 2017
1 parent 624c647 commit 80cf477
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testplotinstantiation.py
Expand Up @@ -228,6 +228,22 @@ def teardown(self):
Callback._comm_type = comms.JupyterCommJS
mpl_renderer.comms['default'] = self.default_comm

def test_overlay_legend(self):
overlay = Curve(range(10), label='A') * Curve(range(10), label='B')
plot = bokeh_renderer.get_plot(overlay)
legend_labels = [l.label['value'] for l in plot.state.legend[0].items]
self.assertEqual(legend_labels, ['A', 'B'])

def test_overlay_update_sources(self):
hmap = HoloMap({i: (Curve(np.arange(i), label='A') *
Curve(np.arange(i)*2, label='B'))
for i in range(10, 13)})
plot = bokeh_renderer.get_plot(hmap)
plot.update((12,))
subplot1, subplot2 = plot.subplots.values()
self.assertEqual(subplot1.handles['source'].data['y'], np.arange(12))
self.assertEqual(subplot2.handles['source'].data['y'], np.arange(12)*2)

def test_batched_plot(self):
overlay = NdOverlay({i: Points(np.arange(i)) for i in range(1, 100)})
plot = bokeh_renderer.get_plot(overlay)
Expand Down

0 comments on commit 80cf477

Please sign in to comment.