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
dc3694be
Kaydet (Commit)
dc3694be
authored
Şub 07, 2010
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Rename "exc_value" attribute on assertRaises context manager to "exception".
üst
4ad752d7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
13 deletions
+5
-13
unittest.rst
Doc/library/unittest.rst
+2
-2
test_unittest.py
Lib/test/test_unittest.py
+1
-9
case.py
Lib/unittest/case.py
+2
-2
No files found.
Doc/library/unittest.rst
Dosyayı görüntüle @
dc3694be
...
...
@@ -898,13 +898,13 @@ Test cases
do_something()
The context manager will store the caught exception object in its
:attr:`exc
_value
` attribute. This can be useful if the intention
:attr:`exc
eption
` attribute. This can be useful if the intention
is to perform additional checks on the exception raised::
with self.assertRaises(SomeException) as cm:
do_something()
the_exception = cm.exc
_value
the_exception = cm.exc
eption
self.assertEqual(the_exception.error_code, 3)
.. versionchanged:: 2.7
...
...
Lib/test/test_unittest.py
Dosyayı görüntüle @
dc3694be
...
...
@@ -6,8 +6,6 @@ Still need testing:
TestCase.{assert,fail}* methods (some are tested implicitly)
"""
from
StringIO
import
StringIO
import
__builtin__
import
os
import
re
import
sys
...
...
@@ -626,7 +624,6 @@ class Test_TestLoader(TestCase):
# a good chance that it won't be imported when this test is run
module_name
=
'audioop'
import
sys
if
module_name
in
sys
.
modules
:
del
sys
.
modules
[
module_name
]
...
...
@@ -1014,7 +1011,6 @@ class Test_TestLoader(TestCase):
# a good chance that it won't be imported when this test is run
module_name
=
'audioop'
import
sys
if
module_name
in
sys
.
modules
:
del
sys
.
modules
[
module_name
]
...
...
@@ -1962,8 +1958,6 @@ class Test_TestResult(TestCase):
# methods. Contains formatted tracebacks instead
# of sys.exc_info() results."
def
test_addFailure
(
self
):
import
sys
class
Foo
(
unittest
.
TestCase
):
def
test_1
(
self
):
pass
...
...
@@ -2012,8 +2006,6 @@ class Test_TestResult(TestCase):
# methods. Contains formatted tracebacks instead
# of sys.exc_info() results."
def
test_addError
(
self
):
import
sys
class
Foo
(
unittest
.
TestCase
):
def
test_1
(
self
):
pass
...
...
@@ -2888,7 +2880,7 @@ test case
ctx
=
self
.
assertRaises
(
ExceptionMock
)
with
ctx
:
Stub
(
v
)
e
=
ctx
.
exc
_value
e
=
ctx
.
exc
eption
self
.
assertIsInstance
(
e
,
ExceptionMock
)
self
.
assertEqual
(
e
.
args
[
0
],
v
)
...
...
Lib/unittest/case.py
Dosyayı görüntüle @
dc3694be
...
...
@@ -104,7 +104,7 @@ class _AssertRaisesContext(object):
if
not
issubclass
(
exc_type
,
self
.
expected
):
# let unexpected exceptions pass through
return
False
self
.
exc
_value
=
exc_value
#
store for later retrieval
self
.
exc
eption
=
exc_value
#
store for later retrieval
if
self
.
expected_regexp
is
None
:
return
True
...
...
@@ -389,7 +389,7 @@ class TestCase(object):
with self.assertRaises(SomeException) as cm:
do_something()
the_exception = cm.exc
_value
the_exception = cm.exc
eption
self.assertEqual(the_exception.error_code, 3)
"""
context
=
_AssertRaisesContext
(
excClass
,
self
)
...
...
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