/
testannotationplot.py
49 lines (38 loc) · 1.62 KB
/
testannotationplot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from holoviews.element import HLine, VLine, Text
from .testplot import TestBokehPlot, bokeh_renderer
class TestHVLinePlot(TestBokehPlot):
def test_hline_invert_axes(self):
hline = HLine(1.1).opts(plot=dict(invert_axes=True))
plot = bokeh_renderer.get_plot(hline)
span = plot.handles['glyph']
self.assertEqual(span.dimension, 'height')
self.assertEqual(span.location, 1.1)
def test_hline_plot(self):
hline = HLine(1.1)
plot = bokeh_renderer.get_plot(hline)
span = plot.handles['glyph']
self.assertEqual(span.dimension, 'width')
self.assertEqual(span.location, 1.1)
def test_vline_invert_axes(self):
vline = VLine(1.1).opts(plot=dict(invert_axes=True))
plot = bokeh_renderer.get_plot(vline)
span = plot.handles['glyph']
self.assertEqual(span.dimension, 'width')
self.assertEqual(span.location, 1.1)
def test_vline_plot(self):
vline = VLine(1.1)
plot = bokeh_renderer.get_plot(vline)
span = plot.handles['glyph']
self.assertEqual(span.dimension, 'height')
self.assertEqual(span.location, 1.1)
class TestTextPlot(TestBokehPlot):
def test_text_plot(self):
text = Text(0, 0, 'Test')
plot = bokeh_renderer.get_plot(text)
source = plot.handles['source']
self.assertEqual(source.data, {'x': [0], 'y': [0], 'text': ['Test']})
def test_text_plot_fontsize(self):
text = Text(0, 0, 'Test', fontsize=18)
plot = bokeh_renderer.get_plot(text)
glyph = plot.handles['glyph']
self.assertEqual(glyph.text_font_size, '18Pt')