def test_Closure_repr(self): closure = Closure(function, arg, kwarg=kwarg) self.assertIn(function.__name__, repr(closure)) self.assertIn(str(arg), repr(closure)) self.assertIn(str(kwarg), repr(closure))
def test_Closure_repr_contains_params(self): closure = Closure(function, arg, kwarg=kwarg) self.assertIn(str(arg), repr(closure)) self.assertIn(str(kwarg), repr(closure))
def test_Closure_does_not_accept_lambdas(self): value = 'no good.' function = lambda: value self.assertEqual(function(), value) with self.assertRaises(Closure.LambdaNotAllowed): Closure(function, 'this', should='fail')
def setUp(self): self.arg = 'arg' self.kwarg = 'kwarg' self.closure = Closure(self.function, self.arg, kwarg=self.kwarg) self.action = Call(closure=self.closure)