Skip to content

Commit

Permalink
Update unittest to skip if not Bokeh 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Sep 9, 2023
1 parent 350fa2e commit 114091d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class _SyntheticAnnotationPlot(ElementPlot):

def __init__(self, element, **kwargs):
if not bokeh32:
name = type(element.last).__name__
name = type(getattr(element, "last", element)).__name__
msg = f'{name} element requires Bokeh >=3.2'
raise ImportError(msg)
super().__init__(element, **kwargs)
Expand Down
15 changes: 14 additions & 1 deletion holoviews/tests/plotting/bokeh/test_annotationplot.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import unittest

import numpy as np

from bokeh.models import VSpan as BkVSpan, HSpan as BkHSpan, VStrip as BkVStrip, HStrip as BkHStrip

from holoviews.element import (
HLine, VLine, Text, Labels, Arrow, HSpan, VSpan, Slope,
HLines, VLines, HSpans, VSpans,
)
from holoviews.plotting.bokeh.util import bokeh32

from .test_plot import TestBokehPlot, bokeh_renderer

if bokeh32:
from bokeh.models import VSpan as BkVSpan, HSpan as BkHSpan, VStrip as BkVStrip, HStrip as BkHStrip


class TestHVLinePlot(TestBokehPlot):

Expand Down Expand Up @@ -203,6 +208,10 @@ def test_labels_plot_rotation_style(self):

class TestHVLinesPlot(TestBokehPlot):

def setUp(self):
raise unittest.SkipTest(not bokeh32, "Bokeh 3.2 added H/VLines")
super().setUp()

def test_hlines_plot(self):
hlines = HLines(
{"y": [0, 1, 2, 5.5], "extra": [-1, -2, -3, -44]}, vdims=["extra"]
Expand Down Expand Up @@ -334,6 +343,10 @@ def test_vlines_hlines_overlay(self):

class TestHVSpansPlot(TestBokehPlot):

def setUp(self):
raise unittest.SkipTest(not bokeh32, "Bokeh 3.2 added H/VSpans")
super().setUp()

def test_hspans_plot(self):
hspans = HSpans(
{"y0": [0, 3, 5.5], "y1": [1, 4, 6.5], "extra": [-1, -2, -3]}, vdims=["extra"]
Expand Down

0 comments on commit 114091d

Please sign in to comment.