From de3ee5b94ff9a680d7653ca178b8b66a96a92af8 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 20 Dec 2014 17:42:38 +0200 Subject: Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter. --- Lib/codecs.py | 8 +++++++- Lib/test/test_codecs.py | 23 +++++++++++++++++++++++ Misc/NEWS | 2 ++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Lib/codecs.py b/Lib/codecs.py index c2065da..ba9c073 100644 --- a/Lib/codecs.py +++ b/Lib/codecs.py @@ -20,8 +20,14 @@ __all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE", "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE", "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE", + "CodecInfo", "Codec", "IncrementalEncoder", "IncrementalDecoder", + "StreamReader", "StreamWriter", + "StreamReaderWriter", "StreamRecoder", + "getencoder", "getdecoder", "getincrementalencoder", + "getincrementaldecoder", "getreader", "getwriter", + "encode", "decode", "iterencode", "iterdecode", "strict_errors", "ignore_errors", "replace_errors", - "xmlcharrefreplace_errors", + "xmlcharrefreplace_errors", "backslashreplace_errors", "register_error", "lookup_error"] ### Constants diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index d4a0660..ba8c527 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -1646,6 +1646,29 @@ class CodecsModuleTest(unittest.TestCase): c = codecs.lookup('ASCII') self.assertEqual(c.name, 'ascii') + def test_all(self): + api = ( + "encode", "decode", + "register", "CodecInfo", "Codec", "IncrementalEncoder", + "IncrementalDecoder", "StreamReader", "StreamWriter", "lookup", + "getencoder", "getdecoder", "getincrementalencoder", + "getincrementaldecoder", "getreader", "getwriter", + "register_error", "lookup_error", + "strict_errors", "replace_errors", "ignore_errors", + "xmlcharrefreplace_errors", "backslashreplace_errors", + "namereplace_errors", + "open", "EncodedFile", + "iterencode", "iterdecode", + "BOM", "BOM_BE", "BOM_LE", + "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_BE", "BOM_UTF16_LE", + "BOM_UTF32", "BOM_UTF32_BE", "BOM_UTF32_LE", + "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", # Undocumented + "StreamReaderWriter", "StreamRecoder", + ) + self.assertCountEqual(api, codecs.__all__) + for api in codecs.__all__: + getattr(codecs, api) + class StreamReaderTest(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS index 928c3cf..37b081c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -41,6 +41,8 @@ Core and Builtins Library ------- +- Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter. + - Issue #15513: Added a __sizeof__ implementation for pickle classes. - Issue #19858: pickletools.optimize() now aware of the MEMOIZE opcode, can -- cgit v0.12