Skip to content

Commit

Permalink
Improve action param test
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt committed May 13, 2020
1 parent b73ec77 commit b6cf95f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions panel/tests/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,21 @@ class Test(param.Parameterized):

def test_action_param(document, comm):
class Test(param.Parameterized):
a = param.Action(lambda x: x.b.append(1))
b = param.List(default=[])
a = param.Action(lambda x: setattr(x, 'b', 2))
b = param.Number(default=1)

test = Test()
test_pane = Pane(test)
model = test_pane.get_root(document, comm=comm)

slider = model.children[1]
assert isinstance(slider, Button)
button = model.children[1]
assert isinstance(button, Button)

# Check that the action is actually executed
pn_button = test_pane.layout[1]
pn_button.clicks = 1

assert test.b == 2


def test_explicit_params(document, comm):
Expand Down

0 comments on commit b6cf95f

Please sign in to comment.