MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_404

Method test_404

Lib/test/test_urllib2_localnet.py:542–555  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

540
541
542 def test_404(self):
543 expected_response = b"Bad bad bad..."
544 handler = self.start_server([(404, [], expected_response)])
545
546 try:
547 self.urlopen("http://localhost:%s/weeble" % handler.port)
548 except urllib.error.URLError as f:
549 data = f.read()
550 f.close()
551 else:
552 self.fail("404 should raise URLError")
553
554 self.assertEqual(data, expected_response)
555 self.assertEqual(handler.requests, ["/weeble"])
556
557
558 def test_200(self):

Callers

nothing calls this directly

Calls 6

start_serverMethod · 0.95
urlopenMethod · 0.95
readMethod · 0.45
closeMethod · 0.45
failMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected