]> granicus.if.org Git - python/commitdiff
use assertWarns instead of check_warnings - Issue14341
authorSenthil Kumaran <senthil@uthcode.com>
Wed, 11 Apr 2012 15:05:49 +0000 (23:05 +0800)
committerSenthil Kumaran <senthil@uthcode.com>
Wed, 11 Apr 2012 15:05:49 +0000 (23:05 +0800)
Lib/test/test_urllib2.py

index 632524c4e02646b4cf6e3663409bfe376a684c82..9d9260ab3dbff97242bc9d27184f1039b82dcc88 100644 (file)
@@ -618,21 +618,23 @@ class OpenerDirectorTests(unittest.TestCase):
 
     def test_method_deprecations(self):
         req = Request("http://www.example.com")
-        with support.check_warnings(('', DeprecationWarning)):
+
+        with self.assertWarns(DeprecationWarning) as cm:
             req.add_data("data")
-        with support.check_warnings(('', DeprecationWarning)):
+        with self.assertWarns(DeprecationWarning) as cm:
             req.has_data()
-        with support.check_warnings(('', DeprecationWarning)):
+        with self.assertWarns(DeprecationWarning) as cm:
             req.get_data()
-        with support.check_warnings(('', DeprecationWarning)):
+        with self.assertWarns(DeprecationWarning) as cm:
             req.get_host()
-        with support.check_warnings(('', DeprecationWarning)):
+        with self.assertWarns(DeprecationWarning) as cm:
             req.get_selector()
-        with support.check_warnings(('', DeprecationWarning)):
+        with self.assertWarns(DeprecationWarning) as cm:
             req.is_unverifiable()
-        with support.check_warnings(('', DeprecationWarning)):
+        with self.assertWarns(DeprecationWarning) as cm:
             req.get_origin_req_host()
 
+
 def sanepathname2url(path):
     try:
         path.encode("utf-8")