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
a831cac7
Kaydet (Commit)
a831cac7
authored
Mar 10, 2000
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Marc-Andre Lemburg: test script for Unicode implementation.
üst
8f0c5a77
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
10 deletions
+57
-10
test_unicode
Lib/test/output/test_unicode
+4
-0
test_string.py
Lib/test/test_string.py
+53
-10
test_unicode.py
Lib/test/test_unicode.py
+0
-0
No files found.
Lib/test/output/test_unicode
0 → 100644
Dosyayı görüntüle @
a831cac7
test_unicode
Testing Unicode comparisons... done.
Testing Unicode formatting strings... done.
Testing unicodedata module... done.
Lib/test/test_string.py
Dosyayı görüntüle @
a831cac7
...
@@ -11,12 +11,13 @@ def test(name, input, output, *args):
...
@@ -11,12 +11,13 @@ def test(name, input, output, *args):
if
verbose
:
if
verbose
:
print
'string.
%
s
%
s =?
%
s... '
%
(
name
,
(
input
,)
+
args
,
output
),
print
'string.
%
s
%
s =?
%
s... '
%
(
name
,
(
input
,)
+
args
,
output
),
try
:
try
:
# Prefer string methods over string module functions
try
:
try
:
f
=
getattr
(
string
,
name
)
value
=
apply
(
f
,
(
input
,)
+
args
)
except
AttributeError
:
f
=
getattr
(
input
,
name
)
f
=
getattr
(
input
,
name
)
value
=
apply
(
f
,
args
)
value
=
apply
(
f
,
args
)
except
AttributeError
:
f
=
getattr
(
string
,
name
)
value
=
apply
(
f
,
(
input
,)
+
args
)
except
:
except
:
value
=
sys
.
exc_type
value
=
sys
.
exc_type
if
value
!=
output
:
if
value
!=
output
:
...
@@ -48,6 +49,50 @@ test('lower', 'hello', 'hello')
...
@@ -48,6 +49,50 @@ test('lower', 'hello', 'hello')
test
(
'upper'
,
'HeLLo'
,
'HELLO'
)
test
(
'upper'
,
'HeLLo'
,
'HELLO'
)
test
(
'upper'
,
'HELLO'
,
'HELLO'
)
test
(
'upper'
,
'HELLO'
,
'HELLO'
)
test
(
'title'
,
' hello '
,
' Hello '
)
test
(
'title'
,
'hello '
,
'Hello '
)
test
(
'title'
,
"fOrMaT thIs aS titLe String"
,
'Format This As Title String'
)
test
(
'title'
,
"fOrMaT,thIs-aS*titLe;String"
,
'Format,This-As*Title;String'
)
test
(
'title'
,
"getInt"
,
'Getint'
)
test
(
'expandtabs'
,
'abc
\r
ab
\t
def
\n
g
\t
hi'
,
'abc
\r
ab def
\n
g hi'
)
test
(
'expandtabs'
,
'abc
\r
ab
\t
def
\n
g
\t
hi'
,
'abc
\r
ab def
\n
g hi'
,
8
)
test
(
'expandtabs'
,
'abc
\r
ab
\t
def
\n
g
\t
hi'
,
'abc
\r
ab def
\n
g hi'
,
4
)
test
(
'expandtabs'
,
'abc
\r\n
ab
\t
def
\n
g
\t
hi'
,
'abc
\r\n
ab def
\n
g hi'
,
4
)
test
(
'islower'
,
'a'
,
1
)
test
(
'islower'
,
'A'
,
0
)
test
(
'islower'
,
'
\n
'
,
0
)
test
(
'islower'
,
'abc'
,
1
)
test
(
'islower'
,
'aBc'
,
0
)
test
(
'islower'
,
'abc
\n
'
,
1
)
test
(
'isupper'
,
'a'
,
0
)
test
(
'isupper'
,
'A'
,
1
)
test
(
'isupper'
,
'
\n
'
,
0
)
test
(
'isupper'
,
'ABC'
,
1
)
test
(
'isupper'
,
'AbC'
,
0
)
test
(
'isupper'
,
'ABC
\n
'
,
1
)
test
(
'istitle'
,
'a'
,
0
)
test
(
'istitle'
,
'A'
,
1
)
test
(
'istitle'
,
'
\n
'
,
0
)
test
(
'istitle'
,
'A Titlecased Line'
,
1
)
test
(
'istitle'
,
'A
\n
Titlecased Line'
,
1
)
test
(
'istitle'
,
'A Titlecased, Line'
,
1
)
test
(
'istitle'
,
'Not a capitalized String'
,
0
)
test
(
'istitle'
,
'Not
\t
a Titlecase String'
,
0
)
test
(
'istitle'
,
'Not--a Titlecase String'
,
0
)
test
(
'splitlines'
,
"abc
\n
def
\n\r
ghi"
,
[
'abc'
,
'def'
,
''
,
'ghi'
])
test
(
'splitlines'
,
"abc
\n
def
\n\r\n
ghi"
,
[
'abc'
,
'def'
,
''
,
'ghi'
])
test
(
'splitlines'
,
"abc
\n
def
\r\n
ghi"
,
[
'abc'
,
'def'
,
'ghi'
])
test
(
'splitlines'
,
"abc
\n
def
\r\n
ghi
\n
"
,
[
'abc'
,
'def'
,
'ghi'
])
test
(
'splitlines'
,
"abc
\n
def
\r\n
ghi
\n\r
"
,
[
'abc'
,
'def'
,
'ghi'
,
''
])
test
(
'splitlines'
,
"
\n
abc
\n
def
\r\n
ghi
\n\r
"
,
[
''
,
'abc'
,
'def'
,
'ghi'
,
''
])
test
(
'splitlines'
,
"
\n
abc
\n
def
\r\n
ghi
\n\r
"
,
[
''
,
'abc
\012
def
\015\012
ghi
\012\015
'
],
1
)
test
(
'splitlines'
,
"
\n
abc
\n
def
\r\n
ghi
\n\r
"
,
[
''
,
'abc'
,
'def
\015\012
ghi
\012\015
'
],
2
)
transtable
=
'
\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037
!"#$
%
&
\'
()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[
\\
]^_`xyzdefghijklmnopqrstuvwxyz{|}~
\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
'
transtable
=
'
\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037
!"#$
%
&
\'
()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[
\\
]^_`xyzdefghijklmnopqrstuvwxyz{|}~
\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
'
test
(
'maketrans'
,
'abc'
,
transtable
,
'xyz'
)
test
(
'maketrans'
,
'abc'
,
transtable
,
'xyz'
)
...
@@ -61,8 +106,9 @@ test('split', 'a b c d', ['a', 'b c d'], None, 1)
...
@@ -61,8 +106,9 @@ test('split', 'a b c d', ['a', 'b c d'], None, 1)
test
(
'split'
,
'a b c d'
,
[
'a'
,
'b'
,
'c d'
],
None
,
2
)
test
(
'split'
,
'a b c d'
,
[
'a'
,
'b'
,
'c d'
],
None
,
2
)
test
(
'split'
,
'a b c d'
,
[
'a'
,
'b'
,
'c'
,
'd'
],
None
,
3
)
test
(
'split'
,
'a b c d'
,
[
'a'
,
'b'
,
'c'
,
'd'
],
None
,
3
)
test
(
'split'
,
'a b c d'
,
[
'a'
,
'b'
,
'c'
,
'd'
],
None
,
4
)
test
(
'split'
,
'a b c d'
,
[
'a'
,
'b'
,
'c'
,
'd'
],
None
,
4
)
test
(
'split'
,
'a b c d'
,
[
'a
'
,
'b'
,
'c'
,
'
d'
],
None
,
0
)
test
(
'split'
,
'a b c d'
,
[
'a
b c
d'
],
None
,
0
)
test
(
'split'
,
'a b c d'
,
[
'a'
,
'b'
,
'c d'
],
None
,
2
)
test
(
'split'
,
'a b c d'
,
[
'a'
,
'b'
,
'c d'
],
None
,
2
)
test
(
'split'
,
'a b c d '
,
[
'a'
,
'b'
,
'c'
,
'd'
])
# join now works with any sequence type
# join now works with any sequence type
class
Sequence
:
class
Sequence
:
...
@@ -75,13 +121,10 @@ test('join', ('a', 'b', 'c', 'd'), 'abcd', '')
...
@@ -75,13 +121,10 @@ test('join', ('a', 'b', 'c', 'd'), 'abcd', '')
test
(
'join'
,
Sequence
(),
'w x y z'
)
test
(
'join'
,
Sequence
(),
'w x y z'
)
test
(
'join'
,
7
,
TypeError
)
test
(
'join'
,
7
,
TypeError
)
class
BadStr
:
def
__str__
(
self
):
raise
RuntimeError
class
BadSeq
(
Sequence
):
class
BadSeq
(
Sequence
):
def
__init__
(
self
):
self
.
seq
=
[
7
,
'hello'
,
BadStr
()
]
def
__init__
(
self
):
self
.
seq
=
[
7
,
'hello'
,
123L
]
test
(
'join'
,
BadSeq
(),
Runtim
eError
)
test
(
'join'
,
BadSeq
(),
Typ
eError
)
# try a few long ones
# try a few long ones
print
string
.
join
([
'x'
*
100
]
*
100
,
':'
)
print
string
.
join
([
'x'
*
100
]
*
100
,
':'
)
...
@@ -103,7 +146,7 @@ test('replace', 'one!two!three!', 'one@two!three!', '!', '@', 1)
...
@@ -103,7 +146,7 @@ test('replace', 'one!two!three!', 'one@two!three!', '!', '@', 1)
test
(
'replace'
,
'one!two!three!'
,
'one@two@three!'
,
'!'
,
'@'
,
2
)
test
(
'replace'
,
'one!two!three!'
,
'one@two@three!'
,
'!'
,
'@'
,
2
)
test
(
'replace'
,
'one!two!three!'
,
'one@two@three@'
,
'!'
,
'@'
,
3
)
test
(
'replace'
,
'one!two!three!'
,
'one@two@three@'
,
'!'
,
'@'
,
3
)
test
(
'replace'
,
'one!two!three!'
,
'one@two@three@'
,
'!'
,
'@'
,
4
)
test
(
'replace'
,
'one!two!three!'
,
'one@two@three@'
,
'!'
,
'@'
,
4
)
test
(
'replace'
,
'one!two!three!'
,
'one
@two@three@
'
,
'!'
,
'@'
,
0
)
test
(
'replace'
,
'one!two!three!'
,
'one
!two!three!
'
,
'!'
,
'@'
,
0
)
test
(
'replace'
,
'one!two!three!'
,
'one@two@three@'
,
'!'
,
'@'
)
test
(
'replace'
,
'one!two!three!'
,
'one@two@three@'
,
'!'
,
'@'
)
test
(
'replace'
,
'one!two!three!'
,
'one!two!three!'
,
'x'
,
'@'
)
test
(
'replace'
,
'one!two!three!'
,
'one!two!three!'
,
'x'
,
'@'
)
test
(
'replace'
,
'one!two!three!'
,
'one!two!three!'
,
'x'
,
'@'
,
2
)
test
(
'replace'
,
'one!two!three!'
,
'one!two!three!'
,
'x'
,
'@'
,
2
)
...
...
Lib/test/test_unicode.py
0 → 100644
Dosyayı görüntüle @
a831cac7
This diff is collapsed.
Click to expand it.
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