Skip to content

Commit

Permalink
Add tests for scalebar_icon
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed May 29, 2024
1 parent 45f423d commit d0ea5bb
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions holoviews/tests/plotting/bokeh/test_elementplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,36 @@ def test_scalebar_label(self):
assert scalebar.visible
assert scalebar.label == 'Test'

def test_scalebar_icon(self):
curve = Curve([1, 2, 3]).opts(scalebar=True)
plot = bokeh_renderer.get_plot(curve)
toolbar = plot.handles['plot'].toolbar
scalebar_icon = [tool for tool in toolbar.tools if tool.description == "Toggle ScaleBar"]
assert len(scalebar_icon) == 1

def test_scalebar_no_icon(self):
curve = Curve([1, 2, 3]).opts(scalebar=False)
plot = bokeh_renderer.get_plot(curve)
toolbar = plot.handles['plot'].toolbar
scalebar_icon = [tool for tool in toolbar.tools if tool.description == "Toggle ScaleBar"]
assert len(scalebar_icon) == 0

def test_scalebar_icon_multiple_overlay(self):
curve1 = Curve([1, 2, 3]).opts(scalebar=True)
curve2 = Curve([1, 2, 3]).opts(scalebar=True)
plot = bokeh_renderer.get_plot(curve1 * curve2)
toolbar = plot.handles['plot'].toolbar
scalebar_icon = [tool for tool in toolbar.tools if tool.description == "Toggle ScaleBar"]
assert len(scalebar_icon) == 1

def test_scalebar_icon_multiple_layout(self):
curve1 = Curve([1, 2, 3]).opts(scalebar=True)
curve2 = Curve([1, 2, 3]).opts(scalebar=True)
plot = bokeh_renderer.get_plot(curve1 + curve2)
toolbar = plot.handles['plot'].toolbar
scalebar_icon = [tool for tool in toolbar.tools if tool.description == "Toggle ScaleBar"]

Check failure on line 873 in holoviews/tests/plotting/bokeh/test_elementplot.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

TestScalebarPlot.test_scalebar_icon_multiple_layout AttributeError: unexpected attribute 'description' to ToolProxy, possible attributes are active, disabled, js_event_callbacks, js_property_callbacks, name, subscribed_events, syncable, tags or tools. Did you mean: 'descriptors'?

Check failure on line 873 in holoviews/tests/plotting/bokeh/test_elementplot.py

View workflow job for this annotation

GitHub Actions / unit:test-39:macos-latest

TestScalebarPlot.test_scalebar_icon_multiple_layout AttributeError: unexpected attribute 'description' to ToolProxy, possible attributes are active, disabled, js_event_callbacks, js_property_callbacks, name, subscribed_events, syncable, tags or tools
assert len(scalebar_icon) == 1


class TestColorbarPlot(LoggingComparisonTestCase, TestBokehPlot):

Expand Down

0 comments on commit d0ea5bb

Please sign in to comment.