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
81cdb4eb
Kaydet (Commit)
81cdb4eb
authored
Ock 20, 2006
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1388073: Make unittest.TestCase easier to subclass
üst
d704817b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
unittest.py
Lib/unittest.py
+13
-13
No files found.
Lib/unittest.py
Dosyayı görüntüle @
81cdb4eb
...
...
@@ -201,9 +201,9 @@ class TestCase:
not have a method with the specified name.
"""
try
:
self
.
_
_
testMethodName
=
methodName
self
.
_testMethodName
=
methodName
testMethod
=
getattr
(
self
,
methodName
)
self
.
_
_
testMethodDoc
=
testMethod
.
__doc__
self
.
_testMethodDoc
=
testMethod
.
__doc__
except
AttributeError
:
raise
ValueError
,
"no such test method in
%
s:
%
s"
%
\
(
self
.
__class__
,
methodName
)
...
...
@@ -229,30 +229,30 @@ class TestCase:
The default implementation of this method returns the first line of
the specified test method's docstring.
"""
doc
=
self
.
_
_
testMethodDoc
doc
=
self
.
_testMethodDoc
return
doc
and
doc
.
split
(
"
\n
"
)[
0
]
.
strip
()
or
None
def
id
(
self
):
return
"
%
s.
%
s"
%
(
_strclass
(
self
.
__class__
),
self
.
_
_
testMethodName
)
return
"
%
s.
%
s"
%
(
_strclass
(
self
.
__class__
),
self
.
_testMethodName
)
def
__str__
(
self
):
return
"
%
s (
%
s)"
%
(
self
.
_
_
testMethodName
,
_strclass
(
self
.
__class__
))
return
"
%
s (
%
s)"
%
(
self
.
_testMethodName
,
_strclass
(
self
.
__class__
))
def
__repr__
(
self
):
return
"<
%
s testMethod=
%
s>"
%
\
(
_strclass
(
self
.
__class__
),
self
.
_
_
testMethodName
)
(
_strclass
(
self
.
__class__
),
self
.
_testMethodName
)
def
run
(
self
,
result
=
None
):
if
result
is
None
:
result
=
self
.
defaultTestResult
()
result
.
startTest
(
self
)
testMethod
=
getattr
(
self
,
self
.
_
_
testMethodName
)
testMethod
=
getattr
(
self
,
self
.
_testMethodName
)
try
:
try
:
self
.
setUp
()
except
KeyboardInterrupt
:
raise
except
:
result
.
addError
(
self
,
self
.
_
_
exc_info
())
result
.
addError
(
self
,
self
.
_exc_info
())
return
ok
=
False
...
...
@@ -260,18 +260,18 @@ class TestCase:
testMethod
()
ok
=
True
except
self
.
failureException
:
result
.
addFailure
(
self
,
self
.
_
_
exc_info
())
result
.
addFailure
(
self
,
self
.
_exc_info
())
except
KeyboardInterrupt
:
raise
except
:
result
.
addError
(
self
,
self
.
_
_
exc_info
())
result
.
addError
(
self
,
self
.
_exc_info
())
try
:
self
.
tearDown
()
except
KeyboardInterrupt
:
raise
except
:
result
.
addError
(
self
,
self
.
_
_
exc_info
())
result
.
addError
(
self
,
self
.
_exc_info
())
ok
=
False
if
ok
:
result
.
addSuccess
(
self
)
finally
:
...
...
@@ -283,10 +283,10 @@ class TestCase:
def
debug
(
self
):
"""Run the test without collecting errors in a TestResult"""
self
.
setUp
()
getattr
(
self
,
self
.
_
_
testMethodName
)()
getattr
(
self
,
self
.
_testMethodName
)()
self
.
tearDown
()
def
_
_
exc_info
(
self
):
def
_exc_info
(
self
):
"""Return a version of sys.exc_info() with the traceback frame
minimised; usually the top level of the traceback frame is not
needed.
...
...
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