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
ea0ebd80
Kaydet (Commit)
ea0ebd80
authored
May 15, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make test_str.py pass.
üst
2be161dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
17 deletions
+15
-17
base64_codec.py
Lib/encodings/base64_codec.py
+1
-1
string_tests.py
Lib/test/string_tests.py
+5
-5
test_str.py
Lib/test/test_str.py
+9
-11
No files found.
Lib/encodings/base64_codec.py
Dosyayı görüntüle @
ea0ebd80
...
...
@@ -21,7 +21,7 @@ def base64_encode(input,errors='strict'):
"""
assert
errors
==
'strict'
output
=
b
ase64
.
encodestring
(
input
)
output
=
b
ytes
(
base64
.
encodestring
(
input
)
)
return
(
output
,
len
(
input
))
def
base64_decode
(
input
,
errors
=
'strict'
):
...
...
Lib/test/string_tests.py
Dosyayı görüntüle @
ea0ebd80
...
...
@@ -1102,10 +1102,10 @@ class MixinStrUserStringTest:
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
'
)]
codecs
=
[(
'rot13'
,
b
'uryyb jbeyq'
),
(
'base64'
,
b
'aGVsbG8gd29ybGQ=
\n
'
),
(
'hex'
,
b
'68656c6c6f20776f726c64'
),
(
'uu'
,
b
'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
)
...
...
@@ -1115,7 +1115,7 @@ class MixinStrUserStringTest:
except
ImportError
:
pass
else
:
data
=
'x
\x9c\xcb
H
\xcd\xc9\xc9
W(
\xcf
/
\xca
I
\x01\x00\x1a\x0b\x04
]'
data
=
b
'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'
)
...
...
Lib/test/test_str.py
Dosyayı görüntüle @
ea0ebd80
...
...
@@ -29,9 +29,6 @@ class StrTest(
def
test_conversion
(
self
):
# Make sure __str__() behaves properly
class
Foo0
:
def
__unicode__
(
self
):
return
"foo"
class
Foo1
:
def
__str__
(
self
):
...
...
@@ -45,15 +42,15 @@ class StrTest(
def
__str__
(
self
):
return
"foo"
class
Foo4
(
str
):
class
Foo4
(
str
8
):
def
__str__
(
self
):
return
"foo"
class
Foo5
(
str
):
def
__
str
__
(
self
):
def
__
unicode
__
(
self
):
return
"foo"
class
Foo6
(
str
):
class
Foo6
(
str
8
):
def
__str__
(
self
):
return
"foos"
...
...
@@ -72,22 +69,23 @@ class StrTest(
def
__str__
(
self
):
return
self
class
Foo9
(
str
):
class
Foo9
(
str
8
):
def
__str__
(
self
):
return
"string"
def
__unicode__
(
self
):
return
"not unicode"
self
.
assert_
(
str
(
Foo0
())
.
startswith
(
"<"
))
# this is different from __unicode__
self
.
assertEqual
(
str
(
Foo1
()),
"foo"
)
self
.
assertEqual
(
str
(
Foo2
()),
"foo"
)
self
.
assertEqual
(
str
(
Foo3
()),
"foo"
)
self
.
assertEqual
(
str
(
Foo4
(
"bar"
)),
"foo"
)
self
.
assertEqual
(
str
(
Foo5
(
"bar"
)),
"foo"
)
self
.
assertEqual
(
str
(
Foo6
(
"bar"
)),
"foos"
)
self
.
assertEqual
(
str
(
Foo7
(
"bar"
)),
"foos"
)
self
.
assertEqual
(
str8
(
Foo6
(
"bar"
)),
"foos"
)
self
.
assertEqual
(
str
(
Foo6
(
"bar"
)),
"foou"
)
self
.
assertEqual
(
str8
(
Foo7
(
"bar"
)),
"foos"
)
self
.
assertEqual
(
str
(
Foo7
(
"bar"
)),
"foou"
)
self
.
assertEqual
(
str
(
Foo8
(
"foo"
)),
"foofoo"
)
self
.
assertEqual
(
str
(
Foo9
(
"foo"
)),
"string"
)
self
.
assertEqual
(
str
8
(
Foo9
(
"foo"
)),
"string"
)
self
.
assertEqual
(
str
(
Foo9
(
"foo"
)),
"not unicode"
)
def
test_main
():
...
...
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