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
c0c0b146
Kaydet (Commit)
c0c0b146
authored
Eyl 13, 2010
tarafından
Florent Xicluna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Strengthen test_unicode with explicit type checking for assertEqual tests.
üst
60d512c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
9 deletions
+25
-9
string_tests.py
Lib/test/string_tests.py
+1
-1
test_unicode.py
Lib/test/test_unicode.py
+22
-8
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/string_tests.py
Dosyayı görüntüle @
c0c0b146
...
...
@@ -254,7 +254,7 @@ class CommonTest(unittest.TestCase):
r2
=
j
in
i
self
.
assertEqual
(
r1
,
r2
)
if
loc
!=
-
1
:
self
.
assertEqual
(
i
[
loc
:
loc
+
len
(
j
)],
j
)
self
.
assertEqual
(
i
[
loc
:
loc
+
len
(
j
)],
self
.
fixtype
(
j
)
)
# issue 7458
self
.
checkequal
(
-
1
,
'ab'
,
'rfind'
,
'xxx'
,
sys
.
maxsize
+
1
,
0
)
...
...
Lib/test/test_unicode.py
Dosyayı görüntüle @
c0c0b146
...
...
@@ -34,6 +34,16 @@ class UnicodeTest(
):
type2test
=
unicode
def
assertEqual
(
self
,
first
,
second
,
msg
=
None
):
# strict assertEqual method: reject implicit bytes/unicode equality
super
(
UnicodeTest
,
self
)
.
assertEqual
(
first
,
second
,
msg
)
if
isinstance
(
first
,
unicode
)
or
isinstance
(
second
,
unicode
):
self
.
assertIsInstance
(
first
,
unicode
)
self
.
assertIsInstance
(
second
,
unicode
)
elif
isinstance
(
first
,
str
)
or
isinstance
(
second
,
str
):
self
.
assertIsInstance
(
first
,
str
)
self
.
assertIsInstance
(
second
,
str
)
def
checkequalnofix
(
self
,
result
,
object
,
methodname
,
*
args
):
method
=
getattr
(
object
,
methodname
)
realresult
=
method
(
*
args
)
...
...
@@ -197,9 +207,9 @@ class UnicodeTest(
def
test_comparison
(
self
):
# Comparisons:
self
.
assert
Equal
(
u'abc'
,
'abc'
)
self
.
assert
Equal
(
'abc'
,
u'abc'
)
self
.
assert
Equal
(
u'abc'
,
u'abc'
)
self
.
assert
True
(
u'abc'
==
'abc'
)
self
.
assert
True
(
'abc'
==
u'abc'
)
self
.
assert
True
(
u'abc'
==
u'abc'
)
self
.
assertTrue
(
u'abcd'
>
'abc'
)
self
.
assertTrue
(
'abcd'
>
u'abc'
)
self
.
assertTrue
(
u'abcd'
>
u'abc'
)
...
...
@@ -398,8 +408,10 @@ class UnicodeTest(
for
num
in
range
(
0x00
,
0x80
):
char
=
chr
(
num
)
self
.
assertEqual
(
u"
%
c"
%
char
,
char
)
self
.
assertEqual
(
u"
%
c"
%
num
,
char
)
self
.
assertEqual
(
u"
%
c"
%
char
,
unicode
(
char
))
self
.
assertEqual
(
u"
%
c"
%
num
,
unicode
(
char
))
self
.
assertTrue
(
char
==
u"
%
c"
%
char
)
self
.
assertTrue
(
char
==
u"
%
c"
%
num
)
# Issue 7649
for
num
in
range
(
0x80
,
0x100
):
uchar
=
unichr
(
num
)
...
...
@@ -558,9 +570,11 @@ class UnicodeTest(
set_o
=
'!"#$
%
&*;<=>@[]^_`{|}'
for
c
in
set_d
:
self
.
assertEqual
(
c
.
encode
(
'utf7'
),
c
.
encode
(
'ascii'
))
self
.
assertEqual
(
c
.
encode
(
'ascii'
)
.
decode
(
'utf7'
),
c
)
self
.
assertEqual
(
c
.
encode
(
'ascii'
)
.
decode
(
'utf7'
),
unicode
(
c
))
self
.
assertTrue
(
c
==
c
.
encode
(
'ascii'
)
.
decode
(
'utf7'
))
for
c
in
set_o
:
self
.
assertEqual
(
c
.
encode
(
'ascii'
)
.
decode
(
'utf7'
),
c
)
self
.
assertEqual
(
c
.
encode
(
'ascii'
)
.
decode
(
'utf7'
),
unicode
(
c
))
self
.
assertTrue
(
c
==
c
.
encode
(
'ascii'
)
.
decode
(
'utf7'
))
def
test_codecs_utf8
(
self
):
self
.
assertEqual
(
u''
.
encode
(
'utf-8'
),
''
)
...
...
@@ -1364,7 +1378,7 @@ class UnicodeTest(
return
u'__unicode__ overridden'
u
=
U
(
u'xxx'
)
self
.
assertEqual
(
"
%
s"
%
u
,
u'__unicode__ overridden'
)
self
.
assertEqual
(
"{}"
.
format
(
u
),
u
'__unicode__ overridden'
)
self
.
assertEqual
(
"{}"
.
format
(
u
),
'__unicode__ overridden'
)
def
test_main
():
...
...
Misc/NEWS
Dosyayı görüntüle @
c0c0b146
...
...
@@ -337,6 +337,8 @@ Build
Tests
-----
- Strengthen test_unicode with explicit type checking for assertEqual tests.
- Issue #8857: Provide a test case for socket.getaddrinfo.
- Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.
...
...
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