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
65ff0055
Kaydet (Commit)
65ff0055
authored
Mar 31, 2009
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue an actual PendingDeprecationWarning for the TestCase.fail* methods.
Document the deprecation.
üst
41448c58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
9 deletions
+38
-9
unittest.rst
Doc/library/unittest.rst
+21
-0
unittest.py
Lib/unittest.py
+17
-9
No files found.
Doc/library/unittest.rst
Dosyayı görüntüle @
65ff0055
...
@@ -613,6 +613,9 @@ Test cases
...
@@ -613,6 +613,9 @@ Test cases
Signal a test failure if *expr* is false; the explanation for the error
Signal a test failure if *expr* is false; the explanation for the error
will be *msg* if given, otherwise it will be :const:`None`.
will be *msg* if given, otherwise it will be :const:`None`.
.. deprecated:: 2.7
:meth:`failUnless`.
.. method:: assertEqual(first, second[, msg])
.. method:: assertEqual(first, second[, msg])
failUnlessEqual(first, second[, msg])
failUnlessEqual(first, second[, msg])
...
@@ -632,6 +635,9 @@ Test cases
...
@@ -632,6 +635,9 @@ Test cases
.. versionchanged:: 2.7
.. versionchanged:: 2.7
Added the automatic calling of type specific equality function.
Added the automatic calling of type specific equality function.
.. deprecated:: 2.7
:meth:`failUnlessEqual`.
.. method:: assertNotEqual(first, second[, msg])
.. method:: assertNotEqual(first, second[, msg])
failIfEqual(first, second[, msg])
failIfEqual(first, second[, msg])
...
@@ -643,6 +649,9 @@ Test cases
...
@@ -643,6 +649,9 @@ Test cases
default value for *msg* can be computed to include representations of both
default value for *msg* can be computed to include representations of both
*first* and *second*.
*first* and *second*.
.. deprecated:: 2.7
:meth:`failIfEqual`.
.. method:: assertAlmostEqual(first, second[, places[, msg]])
.. method:: assertAlmostEqual(first, second[, places[, msg]])
failUnlessAlmostEqual(first, second[, places[, msg]])
failUnlessAlmostEqual(first, second[, places[, msg]])
...
@@ -656,6 +665,9 @@ Test cases
...
@@ -656,6 +665,9 @@ Test cases
compare equal, the test will fail with the explanation given by *msg*, or
compare equal, the test will fail with the explanation given by *msg*, or
:const:`None`.
:const:`None`.
.. deprecated:: 2.7
:meth:`failUnlessAlmostEqual`.
.. method:: assertNotAlmostEqual(first, second[, places[, msg]])
.. method:: assertNotAlmostEqual(first, second[, places[, msg]])
failIfAlmostEqual(first, second[, places[, msg]])
failIfAlmostEqual(first, second[, places[, msg]])
...
@@ -669,6 +681,9 @@ Test cases
...
@@ -669,6 +681,9 @@ Test cases
compare equal, the test will fail with the explanation given by *msg*, or
compare equal, the test will fail with the explanation given by *msg*, or
:const:`None`.
:const:`None`.
.. deprecated:: 2.7
:meth:`failIfAlmostEqual`.
.. method:: assertGreater(first, second, msg=None)
.. method:: assertGreater(first, second, msg=None)
assertGreaterEqual(first, second, msg=None)
assertGreaterEqual(first, second, msg=None)
...
@@ -808,6 +823,9 @@ Test cases
...
@@ -808,6 +823,9 @@ Test cases
.. versionchanged:: 2.7
.. versionchanged:: 2.7
Added the ability to use :meth:`assertRaises` as a context manager.
Added the ability to use :meth:`assertRaises` as a context manager.
.. deprecated:: 2.7
:meth:`failUnlessRaises`.
.. method:: assertRaisesRegexp(exception, regexp[, callable, ...])
.. method:: assertRaisesRegexp(exception, regexp[, callable, ...])
...
@@ -849,6 +867,9 @@ Test cases
...
@@ -849,6 +867,9 @@ Test cases
This signals a test failure if *expr* is true, with *msg* or :const:`None`
This signals a test failure if *expr* is true, with *msg* or :const:`None`
for the error message.
for the error message.
.. deprecated:: 2.7
:meth:`failIf`.
.. method:: fail([msg])
.. method:: fail([msg])
...
...
Lib/unittest.py
Dosyayı görüntüle @
65ff0055
...
@@ -54,6 +54,7 @@ import sys
...
@@ -54,6 +54,7 @@ import sys
import
time
import
time
import
traceback
import
traceback
import
types
import
types
import
warnings
##############################################################################
##############################################################################
# Exported classes and functions
# Exported classes and functions
...
@@ -574,15 +575,22 @@ class TestCase(object):
...
@@ -574,15 +575,22 @@ class TestCase(object):
assert_
=
assertTrue
assert_
=
assertTrue
# These fail* assertion method names are pending deprecation and will
# These fail* assertion method names are pending deprecation and will
# be a deprecation warning in 3.2; http://bugs.python.org/issue2578
# be a DeprecationWarning in 3.2; http://bugs.python.org/issue2578
failUnlessEqual
=
assertEqual
def
__deprecate
(
original_func
):
failIfEqual
=
assertNotEqual
def
deprecated_func
(
*
args
,
**
kwargs
):
failUnlessAlmostEqual
=
assertAlmostEqual
warnings
.
warn
(
failIfAlmostEqual
=
assertNotAlmostEqual
'Please use {0} instead.'
.
format
(
original_func
.
__name__
),
failUnless
=
assertTrue
PendingDeprecationWarning
,
2
)
failUnlessRaises
=
assertRaises
return
original_func
(
*
args
,
**
kwargs
)
failIf
=
assertFalse
return
deprecated_func
failUnlessEqual
=
__deprecate
(
assertEqual
)
failIfEqual
=
__deprecate
(
assertNotEqual
)
failUnlessAlmostEqual
=
__deprecate
(
assertAlmostEqual
)
failIfAlmostEqual
=
__deprecate
(
assertNotAlmostEqual
)
failUnless
=
__deprecate
(
assertTrue
)
failUnlessRaises
=
__deprecate
(
assertRaises
)
failIf
=
__deprecate
(
assertFalse
)
def
assertSequenceEqual
(
self
,
seq1
,
seq2
,
msg
=
None
,
seq_type
=
None
):
def
assertSequenceEqual
(
self
,
seq1
,
seq2
,
msg
=
None
,
seq_type
=
None
):
"""An equality assertion for ordered sequences (like lists and tuples).
"""An equality assertion for ordered sequences (like lists and tuples).
...
...
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