Issue 1876: bogus attrgetter test in test_operator (original) (raw)

In test_operator we find the following lines:

    class C(object):
        def __getattr(self, name):
            raise SyntaxError
    self.failUnlessRaises(AttributeError,

operator.attrgetter('foo'), C())

Obviously "__getattr" has no effect. However, when changing it to "getattr", the test fails. Is there is any motivation for this test in the first place? If yes, why the typo and why the error when the typo is corrected?

As seen from the eq example, the exception should be SyntaxError. With both changes, it works fine again in r60142.

As for why the test is there, maybe the operator functions had lax error checking once.