Skip to content

Commit

Permalink
Add unittest to downsample1d multi
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Aug 15, 2023
1 parent 4d3bf19 commit bb6c994
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions holoviews/tests/core/test_operation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import param
import pytest

from holoviews import NdOverlay, Overlay
from holoviews.operation.downsample import downsample1d
from holoviews.core.operation import Operation
from holoviews.element import Curve
from holoviews.element.comparison import ComparisonTestCase
Expand Down Expand Up @@ -68,3 +71,19 @@ def test_element_not_dynamic_with_param_method(self):
inst = ParamClass(label='Test')
applied = ExampleOperation(curve, dynamic=False, label=inst.dynamic_label)
self.assertEqual(applied, curve.relabel('Test!'))


@pytest.mark.parametrize('plottype', ['overlay', 'ndoverlay'])
def test_downsample1d_multi(plottype):
N = 1000
assert N > downsample1d.width

if plottype == 'overlay':
figure = Overlay([Curve(range(N)), Curve(range(N))])
elif plottype == "ndoverlay":
figure = NdOverlay({"A": Curve(range(N)), "B": Curve(range(N))})

figure_values = downsample1d(figure, dynamic=False).data.values()
for n in figure_values:
for value in n.data.values():
assert value.size == downsample1d.width

0 comments on commit bb6c994

Please sign in to comment.