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
1af262c6
Kaydet (Commit)
1af262c6
authored
Eyl 23, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed test_large_file_exception. Ported tests for large count of files
to TestZip64InSmallFiles.
üst
45efb225
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
1 deletion
+58
-1
test_zipfile.py
Lib/test/test_zipfile.py
+58
-1
No files found.
Lib/test/test_zipfile.py
Dosyayı görüntüle @
1af262c6
...
@@ -605,7 +605,9 @@ class TestZip64InSmallFiles(unittest.TestCase):
...
@@ -605,7 +605,9 @@ class TestZip64InSmallFiles(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
_limit
=
zipfile
.
ZIP64_LIMIT
self
.
_limit
=
zipfile
.
ZIP64_LIMIT
zipfile
.
ZIP64_LIMIT
=
5
self
.
_filecount_limit
=
zipfile
.
ZIP_FILECOUNT_LIMIT
zipfile
.
ZIP64_LIMIT
=
1000
zipfile
.
ZIP_FILECOUNT_LIMIT
=
9
line_gen
=
(
"Test of zipfile line
%
d."
%
i
line_gen
=
(
"Test of zipfile line
%
d."
%
i
for
i
in
range
(
0
,
FIXEDTEST_SIZE
))
for
i
in
range
(
0
,
FIXEDTEST_SIZE
))
...
@@ -709,8 +711,63 @@ class TestZip64InSmallFiles(unittest.TestCase):
...
@@ -709,8 +711,63 @@ class TestZip64InSmallFiles(unittest.TestCase):
with
zipfile
.
ZipFile
(
TESTFN2
,
"r"
,
zipfile
.
ZIP_STORED
)
as
zipfp
:
with
zipfile
.
ZipFile
(
TESTFN2
,
"r"
,
zipfile
.
ZIP_STORED
)
as
zipfp
:
self
.
assertEqual
(
zipfp
.
namelist
(),
[
"absolute"
])
self
.
assertEqual
(
zipfp
.
namelist
(),
[
"absolute"
])
def
test_too_many_files
(
self
):
# This test checks that more than 64k files can be added to an archive,
# and that the resulting archive can be read properly by ZipFile
zipf
=
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"w"
,
allowZip64
=
True
)
zipf
.
debug
=
100
numfiles
=
15
for
i
in
range
(
numfiles
):
zipf
.
writestr
(
"foo
%08
d"
%
i
,
"
%
d"
%
(
i
**
3
%
57
))
self
.
assertEqual
(
len
(
zipf
.
namelist
()),
numfiles
)
zipf
.
close
()
zipf2
=
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"r"
)
self
.
assertEqual
(
len
(
zipf2
.
namelist
()),
numfiles
)
for
i
in
range
(
numfiles
):
content
=
zipf2
.
read
(
"foo
%08
d"
%
i
)
self
.
assertEqual
(
content
,
"
%
d"
%
(
i
**
3
%
57
))
zipf2
.
close
()
def
test_too_many_files_append
(
self
):
zipf
=
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"w"
,
allowZip64
=
False
)
zipf
.
debug
=
100
numfiles
=
9
for
i
in
range
(
numfiles
):
zipf
.
writestr
(
"foo
%08
d"
%
i
,
"
%
d"
%
(
i
**
3
%
57
))
self
.
assertEqual
(
len
(
zipf
.
namelist
()),
numfiles
)
with
self
.
assertRaises
(
zipfile
.
LargeZipFile
):
zipf
.
writestr
(
"foo
%08
d"
%
numfiles
,
b
''
)
self
.
assertEqual
(
len
(
zipf
.
namelist
()),
numfiles
)
zipf
.
close
()
zipf
=
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"a"
,
allowZip64
=
False
)
zipf
.
debug
=
100
self
.
assertEqual
(
len
(
zipf
.
namelist
()),
numfiles
)
with
self
.
assertRaises
(
zipfile
.
LargeZipFile
):
zipf
.
writestr
(
"foo
%08
d"
%
numfiles
,
b
''
)
self
.
assertEqual
(
len
(
zipf
.
namelist
()),
numfiles
)
zipf
.
close
()
zipf
=
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"a"
,
allowZip64
=
True
)
zipf
.
debug
=
100
self
.
assertEqual
(
len
(
zipf
.
namelist
()),
numfiles
)
numfiles2
=
15
for
i
in
range
(
numfiles
,
numfiles2
):
zipf
.
writestr
(
"foo
%08
d"
%
i
,
"
%
d"
%
(
i
**
3
%
57
))
self
.
assertEqual
(
len
(
zipf
.
namelist
()),
numfiles2
)
zipf
.
close
()
zipf2
=
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"r"
)
self
.
assertEqual
(
len
(
zipf2
.
namelist
()),
numfiles2
)
for
i
in
range
(
numfiles2
):
content
=
zipf2
.
read
(
"foo
%08
d"
%
i
)
self
.
assertEqual
(
content
,
"
%
d"
%
(
i
**
3
%
57
))
zipf2
.
close
()
def
tearDown
(
self
):
def
tearDown
(
self
):
zipfile
.
ZIP64_LIMIT
=
self
.
_limit
zipfile
.
ZIP64_LIMIT
=
self
.
_limit
zipfile
.
ZIP_FILECOUNT_LIMIT
=
self
.
_filecount_limit
unlink
(
TESTFN
)
unlink
(
TESTFN
)
unlink
(
TESTFN2
)
unlink
(
TESTFN2
)
...
...
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