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
370d85ce
Kaydet (Commit)
370d85ce
authored
Şub 28, 2011
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Python 2 can encode/decode surrogates to utf-8. Add a test for this.
üst
8ef39070
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
test_unicode.py
Lib/test/test_unicode.py
+7
-1
No files found.
Lib/test/test_unicode.py
Dosyayı görüntüle @
370d85ce
...
...
@@ -667,11 +667,17 @@ class UnicodeTest(
# see http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf
# (table 3-7) and http://www.rfc-editor.org/rfc/rfc3629.txt
#for cb in map(chr, range(0xA0, 0xC0)):
#sys.__stdout__.write('\\xED\\x%02x\\x80\n' % ord(cb))
#self.assertRaises(UnicodeDecodeError,
#('\xED'+cb+'\x80').decode, 'utf-8')
#self.assertRaises(UnicodeDecodeError,
#('\xED'+cb+'\xBF').decode, 'utf-8')
# but since they are valid on Python 2 add a test for that:
for
cb
,
surrogate
in
zip
(
map
(
chr
,
range
(
0xA0
,
0xC0
)),
map
(
unichr
,
range
(
0xd800
,
0xe000
,
64
))):
encoded
=
'
\xED
'
+
cb
+
'
\x80
'
self
.
assertEqual
(
encoded
.
decode
(
'utf-8'
),
surrogate
)
self
.
assertEqual
(
surrogate
.
encode
(
'utf-8'
),
encoded
)
for
cb
in
map
(
chr
,
range
(
0x80
,
0x90
)):
self
.
assertRaises
(
UnicodeDecodeError
,
(
'
\xF0
'
+
cb
+
'
\x80\x80
'
)
.
decode
,
'utf-8'
)
...
...
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