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
c399185f
Kaydet (Commit)
c399185f
authored
Haz 30, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9239: add tests for modifying zipfile comments in append mode.
üst
4854533f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
test_zipfile.py
Lib/test/test_zipfile.py
+18
-0
No files found.
Lib/test/test_zipfile.py
Dosyayı görüntüle @
c399185f
...
...
@@ -972,6 +972,24 @@ class OtherTests(unittest.TestCase):
with
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"r"
)
as
zipfr
:
self
.
assertEqual
(
zipfr
.
comment
,
comment2
)
# check that comments are correctly modified in append mode
with
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"w"
)
as
zipf
:
zipf
.
comment
=
b
"original comment"
zipf
.
writestr
(
"foo.txt"
,
"O, for a Muse of Fire!"
)
with
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"a"
)
as
zipf
:
zipf
.
comment
=
b
"an updated comment"
with
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"r"
)
as
zipf
:
self
.
assertEqual
(
zipf
.
comment
,
b
"an updated comment"
)
# check that comments are correctly shortened in append mode
with
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"w"
)
as
zipf
:
zipf
.
comment
=
b
"original comment that's longer"
zipf
.
writestr
(
"foo.txt"
,
"O, for a Muse of Fire!"
)
with
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"a"
)
as
zipf
:
zipf
.
comment
=
b
"shorter comment"
with
zipfile
.
ZipFile
(
TESTFN
,
mode
=
"r"
)
as
zipf
:
self
.
assertEqual
(
zipf
.
comment
,
b
"shorter comment"
)
def
test_unicode_comment
(
self
):
with
zipfile
.
ZipFile
(
TESTFN
,
"w"
,
zipfile
.
ZIP_STORED
)
as
zipf
:
zipf
.
writestr
(
"foo.txt"
,
"O, for a Muse of Fire!"
)
...
...
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