summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_operator.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_operator.py')
-rw-r--r--Lib/test/test_operator.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py
index 812d464..82578a0 100644
--- a/Lib/test/test_operator.py
+++ b/Lib/test/test_operator.py
@@ -482,6 +482,8 @@ class OperatorTestCase:
return f
def baz(*args, **kwds):
return kwds['name'], kwds['self']
+ def return_arguments(self, *args, **kwds):
+ return args, kwds
a = A()
f = operator.methodcaller('foo')
self.assertRaises(IndexError, f, a)
@@ -498,6 +500,17 @@ class OperatorTestCase:
f = operator.methodcaller('baz', name='spam', self='eggs')
self.assertEqual(f(a), ('spam', 'eggs'))
+ many_positional_arguments = tuple(range(10))
+ many_kw_arguments = dict(zip('abcdefghij', range(10)))
+ f = operator.methodcaller('return_arguments', *many_positional_arguments)
+ self.assertEqual(f(a), (many_positional_arguments, {}))
+
+ f = operator.methodcaller('return_arguments', **many_kw_arguments)
+ self.assertEqual(f(a), ((), many_kw_arguments))
+
+ f = operator.methodcaller('return_arguments', *many_positional_arguments, **many_kw_arguments)
+ self.assertEqual(f(a), (many_positional_arguments, many_kw_arguments))
+
def test_inplace(self):
operator = self.module
class C(object):