@@ -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
@@ -1196,14 +1199,16 @@ def test_quoted_open(self):
11961199 class DummyURLopener (urllib .request .URLopener ):
11971200 def open_spam (self , url ):
11981201 return url
1199-
1200- self .assertEqual (DummyURLopener ().open (
1201- 'spam://example/ /' ),'//example/%20/' )
1202-
1203- # test the safe characters are not quoted by urlopen
1204- self .assertEqual (DummyURLopener ().open (
1205- "spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/" ),
1206- "//c:|windows%/:=&?~#+!$,;'@()*[]|/path/" )
1202+ with support .check_warnings (
1203+ ('DummyURLopener style of invoking requests is deprecated.' ,
1204+ DeprecationWarning )):
1205+ self .assertEqual (DummyURLopener ().open (
1206+ 'spam://example/ /' ),'//example/%20/' )
1207+
1208+ # test the safe characters are not quoted by urlopen
1209+ self .assertEqual (DummyURLopener ().open (
1210+ "spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/" ),
1211+ "//c:|windows%/:=&?~#+!$,;'@()*[]|/path/" )
12071212
12081213# Just commented them out.
12091214# Can't really tell why keep failing in windows and sparc.
0 commit comments