[Python-checkins] cpython (3.5): Issue #26688: Fix module name in mock docs
berker.peksag
python-checkins at python.org
Fri Apr 1 21:32:24 EDT 2016
https://hg.python.org/cpython/rev/73279e4a1107
changeset: 100832:73279e4a1107
branch: 3.5
parent: 100829:30e077f886cc
user: Berker Peksag <berker.peksag at gmail.com>
date: Sat Apr 02 04:32:06 2016 +0300
summary:
Issue #26688: Fix module name in mock docs
Patch by Ashley Anderson.
files:
Doc/library/unittest.mock-examples.rst | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Doc/library/unittest.mock-examples.rst b/Doc/library/unittest.mock-examples.rst
--- a/Doc/library/unittest.mock-examples.rst
+++ b/Doc/library/unittest.mock-examples.rst
@@ -359,7 +359,7 @@
A nice pattern is to actually decorate test methods themselves:
- >>> class MyTest(unittest2.TestCase):
+ >>> class MyTest(unittest.TestCase):
... @patch.object(SomeClass, 'attribute', sentinel.attribute)
... def test_something(self):
... self.assertEqual(SomeClass.attribute, sentinel.attribute)
@@ -372,7 +372,7 @@
(or :func:`patch.object` with two arguments). The mock will be created for you and
passed into the test function / method:
- >>> class MyTest(unittest2.TestCase):
+ >>> class MyTest(unittest.TestCase):
... @patch.object(SomeClass, 'static_method')
... def test_something(self, mock_method):
... SomeClass.static_method()
@@ -382,7 +382,7 @@
You can stack up multiple patch decorators using this pattern:
- >>> class MyTest(unittest2.TestCase):
+ >>> class MyTest(unittest.TestCase):
... @patch('package.module.ClassName1')
... @patch('package.module.ClassName2')
... def test_something(self, MockClass2, MockClass1):
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list