예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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))
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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))