Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08bd4aa

Browse files
committed
use assertWarns instead of check_warnings - Issue14341
1 parent 9fe92d1 commit 08bd4aa

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

Lib/test/test_urllib2.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -618,21 +618,23 @@ def test_processors(self):
618618

619619
def test_method_deprecations(self):
620620
req = Request("http://www.example.com")
621-
with support.check_warnings(('', DeprecationWarning)):
621+
622+
with self.assertWarns(DeprecationWarning) as cm:
622623
req.add_data("data")
623-
with support.check_warnings(('', DeprecationWarning)):
624+
with self.assertWarns(DeprecationWarning) as cm:
624625
req.has_data()
625-
with support.check_warnings(('', DeprecationWarning)):
626+
with self.assertWarns(DeprecationWarning) as cm:
626627
req.get_data()
627-
with support.check_warnings(('', DeprecationWarning)):
628+
with self.assertWarns(DeprecationWarning) as cm:
628629
req.get_host()
629-
with support.check_warnings(('', DeprecationWarning)):
630+
with self.assertWarns(DeprecationWarning) as cm:
630631
req.get_selector()
631-
with support.check_warnings(('', DeprecationWarning)):
632+
with self.assertWarns(DeprecationWarning) as cm:
632633
req.is_unverifiable()
633-
with support.check_warnings(('', DeprecationWarning)):
634+
with self.assertWarns(DeprecationWarning) as cm:
634635
req.get_origin_req_host()
635636

637+
636638
def sanepathname2url(path):
637639
try:
638640
path.encode("utf-8")

0 commit comments

Comments
 (0)