Issue #23883: Add missing APIs to tarfile.__all__

Patch by Joel Taddei and Jacek Kołodziej.
This commit is contained in:
Martin Panter 2016-01-16 06:59:13 +00:00
parent 4eb376c441
commit 104dcdab59
2 changed files with 22 additions and 1 deletions

View File

@ -64,7 +64,10 @@ except NameError:
pass pass
# from tarfile import * # from tarfile import *
__all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError"] __all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError", "ReadError",
"CompressionError", "StreamError", "ExtractError", "HeaderError",
"ENCODING", "USTAR_FORMAT", "GNU_FORMAT", "PAX_FORMAT",
"DEFAULT_FORMAT", "open"]
#--------------------------------------------------------- #---------------------------------------------------------
# tar constants # tar constants

View File

@ -1997,6 +1997,24 @@ class MiscTest(unittest.TestCase):
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
tarfile.itn(0x10000000000, 6, tarfile.GNU_FORMAT) tarfile.itn(0x10000000000, 6, tarfile.GNU_FORMAT)
def test__all__(self):
blacklist = {'version', 'bltn_open', 'symlink_exception',
'NUL', 'BLOCKSIZE', 'RECORDSIZE', 'GNU_MAGIC',
'POSIX_MAGIC', 'LENGTH_NAME', 'LENGTH_LINK',
'LENGTH_PREFIX', 'REGTYPE', 'AREGTYPE', 'LNKTYPE',
'SYMTYPE', 'CHRTYPE', 'BLKTYPE', 'DIRTYPE', 'FIFOTYPE',
'CONTTYPE', 'GNUTYPE_LONGNAME', 'GNUTYPE_LONGLINK',
'GNUTYPE_SPARSE', 'XHDTYPE', 'XGLTYPE', 'SOLARIS_XHDTYPE',
'SUPPORTED_TYPES', 'REGULAR_TYPES', 'GNU_TYPES',
'PAX_FIELDS', 'PAX_NAME_FIELDS', 'PAX_NUMBER_FIELDS',
'stn', 'nts', 'nti', 'itn', 'calc_chksums', 'copyfileobj',
'filemode',
'EmptyHeaderError', 'TruncatedHeaderError',
'EOFHeaderError', 'InvalidHeaderError',
'SubsequentHeaderError', 'ExFileObject', 'TarIter',
'main'}
support.check__all__(self, tarfile, blacklist=blacklist)
class CommandLineTest(unittest.TestCase): class CommandLineTest(unittest.TestCase):