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
5930d8f0
Kaydet (Commit)
5930d8f0
authored
Tem 10, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Suppress -3 warnings in unittest.py
üst
930795b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
unittest.py
Lib/unittest.py
+12
-5
No files found.
Lib/unittest.py
Dosyayı görüntüle @
5930d8f0
...
...
@@ -68,7 +68,6 @@ __all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases'])
# Backward compatibility
##############################################################################
if
sys
.
version_info
[:
2
]
<
(
2
,
2
):
False
,
True
=
0
,
1
def
isinstance
(
obj
,
clsinfo
):
import
__builtin__
if
type
(
clsinfo
)
in
(
tuple
,
list
):
...
...
@@ -79,6 +78,14 @@ if sys.version_info[:2] < (2, 2):
return
0
else
:
return
__builtin__
.
isinstance
(
obj
,
clsinfo
)
def
_CmpToKey
(
mycmp
):
'Convert a cmp= function into a key= function'
class
K
(
object
):
def
__init__
(
self
,
obj
):
self
.
obj
=
obj
def
__lt__
(
self
,
other
):
return
mycmp
(
self
.
obj
,
other
.
obj
)
==
-
1
return
K
##############################################################################
# Test framework core
...
...
@@ -429,7 +436,7 @@ class TestSuite:
def
addTest
(
self
,
test
):
# sanity checks
if
not
callable
(
test
):
if
not
hasattr
(
test
,
'__call__'
):
raise
TypeError
(
"the test to add must be callable"
)
if
(
isinstance
(
test
,
(
type
,
types
.
ClassType
))
and
issubclass
(
test
,
(
TestCase
,
TestSuite
))):
...
...
@@ -584,7 +591,7 @@ class TestLoader:
return
TestSuite
([
parent
(
obj
.
__name__
)])
elif
isinstance
(
obj
,
TestSuite
):
return
obj
elif
callable
(
obj
):
elif
hasattr
(
obj
,
'__call__'
):
test
=
obj
()
if
isinstance
(
test
,
TestSuite
):
return
test
...
...
@@ -607,10 +614,10 @@ class TestLoader:
"""Return a sorted sequence of method names found within testCaseClass
"""
def
isTestMethod
(
attrname
,
testCaseClass
=
testCaseClass
,
prefix
=
self
.
testMethodPrefix
):
return
attrname
.
startswith
(
prefix
)
and
callable
(
getattr
(
testCaseClass
,
attrname
)
)
return
attrname
.
startswith
(
prefix
)
and
hasattr
(
getattr
(
testCaseClass
,
attrname
),
'__call__'
)
testFnNames
=
filter
(
isTestMethod
,
dir
(
testCaseClass
))
if
self
.
sortTestMethodsUsing
:
testFnNames
.
sort
(
self
.
sortTestMethodsUsing
)
testFnNames
.
sort
(
key
=
_CmpToKey
(
self
.
sortTestMethodsUsing
)
)
return
testFnNames
...
...
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