Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
abf202d7
Kaydet (Commit)
abf202d7
authored
Mar 16, 2011
tarafından
Nick Coghlan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Close #11548: Correctly handle format argument in shutil.unpack_archive
üst
a78e4e6d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
shutil.py
Lib/shutil.py
+2
-2
test_shutil.py
Lib/test/test_shutil.py
+8
-0
No files found.
Lib/shutil.py
Dosyayı görüntüle @
abf202d7
...
@@ -737,8 +737,8 @@ def unpack_archive(filename, extract_dir=None, format=None):
...
@@ -737,8 +737,8 @@ def unpack_archive(filename, extract_dir=None, format=None):
except
KeyError
:
except
KeyError
:
raise
ValueError
(
"Unknown unpack format '{0}'"
.
format
(
format
))
raise
ValueError
(
"Unknown unpack format '{0}'"
.
format
(
format
))
func
=
format_info
[
0
]
func
=
format_info
[
1
]
func
(
filename
,
extract_dir
,
**
dict
(
format_info
[
1
]))
func
(
filename
,
extract_dir
,
**
dict
(
format_info
[
2
]))
else
:
else
:
# we need to look at the registered unpackers supported extensions
# we need to look at the registered unpackers supported extensions
format
=
_find_unpack_format
(
filename
)
format
=
_find_unpack_format
(
filename
)
...
...
Lib/test/test_shutil.py
Dosyayı görüntüle @
abf202d7
...
@@ -645,6 +645,14 @@ class TestShutil(unittest.TestCase):
...
@@ -645,6 +645,14 @@ class TestShutil(unittest.TestCase):
diff
=
self
.
_compare_dirs
(
tmpdir
,
tmpdir2
)
diff
=
self
.
_compare_dirs
(
tmpdir
,
tmpdir2
)
self
.
assertEqual
(
diff
,
[])
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
):
def
test_unpack_registery
(
self
):
formats
=
get_unpack_formats
()
formats
=
get_unpack_formats
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment