From 5a400f9b0e23f55a35a2af70d2c11d606a11ee06 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Wed, 2 Oct 2019 20:49:25 +0200 Subject: [PATCH] Add tests --- .../plotting/bokeh/testannotationplot.py | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/holoviews/tests/plotting/bokeh/testannotationplot.py b/holoviews/tests/plotting/bokeh/testannotationplot.py index 347bb83e5a..4685a26774 100644 --- a/holoviews/tests/plotting/bokeh/testannotationplot.py +++ b/holoviews/tests/plotting/bokeh/testannotationplot.py @@ -1,6 +1,8 @@ import numpy as np -from holoviews.element import HLine, VLine, Text, Labels, Arrow, HSpan, VSpan +from holoviews.element import ( + HLine, VLine, Text, Labels, Arrow, HSpan, VSpan, Slope +) from .testplot import TestBokehPlot, bokeh_renderer @@ -76,6 +78,25 @@ def test_vspan_plot(self): self.assertEqual(span.top, None) + +class TestSlopePlot(TestBokehPlot): + + def test_slope(self): + hspan = Slope(2, 10) + plot = bokeh_renderer.get_plot(hspan) + slope = plot.handles['glyph'] + self.assertEqual(slope.gradient, 2) + self.assertEqual(slope.y_intercept, 10) + + def test_slope_invert_axes(self): + hspan = Slope(2, 10).opts(invert_axes=True) + plot = bokeh_renderer.get_plot(hspan) + slope = plot.handles['glyph'] + self.assertEqual(slope.gradient, 0.5) + self.assertEqual(slope.y_intercept, -5) + + + class TestTextPlot(TestBokehPlot): def test_text_plot(self):