Commit 08bd4aaa authored by Senthil Kumaran's avatar Senthil Kumaran

use assertWarns instead of check_warnings - Issue14341

parent 9fe92d1d
...@@ -618,21 +618,23 @@ class OpenerDirectorTests(unittest.TestCase): ...@@ -618,21 +618,23 @@ class OpenerDirectorTests(unittest.TestCase):
def test_method_deprecations(self): def test_method_deprecations(self):
req = Request("http://www.example.com") req = Request("http://www.example.com")
with support.check_warnings(('', DeprecationWarning)):
with self.assertWarns(DeprecationWarning) as cm:
req.add_data("data") req.add_data("data")
with support.check_warnings(('', DeprecationWarning)): with self.assertWarns(DeprecationWarning) as cm:
req.has_data() req.has_data()
with support.check_warnings(('', DeprecationWarning)): with self.assertWarns(DeprecationWarning) as cm:
req.get_data() req.get_data()
with support.check_warnings(('', DeprecationWarning)): with self.assertWarns(DeprecationWarning) as cm:
req.get_host() req.get_host()
with support.check_warnings(('', DeprecationWarning)): with self.assertWarns(DeprecationWarning) as cm:
req.get_selector() req.get_selector()
with support.check_warnings(('', DeprecationWarning)): with self.assertWarns(DeprecationWarning) as cm:
req.is_unverifiable() req.is_unverifiable()
with support.check_warnings(('', DeprecationWarning)): with self.assertWarns(DeprecationWarning) as cm:
req.get_origin_req_host() req.get_origin_req_host()
def sanepathname2url(path): def sanepathname2url(path):
try: try:
path.encode("utf-8") path.encode("utf-8")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment