From 7e4cd6abc1d788e8732a7f1b4b0103da7c19eebb Mon Sep 17 00:00:00 2001 From: Gordon Ball Date: Thu, 26 Jun 2014 21:31:07 +0200 Subject: [PATCH] Add tests for the on_demand option --- IPython/html/widgets/tests/test_interaction.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/IPython/html/widgets/tests/test_interaction.py b/IPython/html/widgets/tests/test_interaction.py index c5fe40db4..79d2cccb5 100644 --- a/IPython/html/widgets/tests/test_interaction.py +++ b/IPython/html/widgets/tests/test_interaction.py @@ -480,3 +480,16 @@ def test_custom_description(): value='text', description='foo', ) + +def test_interact_ondemand_button(): + c = interactive(f, on_demand=True) + w = c.children[0] + check_widget(w, cls=widgets.ButtonWidget) + +def test_interact_ondemand_nocall(): + callcount = 0 + def calltest(testarg): + callcount += 1 + c = interactive(calltest, testarg=5, on_demand=True) + c.children[0].value = 10 + nt.assert_equal(callcount, 0)