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

Method test_invalid_closed

Lib/test/test_urllib2.py:1839–1847  ·  view source on GitHub ↗

Test the connection is cleaned up after an invalid response

(self)

Source from the content-addressed store, hash-verified

1837 "Connection not closed with {!r}".format(transfer))
1838
1839 def test_invalid_closed(self):
1840 """Test the connection is cleaned up after an invalid response"""
1841 conn = test_urllib.fakehttp(b"")
1842 handler = urllib.request.AbstractHTTPHandler()
1843 req = Request("http://dummy/")
1844 req.timeout = None
1845 with self.assertRaises(http.client.BadStatusLine):
1846 handler.do_open(conn, req)
1847 self.assertTrue(conn.fakesock.closed, "Connection not closed")
1848
1849
1850class 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