diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2015-02-20 07:45:05 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2015-02-20 07:45:05 (GMT) |
commit | 8e286794173376350dfdf7d99ac688b1827a38a3 (patch) | |
tree | f5fbb319f6cef0a8ab43530ff3b763a361166b2a /Lib/test/test_httplib.py | |
parent | 868a5a7bc65a4b76a8e7d5d0d60a158f3da27a89 (diff) | |
parent | babc688180ac9214fcc217ef906b8d11c1babe36 (diff) | |
download | cpython-8e286794173376350dfdf7d99ac688b1827a38a3.zip cpython-8e286794173376350dfdf7d99ac688b1827a38a3.tar.gz cpython-8e286794173376350dfdf7d99ac688b1827a38a3.tar.bz2 |
Issue #23439: Add missing entries to http.client.__all__.
Also, document the LineTooLong exception since it can be raised by
the members of public API (e.g. http.client.HTTPResponse).
Patch by Martin Panter.
Diffstat (limited to 'Lib/test/test_httplib.py')
-rw-r--r-- | Lib/test/test_httplib.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 40ef250..088bf73 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -920,7 +920,22 @@ class Readliner: self.remainder = b"".join(data) 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 + # HTTPMessage, parse_headers(), and the HTTP status code constants are + # intentionally omitted for simplicity + blacklist = {"HTTPMessage", "parse_headers"} + for name in dir(client): + if name in blacklist: + continue + module_object = getattr(client, name) + if getattr(module_object, "__module__", None) == "http.client": + expected.add(name) + self.assertCountEqual(client.__all__, expected) + def test_responses(self): self.assertEqual(client.responses[client.NOT_FOUND], "Not Found") |