Ejemplo n.º 1
0
 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))
Ejemplo n.º 2
0
 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))
Ejemplo n.º 3
0
 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')
Ejemplo n.º 4
0
 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)