def test_call_args(self): a = dispatch.Dispatch() a.add(self.add) self.assertEqual(a.call(self.add.__name__, (1, 2)), 3) self.assertEqual(self.count, 1)
def test_add_with_name(self): a = dispatch.Dispatch() a.add(self.func, "somebogusname") self.assertEqual(len(a.functions), 1) self.assertTrue(self.func in a.functions.values()) self.assertTrue("somebogusname" in a.functions.keys())
def test_call_noargs(self): a = dispatch.Dispatch() a.add(self.func) a.call(self.func.__name__, ()) self.assertEqual(self.count, 1)
def test_add_noname(self): a = dispatch.Dispatch() a.add(self.func) self.assertEqual(len(a.functions), 1) self.assertTrue(self.func in a.functions.values()) self.assertTrue(self.func.__name__ in a.functions.keys())