This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: bogus attrgetter test in test_operator
Type: behavior Stage:
Components: Tests Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, pitrou
Priority: normal Keywords:

Created on 2008-01-20 14:16 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg61297 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-01-20 14:16
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?
msg61301 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-20 14:32
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.
History
Date User Action Args
2022-04-11 14:56:29adminsetgithub: 46184
2008-01-20 14:32:31georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg61301
nosy: + georg.brandl
2008-01-20 14:16:31pitroucreate