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
c31f12d1
Kaydet (Commit)
c31f12d1
authored
Eyl 28, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
check that exception messages are not empty (#22379)
Patch by Yongzhi Pan.
üst
623ae294
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
15 deletions
+13
-15
string_tests.py
Lib/test/string_tests.py
+6
-8
test_bytes.py
Lib/test/test_bytes.py
+1
-0
test_userstring.py
Lib/test/test_userstring.py
+5
-7
ACKS
Misc/ACKS
+1
-0
No files found.
Lib/test/string_tests.py
Dosyayı görüntüle @
c31f12d1
"""
"""
Common tests shared by test_
str, test_
unicode, test_userstring and test_string.
Common tests shared by test_unicode, test_userstring and test_string.
"""
"""
import
unittest
,
string
,
sys
,
struct
import
unittest
,
string
,
sys
,
struct
...
@@ -79,11 +79,9 @@ class BaseTest:
...
@@ -79,11 +79,9 @@ class BaseTest:
def
checkraises
(
self
,
exc
,
obj
,
methodname
,
*
args
):
def
checkraises
(
self
,
exc
,
obj
,
methodname
,
*
args
):
obj
=
self
.
fixtype
(
obj
)
obj
=
self
.
fixtype
(
obj
)
args
=
self
.
fixtype
(
args
)
args
=
self
.
fixtype
(
args
)
self
.
assertRaises
(
with
self
.
assertRaises
(
exc
)
as
cm
:
exc
,
getattr
(
obj
,
methodname
)(
*
args
)
getattr
(
obj
,
methodname
),
self
.
assertNotEqual
(
str
(
cm
.
exception
),
''
)
*
args
)
# call obj.method(*args) without any checks
# call obj.method(*args) without any checks
def
checkcall
(
self
,
obj
,
methodname
,
*
args
):
def
checkcall
(
self
,
obj
,
methodname
,
*
args
):
...
@@ -1119,8 +1117,7 @@ class MixinStrUnicodeUserStringTest:
...
@@ -1119,8 +1117,7 @@ class MixinStrUnicodeUserStringTest:
def
test_join
(
self
):
def
test_join
(
self
):
# join now works with any sequence type
# join now works with any sequence type
# moved here, because the argument order is
# moved here, because the argument order is
# different in string.join (see the test in
# different in string.join
# test.test_string.StringTest.test_join)
self
.
checkequal
(
'a b c d'
,
' '
,
'join'
,
[
'a'
,
'b'
,
'c'
,
'd'
])
self
.
checkequal
(
'a b c d'
,
' '
,
'join'
,
[
'a'
,
'b'
,
'c'
,
'd'
])
self
.
checkequal
(
'abcd'
,
''
,
'join'
,
(
'a'
,
'b'
,
'c'
,
'd'
))
self
.
checkequal
(
'abcd'
,
''
,
'join'
,
(
'a'
,
'b'
,
'c'
,
'd'
))
self
.
checkequal
(
'bd'
,
''
,
'join'
,
(
''
,
'b'
,
''
,
'd'
))
self
.
checkequal
(
'bd'
,
''
,
'join'
,
(
''
,
'b'
,
''
,
'd'
))
...
@@ -1140,6 +1137,7 @@ class MixinStrUnicodeUserStringTest:
...
@@ -1140,6 +1137,7 @@ class MixinStrUnicodeUserStringTest:
self
.
checkequal
(
'a b c'
,
' '
,
'join'
,
BadSeq2
())
self
.
checkequal
(
'a b c'
,
' '
,
'join'
,
BadSeq2
())
self
.
checkraises
(
TypeError
,
' '
,
'join'
)
self
.
checkraises
(
TypeError
,
' '
,
'join'
)
self
.
checkraises
(
TypeError
,
' '
,
'join'
,
None
)
self
.
checkraises
(
TypeError
,
' '
,
'join'
,
7
)
self
.
checkraises
(
TypeError
,
' '
,
'join'
,
7
)
self
.
checkraises
(
TypeError
,
' '
,
'join'
,
[
1
,
2
,
bytes
()])
self
.
checkraises
(
TypeError
,
' '
,
'join'
,
[
1
,
2
,
bytes
()])
try
:
try
:
...
...
Lib/test/test_bytes.py
Dosyayı görüntüle @
c31f12d1
...
@@ -298,6 +298,7 @@ class BaseBytesTest:
...
@@ -298,6 +298,7 @@ class BaseBytesTest:
seq
=
[
b
"abc"
]
*
1000
seq
=
[
b
"abc"
]
*
1000
expected
=
b
"abc"
+
b
".:abc"
*
999
expected
=
b
"abc"
+
b
".:abc"
*
999
self
.
assertEqual
(
dot_join
(
seq
),
expected
)
self
.
assertEqual
(
dot_join
(
seq
),
expected
)
self
.
assertRaises
(
TypeError
,
self
.
type2test
(
b
" "
)
.
join
,
None
)
# Error handling and cleanup when some item in the middle of the
# Error handling and cleanup when some item in the middle of the
# sequence has the wrong type.
# sequence has the wrong type.
with
self
.
assertRaises
(
TypeError
):
with
self
.
assertRaises
(
TypeError
):
...
...
Lib/test/test_userstring.py
Dosyayı görüntüle @
c31f12d1
...
@@ -28,14 +28,12 @@ class UserStringTest(
...
@@ -28,14 +28,12 @@ class UserStringTest(
realresult
realresult
)
)
def
checkraises
(
self
,
exc
,
obj
ect
,
methodname
,
*
args
):
def
checkraises
(
self
,
exc
,
obj
,
methodname
,
*
args
):
obj
ect
=
self
.
fixtype
(
object
)
obj
=
self
.
fixtype
(
obj
)
# we don't fix the arguments, because UserString can't cope with it
# we don't fix the arguments, because UserString can't cope with it
self
.
assertRaises
(
with
self
.
assertRaises
(
exc
)
as
cm
:
exc
,
getattr
(
obj
,
methodname
)(
*
args
)
getattr
(
object
,
methodname
),
self
.
assertNotEqual
(
str
(
cm
.
exception
),
''
)
*
args
)
def
checkcall
(
self
,
object
,
methodname
,
*
args
):
def
checkcall
(
self
,
object
,
methodname
,
*
args
):
object
=
self
.
fixtype
(
object
)
object
=
self
.
fixtype
(
object
)
...
...
Misc/ACKS
Dosyayı görüntüle @
c31f12d1
...
@@ -1010,6 +1010,7 @@ Mike Pall
...
@@ -1010,6 +1010,7 @@ Mike Pall
Todd R. Palmer
Todd R. Palmer
Juan David Ibáñez Palomar
Juan David Ibáñez Palomar
Jan Palus
Jan Palus
Yongzhi Pan
Martin Panter
Martin Panter
Mathias Panzenböck
Mathias Panzenböck
M. Papillon
M. Papillon
...
...
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