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

Method test_invalid_closed

Lib/test/test_urllib2.py:1856–1864  ·  view source on GitHub ↗

Test the connection is cleaned up after an invalid response

(self)

Source from the content-addressed store, hash-verified

1854 "Connection not closed with {!r}".format(transfer))
1855
1856 def test_invalid_closed(self):
1857 """Test the connection is cleaned up after an invalid response"""
1858 conn = test_urllib.fakehttp(b"")
1859 handler = urllib.request.AbstractHTTPHandler()
1860 req = Request("http://dummy/")
1861 req.timeout = None
1862 with self.assertRaises(http.client.BadStatusLine):
1863 handler.do_open(conn, req)
1864 self.assertTrue(conn.fakesock.closed, "Connection not closed")
1865
1866
1867class MiscTests(unittest.TestCase):

Callers

nothing calls this directly

Calls 5

do_openMethod · 0.95
RequestClass · 0.90
fakehttpMethod · 0.80
assertTrueMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected