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
6cdec2ef
Kaydet (Commit)
6cdec2ef
authored
Haz 30, 2000
tarafından
Marc-André Lemburg
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New test for the ucnhash module.
üst
5f2e75e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
0 deletions
+82
-0
test_ucn.py
Lib/test/test_ucn.py
+82
-0
No files found.
Lib/test/test_ucn.py
0 → 100644
Dosyayı görüntüle @
6cdec2ef
""" Test script for the Unicode implementation.
Written by Bill Tutt.
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
#"
print
'Testing General Unicode Character Name, and case insensitivity...'
,
# General and case insensitivity test:
s
=
u"
\N{LATIN CAPITAL LETTER T}
"
\
u"
\N{LATIN SMALL LETTER H}
"
\
u"
\N{LATIN SMALL LETTER E}
"
\
u"
\N{SPACE}
"
\
u"
\N{LATIN SMALL LETTER R}
"
\
u"
\N{LATIN CAPITAL LETTER E}
"
\
u"
\N{LATIN SMALL LETTER D}
"
\
u"
\N{SPACE}
"
\
u"
\N{LATIN SMALL LETTER f}
"
\
u"
\N{LATIN CAPITAL LeTtEr o}
"
\
u"
\N{LATIN SMaLl LETTER x}
"
\
u"
\N{SPACE}
"
\
u"
\N{LATIN SMALL LETTER A}
"
\
u"
\N{LATIN SMALL LETTER T}
"
\
u"
\N{LATIN SMALL LETTER E}
"
\
u"
\N{SPACE}
"
\
u"
\N{LATIN SMALL LETTER T}
"
\
u"
\N{LATIN SMALL LETTER H}
"
\
u"
\N{LATIN SMALL LETTER E}
"
\
u"
\N{SpAcE}
"
\
u"
\N{LATIN SMALL LETTER S}
"
\
u"
\N{LATIN SMALL LETTER H}
"
\
u"
\N{LATIN SMALL LETTER E}
"
\
u"
\N{LATIN SMALL LETTER E}
"
\
u"
\N{LATIN SMALL LETTER P}
"
\
u"
\N{FULL STOP}
"
assert
s
==
u"The rEd fOx ate the sheep."
,
s
print
"done."
# misc. symbol testing
print
"Testing misc. symbols for unicode character name expansion...."
,
assert
u"
\N{PILCROW SIGN}
"
==
u"
\u00b6
"
assert
u"
\N{REPLACEMENT CHARACTER}
"
==
u"
\uFFFD
"
assert
u"
\
N{HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK}"
==
u"
\uFF9F
"
assert
u"
\N{FULLWIDTH LATIN SMALL LETTER A}
"
==
u"
\uFF41
"
print
"done."
# strict error testing:
print
"Testing unicode character name expansion strict error handling...."
,
k_cchMaxUnicodeName
=
83
s
=
"
\
N{"
+
"1"
*
(
k_cchMaxUnicodeName
+
2
)
+
"}"
try
:
unicode
(
s
,
'unicode-escape'
,
'strict'
)
except
UnicodeError
:
pass
else
:
raise
AssertionError
,
"failed to raise an exception when presented "
\
"with a UCN > k_cchMaxUnicodeName"
try
:
unicode
(
"
\N{blah}
"
,
'unicode-escape'
,
'strict'
)
except
UnicodeError
:
pass
else
:
raise
AssertionError
,
"failed to raise an exception when given a bogus character name"
try
:
unicode
(
"
\
N{SPACE"
,
'unicode-escape'
,
'strict'
)
except
UnicodeError
:
pass
else
:
raise
AssertionError
,
"failed to raise an exception for a missing closing brace."
try
:
unicode
(
"
\
NSPACE"
,
'unicode-escape'
,
'strict'
)
except
UnicodeError
:
pass
else
:
raise
AssertionError
,
"failed to raise an exception for a missing opening brace."
print
"done."
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