mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
use assertWarns instead of check_warnings - Issue14341
This commit is contained in:
parent
9fe92d1de5
commit
08bd4aaaf9
1 changed files with 9 additions and 7 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue