Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(25)

Side by Side Diff: Lib/test/test_urllibnet.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_urllib2.py ('k') | Lib/test/test_urllib.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 2
3 import unittest 3 import unittest
4 from test import support 4 from test import support
5 5
6 import contextlib 6 import contextlib
7 import socket 7 import socket
8 import urllib.request 8 import urllib.request
9 import sys 9 import sys
10 import os 10 import os
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 # Make sure fd returned by fileno is valid. 106 # Make sure fd returned by fileno is valid.
107 with self.urlopen("http://www.python.org/", timeout=None) as open_url: 107 with self.urlopen("http://www.python.org/", timeout=None) as open_url:
108 fd = open_url.fileno() 108 fd = open_url.fileno()
109 with os.fdopen(fd, encoding='utf-8') as f: 109 with os.fdopen(fd, encoding='utf-8') as f:
110 self.assertTrue(f.read(), "reading from file created using fd " 110 self.assertTrue(f.read(), "reading from file created using fd "
111 "returned by fileno failed") 111 "returned by fileno failed")
112 112
113 def test_bad_address(self): 113 def test_bad_address(self):
114 # Make sure proper exception is raised when connecting to a bogus 114 # Make sure proper exception is raised when connecting to a bogus
115 # address. 115 # address.
116 bogus_domain = "sadflkjsasf.i.nvali.d"
117 try:
118 socket.gethostbyname(bogus_domain)
119 except socket.gaierror:
120 pass
121 else:
122 # This happens with some overzealous DNS providers such as OpenDNS
123 self.skipTest("%r should not resolve for test to work" % bogus_domai n)
124 self.assertRaises(IOError, 116 self.assertRaises(IOError,
125 # SF patch 809915: In Sep 2003, VeriSign started 117 # SF patch 809915: In Sep 2003, VeriSign started
126 # highjacking invalid .com and .net addresses to 118 # highjacking invalid .com and .net addresses to
127 # boost traffic to their own site. This test 119 # boost traffic to their own site. This test
128 # started failing then. One hopes the .invalid 120 # started failing then. One hopes the .invalid
129 # domain will be spared to serve its defined 121 # domain will be spared to serve its defined
130 # purpose. 122 # purpose.
131 # urllib.urlopen, "http://www.sadflkjsasadf.com/") 123 # urllib.urlopen, "http://www.sadflkjsasadf.com/")
132 urllib.request.urlopen, 124 urllib.request.urlopen,
133 "http://sadflkjsasf.i.nvali.d/") 125 "http://sadflkjsasf.i.nvali.d/")
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 174
183 175
184 def test_main(): 176 def test_main():
185 support.requires('network') 177 support.requires('network')
186 support.run_unittest(URLTimeoutTest, 178 support.run_unittest(URLTimeoutTest,
187 urlopenNetworkTests, 179 urlopenNetworkTests,
188 urlretrieveNetworkTests) 180 urlretrieveNetworkTests)
189 181
190 if __name__ == "__main__": 182 if __name__ == "__main__":
191 test_main() 183 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_urllib2.py ('k') | Lib/test/test_urllib.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+