diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-23 07:53:43 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-23 07:53:43 (GMT) |
commit | 745145a7dadd05713a9f927096bc977792d7484b (patch) | |
tree | 1337d0e150218c33f291fca0d1c831f6b5df767c /Lib | |
parent | 9046df065992c1763d92ed71882e3a45c8fb7437 (diff) | |
parent | c2a2a751cf02f603c979817b0927b238ec0f141f (diff) | |
download | cpython-745145a7dadd05713a9f927096bc977792d7484b.zip cpython-745145a7dadd05713a9f927096bc977792d7484b.tar.gz cpython-745145a7dadd05713a9f927096bc977792d7484b.tar.bz2 |
Issue #26822: itemgetter, attrgetter and methodcaller objects no longer
silently ignore keyword arguments.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_operator.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py index 54fd1f4..6254091 100644 --- a/Lib/test/test_operator.py +++ b/Lib/test/test_operator.py @@ -318,6 +318,9 @@ class OperatorTestCase: a.name = 'arthur' f = operator.attrgetter('name') self.assertEqual(f(a), 'arthur') + self.assertRaises(TypeError, f) + self.assertRaises(TypeError, f, a, 'dent') + self.assertRaises(TypeError, f, a, surname='dent') f = operator.attrgetter('rank') self.assertRaises(AttributeError, f, a) self.assertRaises(TypeError, operator.attrgetter, 2) @@ -365,6 +368,9 @@ class OperatorTestCase: a = 'ABCDE' f = operator.itemgetter(2) self.assertEqual(f(a), 'C') + self.assertRaises(TypeError, f) + self.assertRaises(TypeError, f, a, 3) + self.assertRaises(TypeError, f, a, size=3) f = operator.itemgetter(10) self.assertRaises(IndexError, f, a) @@ -411,6 +417,9 @@ class OperatorTestCase: self.assertRaises(IndexError, f, a) f = operator.methodcaller('foo', 1, 2) self.assertEqual(f(a), 3) + self.assertRaises(TypeError, f) + self.assertRaises(TypeError, f, a, 3) + self.assertRaises(TypeError, f, a, spam=3) f = operator.methodcaller('bar') self.assertEqual(f(a), 42) self.assertRaises(TypeError, f, a, a) |