mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
Merge the doc for assertIs[Not], assertIs[Not]None, and assert[Not]IsInstance.
This commit is contained in:
parent
de5919dca7
commit
9794a26de9
1 changed files with 9 additions and 32 deletions
|
|
@ -871,34 +871,18 @@ Test cases
|
||||||
:meth:`failIf`; use :meth:`assertFalse`.
|
:meth:`failIf`; use :meth:`assertFalse`.
|
||||||
|
|
||||||
|
|
||||||
.. method:: assertIs(expr1, expr2, msg=None)
|
.. method:: assertIs(first, second, msg=None)
|
||||||
|
assertIsNot(first, second, msg=None)
|
||||||
|
|
||||||
This signals a test failure if *expr1* and *expr2* don't evaluate to the same
|
Test that *first* and *second* evaluate (or don't evaluate) to the same object.
|
||||||
object.
|
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
|
||||||
|
|
||||||
|
|
||||||
.. method:: assertIsNot(expr1, expr2, msg=None)
|
|
||||||
|
|
||||||
The inverse of the :meth:`assertIs` method.
|
|
||||||
This signals a test failure if *expr1* and *expr2* evaluate to the same
|
|
||||||
object.
|
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
.. versionadded:: 3.1
|
||||||
|
|
||||||
|
|
||||||
.. method:: assertIsNone(expr, msg=None)
|
.. method:: assertIsNone(expr, msg=None)
|
||||||
|
assertIsNotNone(expr, msg=None)
|
||||||
|
|
||||||
This signals a test failure if *expr* is not None.
|
Test that *expr* is (or is not) None.
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
|
||||||
|
|
||||||
|
|
||||||
.. method:: assertIsNotNone(expr, msg=None)
|
|
||||||
|
|
||||||
The inverse of the :meth:`assertIsNone` method.
|
|
||||||
This signals a test failure if *expr* is None.
|
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
.. versionadded:: 3.1
|
||||||
|
|
||||||
|
|
@ -906,7 +890,7 @@ Test cases
|
||||||
.. method:: assertIn(first, second, msg=None)
|
.. method:: assertIn(first, second, msg=None)
|
||||||
assertNotIn(first, second, msg=None)
|
assertNotIn(first, second, msg=None)
|
||||||
|
|
||||||
Tests that *first* is or is not in *second* with an explanatory error
|
Test that *first* is (or is not) in *second* with an explanatory error
|
||||||
message as appropriate.
|
message as appropriate.
|
||||||
|
|
||||||
If specified, *msg* will be used as the error message on failure.
|
If specified, *msg* will be used as the error message on failure.
|
||||||
|
|
@ -915,17 +899,10 @@ Test cases
|
||||||
|
|
||||||
|
|
||||||
.. method:: assertIsInstance(obj, cls, msg=None)
|
.. method:: assertIsInstance(obj, cls, msg=None)
|
||||||
|
assertNotIsInstance(obj, cls, msg=None)
|
||||||
|
|
||||||
This signals a test failure if *obj* is not an instance of *cls* (which
|
Test that *obj* is (or is not) an instance of *cls* (which can be a
|
||||||
can be a class or a tuple of classes, as supported by :func:`isinstance`).
|
class or a tuple of classes, as supported by :func:`isinstance`).
|
||||||
|
|
||||||
.. versionadded:: 3.2
|
|
||||||
|
|
||||||
|
|
||||||
.. method:: assertNotIsInstance(obj, cls, msg=None)
|
|
||||||
|
|
||||||
The inverse of the :meth:`assertIsInstance` method. This signals a test
|
|
||||||
failure if *obj* is an instance of *cls*.
|
|
||||||
|
|
||||||
.. versionadded:: 3.2
|
.. versionadded:: 3.2
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue