Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 2, 2019
1 parent 10515f7 commit 5a400f9
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion holoviews/tests/plotting/bokeh/testannotationplot.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 5a400f9

Please sign in to comment.