[Python-checkins] cpython (2.7): Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter.

serhiy.storchaka python-checkins at python.org
Sat Dec 20 16:52:13 CET 2014


https://hg.python.org/cpython/rev/c6491d91d59a
changeset: 93935:c6491d91d59a
branch: 2.7
parent: 93918:8cd84e62c1fd
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sat Dec 20 17:42:24 2014 +0200
summary:
 Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter.
files:
 Lib/codecs.py | 8 +++++++-
 Lib/test/test_codecs.py | 22 ++++++++++++++++++++++
 Misc/NEWS | 2 ++
 3 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/Lib/codecs.py b/Lib/codecs.py
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -20,8 +20,14 @@
 "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
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -1348,6 +1348,28 @@
 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",
+ "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.assertEqual(sorted(api), sorted(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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,8 @@
 Library
 -------
 
+- Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter.
+
 - Issue #23016: A warning no longer produces an AttributeError when sys.stderr
 is None.
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /