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
6eea789f
Kaydet (Commit)
6eea789f
authored
Tem 28, 2005
tarafından
Walter Dörwald
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Disable encoding/decoding test, if unicode is disabled.
üst
97bb8ad3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
string_tests.py
Lib/test/string_tests.py
+20
-19
No files found.
Lib/test/string_tests.py
Dosyayı görüntüle @
6eea789f
...
...
@@ -737,26 +737,27 @@ class MixinStrUserStringTest:
# Additional tests that only work with
# 8bit compatible object, i.e. str and UserString
def
test_encoding_decoding
(
self
):
codecs
=
[(
'rot13'
,
'uryyb jbeyq'
),
(
'base64'
,
'aGVsbG8gd29ybGQ=
\n
'
),
(
'hex'
,
'68656c6c6f20776f726c64'
),
(
'uu'
,
'begin 666 <data>
\n
+:&5L;&
\\
@=V]R;&0
\n
\n
end
\n
'
)]
for
encoding
,
data
in
codecs
:
self
.
checkequal
(
data
,
'hello world'
,
'encode'
,
encoding
)
self
.
checkequal
(
'hello world'
,
data
,
'decode'
,
encoding
)
# zlib is optional, so we make the test optional too...
try
:
import
zlib
except
ImportError
:
pass
else
:
data
=
'x
\x9c\xcb
H
\xcd\xc9\xc9
W(
\xcf
/
\xca
I
\x01\x00\x1a\x0b\x04
]'
self
.
checkequal
(
data
,
'hello world'
,
'encode'
,
'zlib'
)
self
.
checkequal
(
'hello world'
,
data
,
'decode'
,
'zlib'
)
if
test_support
.
have_unicode
:
def
test_encoding_decoding
(
self
):
codecs
=
[(
'rot13'
,
'uryyb jbeyq'
),
(
'base64'
,
'aGVsbG8gd29ybGQ=
\n
'
),
(
'hex'
,
'68656c6c6f20776f726c64'
),
(
'uu'
,
'begin 666 <data>
\n
+:&5L;&
\\
@=V]R;&0
\n
\n
end
\n
'
)]
for
encoding
,
data
in
codecs
:
self
.
checkequal
(
data
,
'hello world'
,
'encode'
,
encoding
)
self
.
checkequal
(
'hello world'
,
data
,
'decode'
,
encoding
)
# zlib is optional, so we make the test optional too...
try
:
import
zlib
except
ImportError
:
pass
else
:
data
=
'x
\x9c\xcb
H
\xcd\xc9\xc9
W(
\xcf
/
\xca
I
\x01\x00\x1a\x0b\x04
]'
self
.
checkequal
(
data
,
'hello world'
,
'encode'
,
'zlib'
)
self
.
checkequal
(
'hello world'
,
data
,
'decode'
,
'zlib'
)
self
.
checkraises
(
TypeError
,
'xyz'
,
'decode'
,
42
)
self
.
checkraises
(
TypeError
,
'xyz'
,
'encode'
,
42
)
self
.
checkraises
(
TypeError
,
'xyz'
,
'decode'
,
42
)
self
.
checkraises
(
TypeError
,
'xyz'
,
'encode'
,
42
)
class
MixinStrUnicodeTest
:
...
...
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