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
eae41af3
Kaydet (Commit)
eae41af3
authored
Nis 11, 2013
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #13056: Reenable test_multibytecodec.Test_StreamWriter tests
üst
a0dd0213
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
51 deletions
+22
-51
test_multibytecodec.py
Lib/test/test_multibytecodec.py
+22
-51
No files found.
Lib/test/test_multibytecodec.py
Dosyayı görüntüle @
eae41af3
...
...
@@ -176,57 +176,28 @@ class Test_StreamReader(unittest.TestCase):
support
.
unlink
(
TESTFN
)
class
Test_StreamWriter
(
unittest
.
TestCase
):
if
len
(
'
\U00012345
'
)
==
2
:
# UCS2
def
test_gb18030
(
self
):
s
=
io
.
BytesIO
()
c
=
codecs
.
getwriter
(
'gb18030'
)(
s
)
c
.
write
(
'123'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123'
)
c
.
write
(
'
\U00012345
'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\x90
7
\x95
9'
)
c
.
write
(
'
\U00012345
'
[
0
])
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\x90
7
\x95
9'
)
c
.
write
(
'
\U00012345
'
[
1
]
+
'
\U00012345
'
+
'
\uac00\u00ac
'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\x90
7
\x95
9
\x90
7
\x95
9
\x90
7
\x95
9
\x82
7
\xcf
5
\x81
0
\x85
1'
)
c
.
write
(
'
\U00012345
'
[
0
])
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\x90
7
\x95
9
\x90
7
\x95
9
\x90
7
\x95
9
\x82
7
\xcf
5
\x81
0
\x85
1'
)
self
.
assertRaises
(
UnicodeError
,
c
.
reset
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\x90
7
\x95
9
\x90
7
\x95
9
\x90
7
\x95
9
\x82
7
\xcf
5
\x81
0
\x85
1'
)
def
test_utf_8
(
self
):
s
=
io
.
BytesIO
()
c
=
codecs
.
getwriter
(
'utf-8'
)(
s
)
c
.
write
(
'123'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123'
)
c
.
write
(
'
\U00012345
'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\xf0\x92\x8d\x85
'
)
# Python utf-8 codec can't buffer surrogate pairs yet.
if
0
:
c
.
write
(
'
\U00012345
'
[
0
])
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\xf0\x92\x8d\x85
'
)
c
.
write
(
'
\U00012345
'
[
1
]
+
'
\U00012345
'
+
'
\uac00\u00ac
'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85
'
b
'
\xea\xb0\x80\xc2\xac
'
)
c
.
write
(
'
\U00012345
'
[
0
])
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85
'
b
'
\xea\xb0\x80\xc2\xac
'
)
c
.
reset
()
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85
'
b
'
\xea\xb0\x80\xc2\xac\xed\xa0\x88
'
)
c
.
write
(
'
\U00012345
'
[
1
])
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85
'
b
'
\xea\xb0\x80\xc2\xac\xed\xa0\x88\xed\xbd\x85
'
)
else
:
# UCS4
pass
def
test_gb18030
(
self
):
s
=
io
.
BytesIO
()
c
=
codecs
.
getwriter
(
'gb18030'
)(
s
)
c
.
write
(
'123'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123'
)
c
.
write
(
'
\U00012345
'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\x90
7
\x95
9'
)
c
.
write
(
'
\uac00\u00ac
'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\x90
7
\x95
9
\x82
7
\xcf
5
\x81
0
\x85
1'
)
def
test_utf_8
(
self
):
s
=
io
.
BytesIO
()
c
=
codecs
.
getwriter
(
'utf-8'
)(
s
)
c
.
write
(
'123'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123'
)
c
.
write
(
'
\U00012345
'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\xf0\x92\x8d\x85
'
)
c
.
write
(
'
\uac00\u00ac
'
)
self
.
assertEqual
(
s
.
getvalue
(),
b
'123
\xf0\x92\x8d\x85
'
b
'
\xea\xb0\x80\xc2\xac
'
)
def
test_streamwriter_strwrite
(
self
):
s
=
io
.
BytesIO
()
...
...
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