@@ -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