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
6a20ee7d
Kaydet (Commit)
6a20ee7d
authored
Eyl 26, 2000
tarafından
Marc-André Lemburg
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added test suite for the complete Unicode database. The test previously
only tested a few cases.
üst
ba90909f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
7 deletions
+79
-7
test_unicodedata.py
Lib/test/test_unicodedata.py
+79
-7
No files found.
Lib/test/test_unicodedata.py
Dosyayı görüntüle @
6a20ee7d
""" Test script for the unicodedata module.
""" Test script for the unicodedata module.
Written by Marc-Andre Lemburg (mal@lemburg.com).
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
#"
"""
#"
from
test_support
import
verbose
import
sha
import
sys
# Test Unicode database APIs
def
test_methods
():
h
=
sha
.
sha
()
for
i
in
range
(
65536
):
char
=
unichr
(
i
)
data
=
[
# Predicates (single char)
char
.
isalnum
()
and
u'1'
or
u'0'
,
char
.
isalpha
()
and
u'1'
or
u'0'
,
char
.
isdecimal
()
and
u'1'
or
u'0'
,
char
.
isdigit
()
and
u'1'
or
u'0'
,
char
.
islower
()
and
u'1'
or
u'0'
,
char
.
isnumeric
()
and
u'1'
or
u'0'
,
char
.
isspace
()
and
u'1'
or
u'0'
,
char
.
istitle
()
and
u'1'
or
u'0'
,
char
.
isupper
()
and
u'1'
or
u'0'
,
# Predicates (multiple chars)
(
char
+
u'abc'
)
.
isalnum
()
and
u'1'
or
u'0'
,
(
char
+
u'abc'
)
.
isalpha
()
and
u'1'
or
u'0'
,
(
char
+
u'123'
)
.
isdecimal
()
and
u'1'
or
u'0'
,
(
char
+
u'123'
)
.
isdigit
()
and
u'1'
or
u'0'
,
(
char
+
u'abc'
)
.
islower
()
and
u'1'
or
u'0'
,
(
char
+
u'123'
)
.
isnumeric
()
and
u'1'
or
u'0'
,
(
char
+
u'
\t
'
)
.
isspace
()
and
u'1'
or
u'0'
,
(
char
+
u'abc'
)
.
istitle
()
and
u'1'
or
u'0'
,
(
char
+
u'ABC'
)
.
isupper
()
and
u'1'
or
u'0'
,
# Mappings (single char)
char
.
lower
(),
char
.
upper
(),
char
.
title
(),
# Mappings (multiple chars)
(
char
+
u'abc'
)
.
lower
(),
(
char
+
u'ABC'
)
.
upper
(),
(
char
+
u'abc'
)
.
title
(),
(
char
+
u'ABC'
)
.
title
(),
]
h
.
update
(
u''
.
join
(
data
)
.
encode
(
'unicode-internal'
))
return
h
.
hexdigest
()
def
test_unicodedata
():
h
=
sha
.
sha
()
for
i
in
range
(
65536
):
char
=
unichr
(
i
)
data
=
[
# Properties
str
(
unicodedata
.
digit
(
char
,
-
1
)),
str
(
unicodedata
.
numeric
(
char
,
-
1
)),
str
(
unicodedata
.
decimal
(
char
,
-
1
)),
unicodedata
.
category
(
char
),
unicodedata
.
bidirectional
(
char
),
unicodedata
.
decomposition
(
char
),
str
(
unicodedata
.
mirrored
(
char
)),
str
(
unicodedata
.
combining
(
char
)),
]
h
.
update
(
''
.
join
(
data
))
return
h
.
hexdigest
()
### Run tests
print
'Testing Unicode Database...'
print
'Methods:'
,
print
test_methods
()
# In case unicodedata is not available, this will raise an ImportError,
# but still test the above cases...
import
unicodedata
import
unicodedata
print
'Functions:'
,
print
test_unicodedata
()
print
'Testing unicodedata module...'
,
# Some additional checks of the API:
print
'API:'
,
assert
unicodedata
.
digit
(
u'A'
,
None
)
is
None
assert
unicodedata
.
digit
(
u'A'
,
None
)
is
None
assert
unicodedata
.
digit
(
u'9'
)
==
9
assert
unicodedata
.
digit
(
u'9'
)
==
9
...
@@ -47,4 +119,4 @@ assert unicodedata.combining(u'\uFFFE') == 0
...
@@ -47,4 +119,4 @@ assert unicodedata.combining(u'\uFFFE') == 0
assert
unicodedata
.
combining
(
u'a'
)
==
0
assert
unicodedata
.
combining
(
u'a'
)
==
0
assert
unicodedata
.
combining
(
u'
\u20e1
'
)
==
230
assert
unicodedata
.
combining
(
u'
\u20e1
'
)
==
230
print
'
done.
'
print
'
ok
'
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