Exemplo n.º 1
0
 def test_with_kw(self):
     partial_decorator = partial(FullDecorator, call_kw={'f': 6})
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual(('d', 'e'), decorated.params)
     self.assertEqual(('d', 'e'), decorated.required_params)
     self.assertEqual((), decorated.optional_params)
     result = decorated(4, 5)
     self.assertEqual(15, result)
Exemplo n.º 2
0
 def test_with_kw(self):
     partial_decorator = partial(FullDecorator, call_kw={"f": 6})
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual(("d", "e"), decorated.params)
     self.assertEqual(("d", "e"), decorated.required_params)
     self.assertEqual((), decorated.optional_params)
     result = decorated(4, 5)
     self.assertEqual(15, result)
Exemplo n.º 3
0
 def test_with_args(self):
     partial_decorator = partial(FullDecorator, call_args=(4, 5))
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual(('f', ), decorated.params)
     result = decorated(6)
     self.assertEqual(15, result)
Exemplo n.º 4
0
 def test_with_nothing(self):
     partial_decorator = partial(FullDecorator)
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual(('d', 'e', 'f'), decorated.params)
     result = decorated(4, 5, 6)
     self.assertEqual(15, result)
Exemplo n.º 5
0
 def test_with_kw(self):
     partial_decorator = partial(FullDecorator, init_kw={'c': 3})
     decorated = partial_decorator(1, 2)(foo)
     self.assertEqual(1, decorated.a)
     self.assertEqual(2, decorated.b)
     self.assertEqual(3, decorated.c)
Exemplo n.º 6
0
 def test_with_args(self):
     partial_decorator = partial(FullDecorator, init_args=(1, 2))
     decorated = partial_decorator(3)(foo)
     self.assertEqual(1, decorated.a)
     self.assertEqual(2, decorated.b)
     self.assertEqual(3, decorated.c)
Exemplo n.º 7
0
 def test_with_nothing(self):
     partial_decorator = partial(FullDecorator)
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual(1, decorated.a)
     self.assertEqual(2, decorated.b)
     self.assertEqual(3, decorated.c)
Exemplo n.º 8
0
 def test(self):
     partial_decorator = partial(FullDecorator)
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual(
         '<PartialFunction base_test.function_test.partial_test.foo>',
         str(decorated))
Exemplo n.º 9
0
 def test_with_args(self):
     partial_decorator = partial(FullDecorator, call_args=(4, 5))
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual(("f",), decorated.params)
     result = decorated(6)
     self.assertEqual(15, result)
Exemplo n.º 10
0
 def test_with_nothing(self):
     partial_decorator = partial(FullDecorator)
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual(("d", "e", "f"), decorated.params)
     result = decorated(4, 5, 6)
     self.assertEqual(15, result)
Exemplo n.º 11
0
 def test_with_kw(self):
     partial_decorator = partial(FullDecorator, init_kw={"c": 3})
     decorated = partial_decorator(1, 2)(foo)
     self.assertEqual(1, decorated.a)
     self.assertEqual(2, decorated.b)
     self.assertEqual(3, decorated.c)
Exemplo n.º 12
0
 def test_with_args(self):
     partial_decorator = partial(FullDecorator, init_args=(1, 2))
     decorated = partial_decorator(3)(foo)
     self.assertEqual(1, decorated.a)
     self.assertEqual(2, decorated.b)
     self.assertEqual(3, decorated.c)
Exemplo n.º 13
0
 def test_with_nothing(self):
     partial_decorator = partial(FullDecorator)
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual(1, decorated.a)
     self.assertEqual(2, decorated.b)
     self.assertEqual(3, decorated.c)
Exemplo n.º 14
0
 def test(self):
     partial_decorator = partial(FullDecorator)
     decorated = partial_decorator(1, 2, 3)(foo)
     self.assertEqual("<PartialFunction base_test.function_test.partial_test.foo>", str(decorated))