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

Skip to content

Commit d8bc0a3

Browse files
committed
Merge DeprecationWarnings silencing in test_urllib from 3.3.
2 parents 09d9d0f + 79b99db commit d8bc0a3

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

Lib/test/test_urllib.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def urlopen(url, data=None, proxies=None):
3030
if proxies is not None:
3131
opener = urllib.request.FancyURLopener(proxies=proxies)
3232
elif not _urlopener:
33-
opener = urllib.request.FancyURLopener()
33+
with support.check_warnings(
34+
('FancyURLopener style of invoking requests is deprecated.',
35+
DeprecationWarning)):
36+
opener = urllib.request.FancyURLopener()
3437
_urlopener = opener
3538
else:
3639
opener = _urlopener
@@ -1271,14 +1274,16 @@ def test_quoted_open(self):
12711274
class DummyURLopener(urllib.request.URLopener):
12721275
def open_spam(self, url):
12731276
return url
1274-
1275-
self.assertEqual(DummyURLopener().open(
1276-
'spam://example/ /'),'//example/%20/')
1277-
1278-
# test the safe characters are not quoted by urlopen
1279-
self.assertEqual(DummyURLopener().open(
1280-
"spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"),
1281-
"//c:|windows%/:=&?~#+!$,;'@()*[]|/path/")
1277+
with support.check_warnings(
1278+
('DummyURLopener style of invoking requests is deprecated.',
1279+
DeprecationWarning)):
1280+
self.assertEqual(DummyURLopener().open(
1281+
'spam://example/ /'),'//example/%20/')
1282+
1283+
# test the safe characters are not quoted by urlopen
1284+
self.assertEqual(DummyURLopener().open(
1285+
"spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"),
1286+
"//c:|windows%/:=&?~#+!$,;'@()*[]|/path/")
12821287

12831288
# Just commented them out.
12841289
# Can't really tell why keep failing in windows and sparc.

0 commit comments

Comments
 (0)