@@ -1762,5 +1762,23 @@ def test_stty_match(self):
17621762 self .assertEqual (expected , actual )
17631763
17641764
1765+ class PublicAPITests (unittest .TestCase ):
1766+ """Ensures that the correct values are exposed in the public API."""
1767+
1768+ def test_module_all_attribute (self ):
1769+ self .assertTrue (hasattr (shutil , '__all__' ))
1770+ target_api = ['copyfileobj' , 'copyfile' , 'copymode' , 'copystat' ,
1771+ 'copy' , 'copy2' , 'copytree' , 'move' , 'rmtree' , 'Error' ,
1772+ 'SpecialFileError' , 'ExecError' , 'make_archive' ,
1773+ 'get_archive_formats' , 'register_archive_format' ,
1774+ 'unregister_archive_format' , 'get_unpack_formats' ,
1775+ 'register_unpack_format' , 'unregister_unpack_format' ,
1776+ 'unpack_archive' , 'ignore_patterns' , 'chown' , 'which' ,
1777+ 'get_terminal_size' , 'SameFileError' ]
1778+ if hasattr (os , 'statvfs' ) or os .name == 'nt' :
1779+ target_api .append ('disk_usage' )
1780+ self .assertEqual (set (shutil .__all__ ), set (target_api ))
1781+
1782+
17651783if __name__ == '__main__' :
17661784 unittest .main ()
0 commit comments