From 8a1caa2361b86baeadfe5343b0c74fe9dec2a4ce Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 29 Jul 2010 16:01:11 +0000 Subject: #6522: add a "decorator" directive to explicitly document decorators, and use it in a few places. --- Doc/library/unittest.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Doc/library/unittest.rst') 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. -- cgit v1.2.1