MCPcopy Index your code
hub / github.com/python/cpython / check_read

Method check_read

Lib/test/test_urllib.py:306–315  ·  view source on GitHub ↗
(self, ver)

Source from the content-addressed store, hash-verified

304 """Test urlopen() opening a fake http connection."""
305
306 def check_read(self, ver):
307 self.fakehttp(b"HTTP/" + ver + b" 200 OK\r\n\r\nHello!")
308 try:
309 fp = urllib.request.urlopen("http://python.org/")
310 self.assertEqual(fp.readline(), b"Hello!")
311 self.assertEqual(fp.readline(), b"")
312 self.assertEqual(fp.geturl(), 'http://python.org/')
313 self.assertEqual(fp.getcode(), 200)
314 finally:
315 self.unfakehttp()
316
317 def test_url_fragment(self):
318 # Issue #11703: geturl() omits fragments in the original URL.

Callers 3

test_read_0_9Method · 0.95
test_read_1_0Method · 0.95
test_read_1_1Method · 0.95

Calls 7

fakehttpMethod · 0.80
unfakehttpMethod · 0.80
urlopenMethod · 0.45
assertEqualMethod · 0.45
readlineMethod · 0.45
geturlMethod · 0.45
getcodeMethod · 0.45

Tested by

no test coverage detected