summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_operator.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py
index aa3219f..f291e52 100644
--- a/Lib/test/test_operator.py
+++ b/Lib/test/test_operator.py
@@ -275,8 +275,7 @@ class OperatorTestCase(unittest.TestCase):
self.assertEqual(f(a), 'arthur')
f = operator.attrgetter('rank')
self.assertRaises(AttributeError, f, a)
- f = operator.attrgetter(2)
- self.assertRaises(TypeError, f, a)
+ self.assertRaises(TypeError, operator.attrgetter, 2)
self.assertRaises(TypeError, operator.attrgetter)
# multiple gets
@@ -285,7 +284,7 @@ class OperatorTestCase(unittest.TestCase):
record.y = 'Y'
record.z = 'Z'
self.assertEqual(operator.attrgetter('x','z','y')(record), ('X', 'Z', 'Y'))
- self.assertRaises(TypeError, operator.attrgetter('x', (), 'y'), record)
+ self.assertRaises(TypeError, operator.attrgetter, ('x', (), 'y'))
class C(object):
def __getattr__(self, name):
@@ -304,6 +303,10 @@ class OperatorTestCase(unittest.TestCase):
self.assertEqual(f(a), ('arthur', 'thomas'))
f = operator.attrgetter('name', 'child.name', 'child.child.name')
self.assertRaises(AttributeError, f, a)
+ f = operator.attrgetter('child.')
+ self.assertRaises(AttributeError, f, a)
+ f = operator.attrgetter('.child')
+ self.assertRaises(AttributeError, f, a)
a.child.child = A()
a.child.child.name = 'johnson'