diff options
Diffstat (limited to 'Doc/library/unittest.rst')
-rw-r--r-- | Doc/library/unittest.rst | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index f5888d8..4ecf476 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -689,7 +689,7 @@ Test cases assertLessEqual(first, second, msg=None) Test that *first* is respectively >, >=, < or <= than *second* depending - on the method name. If not, the test will fail with the nice explanation + on the method name. If not, the test will fail with an explanation or with the explanation given by *msg*:: >>> self.assertGreaterEqual(3, 4) @@ -722,7 +722,7 @@ Test cases .. method:: assertIn(first, second, msg=None) assertNotIn(first, second, msg=None) - Tests that *first* is or is not in *second* with a nice explanitory error + Tests that *first* is or is not in *second* with an explanatory error message as appropriate. If specified *msg* will be used as the error message on failure. @@ -766,7 +766,7 @@ Test cases .. method:: assertDictContainsSubset(expected, actual, msg=None) - Tests whether the key value pairs in dictionary *actual* are a + Tests whether the key/value pairs in dictionary *actual* are a superset of those in *expected*. If not, an error message listing the missing keys and mismatched values is generated. @@ -858,6 +858,23 @@ Test cases .. versionadded:: 3.1 + .. method:: assertIs(expr1, expr2[, msg]) + + This signals a test failure if *expr1* and *expr2* don't evaluate to the same + object. + + .. versionadded:: 2.7 + + + .. method:: assertIsNot(expr1, expr2[, msg]) + + The inverse of the :meth:`assertIs` method. + This signals a test failure if *expr1* and *expr2* evaluate to the same + object. + + .. versionadded:: 2.7 + + .. method:: assertFalse(expr[, msg]) failIf(expr[, msg]) @@ -951,12 +968,12 @@ Test cases been asked to compare are exactly *typeobj* (not subclasses). *function* must take two positional arguments and a third msg=None keyword argument just as :meth:`assertEqual` does. It must raise - self.failureException when inequality between the first two + ``self.failureException`` when inequality between the first two parameters is detected. One good use of custom equality checking functions for a type - is to raise self.failureException with an error message useful - for debugging the by explaining the inequalities in detail. + is to raise ``self.failureException`` with an error message useful + for debugging the problem by explaining the inequalities in detail. .. versionadded:: 3.1 |