Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0682a0c0
Commit
0682a0c0
authored
Apr 13, 2012
by
Michael Foord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor docstring / docs corrections for unittest.mock
parent
656319e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
Doc/library/unittest.mock-examples.rst
Doc/library/unittest.mock-examples.rst
+1
-1
Doc/library/unittest.mock.rst
Doc/library/unittest.mock.rst
+4
-4
Lib/unittest/mock.py
Lib/unittest/mock.py
+6
-6
No files found.
Doc/library/unittest.mock-examples.rst
View file @
0682a0c0
...
...
@@ -99,7 +99,7 @@ by looking at the return value of the mocked class.
In the example below we have a function `some_function` that instantiates `Foo`
and calls a method on it. The call to `patch` replaces the class `Foo` with a
mock. The `Foo` instance is the result of calling the mock, so it is configured
by modify the mock :attr:`~Mock.return_value`.
by modify
ing
the mock :attr:`~Mock.return_value`.
>>> def some_function():
... instance = module.Foo()
...
...
Doc/library/unittest.mock.rst
View file @
0682a0c0
...
...
@@ -236,10 +236,10 @@ the `new_callable` argument to `patch`.
* `wraps`: Item for the mock object to wrap. If `wraps` is not None then
calling the Mock will pass the call through to the wrapped object
(returning the real result
and ignoring `return_value`). Attribute access
on the mock will return a Mock object that wraps the corresponding
attribute of the wrapped object (so attempting to access an attribute
that doesn't exist will
raise an `AttributeError`).
(returning the real result
). Attribute access on the mock will return a
Mock object that wraps the corresponding attribute of the wrapped
object (so attempting to access an attribute that doesn't exist will
raise an `AttributeError`).
If the mock has an explicit `return_value` set then calls are not passed
to the wrapped object and the `return_value` is returned instead.
...
...
Lib/unittest/mock.py
View file @
0682a0c0
...
...
@@ -941,12 +941,12 @@ class Mock(CallableMixin, NonCallableMock):
this is a new Mock (created on first access). See the
`return_value` attribute.
* `wraps`: Item for the mock object to wrap. If `wraps` is not None
then
calling the Mock will pass the call through to the wrapped object
(returning the real result
and ignoring `return_value`). Attribute
access on the mock will return a Mock object that wraps the corresponding
attribute of the wrapped object (so attempting to access an attribute that
doesn't exist will raise an
`AttributeError`).
* `wraps`: Item for the mock object to wrap. If `wraps` is not None
then
calling the Mock will pass the call through to the wrapped object
(returning the real result
). Attribute access on the mock will return a
Mock object that wraps the corresponding attribute of the wrapped object
(so attempting to access an attribute that doesn't exist will raise an
`AttributeError`).
If the mock has an explicit `return_value` set then calls are not passed
to the wrapped object and the `return_value` is returned instead.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment