summaryrefslogtreecommitdiff
path: root/Doc/library/unittest.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-29 16:01:11 +0000
committerGeorg Brandl <georg@python.org>2010-07-29 16:01:11 +0000
commit8a1caa2361b86baeadfe5343b0c74fe9dec2a4ce (patch)
treea61437b150df841a5de65b9bb92456e0e3b4139a /Doc/library/unittest.rst
parentb0a4e3c1a747a1f40be0d0e4d2ab785b052673c2 (diff)
downloadcpython-git-8a1caa2361b86baeadfe5343b0c74fe9dec2a4ce.tar.gz
#6522: add a "decorator" directive to explicitly document decorators, and use it in a few places.
Diffstat (limited to 'Doc/library/unittest.rst')
-rw-r--r--Doc/library/unittest.rst16
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index f430c1701e..8449fd2e1f 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -621,20 +621,20 @@ the test unless the passed object has a certain attribute: ::
The following decorators implement test skipping and expected failures:
-.. function:: skip(reason)
+.. decorator:: skip(reason)
Unconditionally skip the decorated test. *reason* should describe why the
test is being skipped.
-.. function:: skipIf(condition, reason)
+.. decorator:: skipIf(condition, reason)
Skip the decorated test if *condition* is true.
-.. function:: skipUnless(condition, reason)
+.. decorator:: skipUnless(condition, reason)
Skip the decoratored test unless *condition* is true.
-.. function:: expectedFailure
+.. decorator:: expectedFailure
Mark the test as an expected failure. If the test fails when run, the test
is not counted as a failure.
@@ -1048,11 +1048,11 @@ Test cases
:attr:`exception` 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()
+ with self.assertRaises(SomeException) as cm:
+ do_something()
- the_exception = cm.exception
- self.assertEqual(the_exception.error_code, 3)
+ the_exception = cm.exception
+ self.assertEqual(the_exception.error_code, 3)
.. versionchanged:: 3.1
Added the ability to use :meth:`assertRaises` as a context manager.