# HG changeset patch # Parent eaa38b75cc7812dbf079801657f6eae9ebb85157 Fixed http.client.__all__ and added a test diff -r eaa38b75cc78 Doc/library/http.client.rst --- a/Doc/library/http.client.rst Fri Jan 23 17:30:26 2015 -0500 +++ b/Doc/library/http.client.rst Sun Feb 15 02:30:48 2015 +0000 @@ -169,6 +169,12 @@ status code that we don't understand. +.. exception:: LineTooLong + + A subclass of :exc:`HTTPException`. Raised if an excessively long line + is received in the HTTP protocol from the server. + + The constants defined in this module are: .. data:: HTTP_PORT diff -r eaa38b75cc78 Lib/http/client.py --- a/Lib/http/client.py Fri Jan 23 17:30:26 2015 -0500 +++ b/Lib/http/client.py Sun Feb 15 02:30:48 2015 +0000 @@ -75,12 +75,14 @@ import collections from urllib.parse import urlsplit +# HTTPMessage, parse_headers(), and the HTTP status code constants are +# intentionally omitted for simplicity __all__ = ["HTTPResponse", "HTTPConnection", "HTTPException", "NotConnected", "UnknownProtocol", "UnknownTransferEncoding", "UnimplementedFileMode", "IncompleteRead", "InvalidURL", "ImproperConnectionState", "CannotSendRequest", "CannotSendHeader", "ResponseNotReady", - "BadStatusLine", "error", "responses"] + "BadStatusLine", "LineTooLong", "error", "responses"] HTTP_PORT = 80 HTTPS_PORT = 443 diff -r eaa38b75cc78 Lib/test/test_httplib.py --- a/Lib/test/test_httplib.py Fri Jan 23 17:30:26 2015 -0500 +++ b/Lib/test/test_httplib.py Sun Feb 15 02:30:48 2015 +0000 @@ -911,6 +911,18 @@ raise class OfflineTest(TestCase): + def test_all(self): + # Documented objects defined in the module should be in __all__ + expected = ["responses"] # White-list documented dict() object + blacklist = {"HTTPMessage", "parse_headers"} + for name in dir(client): + if name in blacklist: + continue + object = getattr(client, name) + if getattr(object, "__module__", None) == "http.client": + expected.append(name) + self.assertCountEqual(client.__all__, expected) + def test_responses(self): self.assertEqual(client.responses[client.NOT_FOUND], "Not Found")