From 8acd9095e8f32ee20a6c4cd105d12a133fa9f346 Mon Sep 17 00:00:00 2001 From: Vincent Vinet Date: Fri, 04 Dec 2009 05:06:49 +0000 Subject: Add Event Sources: - Add source property in Action and EventFilter - Change TPropContainer contructor to accept keyword arguments and set properties that were given - Change every single TPropContainer subclass constructor to accept kwargs and pass them on to super init - Add a "null" option for TStringProperty Use Event Sources: - Make the probe require a source property to install or subscribe - Have ProbeProxy install and subscribe return a prefixed address - Make update, uninstall and unsubsribe extract the prefix from the address - Have the TutorialRunner set a source on actions/events before installing/subscribing instead of setting current activity on ProbeManager Test Event Sources: - Change the tests according to the new constructors and behaviors --- (limited to 'tests/actiontests.py') diff --git a/tests/actiontests.py b/tests/actiontests.py index 7b8d1cb..80a10f8 100644 --- a/tests/actiontests.py +++ b/tests/actiontests.py @@ -50,14 +50,14 @@ class PropsTest(unittest.TestCase): def test_get_properties(self): act = PropertyAction(8) - assert act.get_properties() == test_props.keys(), "Action does not contain property 'a'" + assert set(act.get_properties()).issuperset(test_props.keys()), "Action properties should contain at least those we specified" - for prop_name in act.get_properties(): + for prop_name in test_props.keys(): assert getattr(act, prop_name) == test_props[prop_name], "Wrong initial value for property %s : %s"%(prop_name,str(getattr(act, prop_name))) class DialogMessageTest(unittest.TestCase): def setUp(self): - self.dial = addon.create('DialogMessage', "Message text", [200, 300]) + self.dial = addon.create('DialogMessage', message="Message text", position=[200, 300]) def test_properties(self): assert self.dial.message == "Message text", "Wrong start value for the message" @@ -116,7 +116,7 @@ class OnceWrapperTests(unittest.TestCase): CountAction """ act = CountAction() - wrap = addon.create('OnceWrapper', act) + wrap = addon.create('OnceWrapper', action=act) assert act.do_count == 0, "do() should not have been called in __init__()" assert act.undo_count == 0, "undo() should not have been called in __init__()" @@ -162,7 +162,7 @@ class ChainActionTest(unittest.TestCase): first = ChainTester(witness) second = ChainTester(witness) - c = addon.create('ChainAction', [first, second]) + c = addon.create('ChainAction', actions=[first, second]) assert witness == [], "Actions should not be triggered on init""" c.do() @@ -195,7 +195,7 @@ class DisableWidgetActionTests(unittest.TestCase): assert btn.props.sensitive is True, "Callback should have been called" - act = addon.create('DisableWidgetAction', "0") + act = addon.create('DisableWidgetAction', target="0") assert btn.props.sensitive is True, "Callback should have been called again" act.do() assert btn.props.sensitive is False, "Callback should not have been called again" @@ -285,7 +285,7 @@ class TypeTextActionTests(unittest.TestCase): test_text = "This is text" - action = addon.create('TypeTextAction', "0.0", test_text) + action = addon.create('TypeTextAction', widgetUAM="0.0", text=test_text) assert widget == ObjectStore().activity.get_children()[0],\ "The clickable widget isn't reachable from the object store \ @@ -309,7 +309,7 @@ class TypeTextActionTests(unittest.TestCase): test_text = "This is text" - action = addon.create('TypeTextAction', "0.0", test_text) + action = addon.create('TypeTextAction', widgetUAM="0.0", text=test_text) assert widget == ObjectStore().activity.get_children()[0],\ "The clickable widget isn't reachable from the object store \ @@ -330,7 +330,7 @@ class ClickActionTests(unittest.TestCase): activity.add_child(widget) ObjectStore().activity = activity - action = addon.create('ClickAction', "0.0") + action = addon.create('ClickAction', widget="0.0") assert widget == ObjectStore().activity.get_children()[0],\ "The clickable widget isn't reachable from the object store \ @@ -350,7 +350,7 @@ class ClickActionTests(unittest.TestCase): activity.add_child(widget) ObjectStore().activity = activity - action = addon.create('ClickAction', "0.0") + action = addon.create('ClickAction', widget="0.0") assert widget == ObjectStore().activity.get_children()[0],\ "The clickable widget isn't reachable from the object store \ -- cgit v0.9.1