Michael Foord wrote: > Raymond Hettinger wrote: [...] >> >> If some people want to proceed down the path of "useful additions", >> I challenge them to think bigger. Give me some test methods that >> improve my life. Don't give me thirty ways to spell something I can >> already do. >> > > I assert that... the following changes do meet those conditions: > > assertRaisesWithMessage - for testing the error messages from library > functions, where the error message is part of the API under test (I'm > less convinced with the need for a regex matching version myself.)
This one is easily solved by making assertRaises return the exception it caught. e.g.: exc = self.assertRaises(AttributeError, getattr, foo, 'bar') self.assertEqual("'Foo' object has no attribute 'bar'", exc.message) At least Twisted and bzr have already made this exact change. It requires no new methods, and is more flexible than the proposed assertRaisesWithMessage. -Andrew. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com