Merged revisions 79539 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79539 | florent.xicluna | 2010-04-01 01:01:03 +0300 (Thu, 01 Apr 2010) | 2 lines
Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
........
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index b1e2010..f55502a 100644
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -620,14 +620,21 @@
with test_support.check_warnings(('foo', UserWarning)):
wmod.warn("foo")
- with self.assertRaises(AssertionError):
+ try:
with test_support.check_warnings(('', RuntimeWarning)):
# defaults to quiet=False with argument
pass
- with self.assertRaises(AssertionError):
+ except AssertionError:
+ pass
+ else:
+ self.fail("Dind't raise AssertionError")
+ try:
with test_support.check_warnings(('foo', RuntimeWarning)):
wmod.warn("foo")
-
+ except AssertionError:
+ pass
+ else:
+ self.fail("Dind't raise AssertionError")
class CCatchWarningTests(CatchWarningTests):
module = c_warnings