diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2011-03-16 13:55:03 -0400 |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2011-03-16 13:55:03 -0400 |
commit | 7bfa67f380c1de301293a3ff4baeffb56b42b70c (patch) | |
tree | 1aca6d34e7e4e8d6b0688c22496b6babafcacc2d | |
parent | 09bb8f46aa08fdcc4ec4b7c791d550fd71ae9f60 (diff) | |
parent | abf202d798fec4cbe90a46d3fdba761ef6be0b85 (diff) | |
download | cpython-git-7bfa67f380c1de301293a3ff4baeffb56b42b70c.tar.gz |
Merge fix for #11548 from 3.2
-rw-r--r-- | Lib/shutil.py | 4 | ||||
-rw-r--r-- | Lib/test/test_shutil.py | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py index d47c67c6bc..aafe04e7b1 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -737,8 +737,8 @@ def unpack_archive(filename, extract_dir=None, format=None): except KeyError: raise ValueError("Unknown unpack format '{0}'".format(format)) - func = format_info[0] - func(filename, extract_dir, **dict(format_info[1])) + func = format_info[1] + func(filename, extract_dir, **dict(format_info[2])) else: # we need to look at the registered unpackers supported extensions format = _find_unpack_format(filename) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 30d9e07e35..8d003a8f98 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -645,6 +645,14 @@ class TestShutil(unittest.TestCase): diff = self._compare_dirs(tmpdir, tmpdir2) self.assertEqual(diff, []) + # and again, this time with the format specified + tmpdir3 = self.mkdtemp() + unpack_archive(filename, tmpdir3, format=format) + diff = self._compare_dirs(tmpdir, tmpdir3) + self.assertEqual(diff, []) + self.assertRaises(shutil.ReadError, unpack_archive, TESTFN) + self.assertRaises(ValueError, unpack_archive, TESTFN, format='xxx') + def test_unpack_registery(self): formats = get_unpack_formats() |