[Python-checkins] cpython: excellent place for assertRaises

benjamin.peterson python-checkins at python.org
Wed May 25 02:30:54 CEST 2011


http://hg.python.org/cpython/rev/6051b5787c38
changeset:   70367:6051b5787c38
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue May 24 19:31:01 2011 -0500
summary:
  excellent place for assertRaises

files:
  Lib/test/test_descr.py |  7 +------
  1 files changed, 1 insertions(+), 6 deletions(-)


diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1631,12 +1631,7 @@
             for attr, obj in env.items():
                 setattr(X, attr, obj)
             setattr(X, name, ErrDescr())
-            try:
-                runner(X())
-            except MyException:
-                pass
-            else:
-                self.fail("{0!r} didn't raise".format(name))
+            self.assertRaises(MyException, runner, X())
 
     def test_specials(self):
         # Testing special operators...

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list