Skip to content

Commit

Permalink
Added unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Apr 11, 2022
1 parent f585440 commit 756ada2
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/API1/testwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,3 +830,35 @@ def test_simple_trigger_two_params(self):
self.assertEqual(args[1].old, 0)
self.assertEqual(args[1].new, 0)
self.assertEqual(args[1].type, 'triggered')

def test_sensitivity_of_widget_name(self):
# From: https://github.com/holoviz/param/issues/614

class ExampleWidget(param.Parameterized):
value = param.Number(default=1)


class Example(param.Parameterized):
da = param.Number(default=1)
date_picker = param.Parameter(ExampleWidget())
picker = param.Parameter(ExampleWidget())

@param.depends(
"date_picker.value",
"picker.value",
watch=True,
)
def load_data(self):
self.da += 1 # To trigger plot_time

@param.depends("da")
def plot_time(self):
return self.da


example = Example()
example.picker.value += 1
assert example.da == 2

example.picker.value += 1
assert example.da == 3

0 comments on commit 756ada2

Please sign in to comment.