[Python-checkins] cpython: use assertWarns instead of check_warnings - Issue14341

senthil.kumaran python-checkins at python.org
Wed Apr 11 17:06:08 CEST 2012


http://hg.python.org/cpython/rev/751c7b81f6ee
changeset: 76241:751c7b81f6ee
parent: 76232:8a47d2322df0
user: Senthil Kumaran <senthil at uthcode.com>
date: Wed Apr 11 23:05:49 2012 +0800
summary:
 use assertWarns instead of check_warnings - Issue14341
files:
 Lib/test/test_urllib2.py | 16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -618,21 +618,23 @@
 
 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")
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /