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
920f6db1
Commit
920f6db1
authored
Sep 10, 2015
by
Berker Peksag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use print function in mock docs.
parent
3fc536f1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
Doc/library/unittest.mock.rst
Doc/library/unittest.mock.rst
+6
-6
No files found.
Doc/library/unittest.mock.rst
View file @
920f6db1
...
@@ -532,7 +532,7 @@ the *new_callable* argument to :func:`patch`.
...
@@ -532,7 +532,7 @@ the *new_callable* argument to :func:`patch`.
keyword arguments (or an empty dictionary).
keyword arguments (or an empty dictionary).
>>> mock = Mock(return_value=None)
>>> mock = Mock(return_value=None)
>>> print
mock.call_args
>>> print
(mock.call_args)
None
None
>>> mock()
>>> mock()
>>> mock.call_args
>>> mock.call_args
...
@@ -727,7 +727,7 @@ apply to method calls on the mock object.
...
@@ -727,7 +727,7 @@ apply to method calls on the mock object.
>>> with patch('__main__.Foo.foo', new_callable=PropertyMock) as mock_foo:
>>> with patch('__main__.Foo.foo', new_callable=PropertyMock) as mock_foo:
... mock_foo.return_value = 'mockity-mock'
... mock_foo.return_value = 'mockity-mock'
... this_foo = Foo()
... this_foo = Foo()
... print
this_foo.foo
... print
(this_foo.foo)
... this_foo.foo = 6
... this_foo.foo = 6
...
...
mockity-mock
mockity-mock
...
@@ -1109,7 +1109,7 @@ Another use case might be to replace an object with a :class:`io.StringIO` insta
...
@@ -1109,7 +1109,7 @@ Another use case might be to replace an object with a :class:`io.StringIO` insta
>>> from io import StringIO
>>> from io import StringIO
>>> def foo():
>>> def foo():
... print
'Something'
... print
('Something')
...
...
>>> @patch('sys.stdout', new_callable=StringIO)
>>> @patch('sys.stdout', new_callable=StringIO)
... def test(mock_stdout):
... def test(mock_stdout):
...
@@ -1223,7 +1223,7 @@ ends.
...
@@ -1223,7 +1223,7 @@ ends.
>>> import os
>>> import os
>>> with patch.dict('os.environ', {'newkey': 'newvalue'}):
>>> with patch.dict('os.environ', {'newkey': 'newvalue'}):
... print
os.environ['newkey']
... print
(os.environ['newkey'])
...
...
newvalue
newvalue
>>> assert 'newkey' not in os.environ
>>> assert 'newkey' not in os.environ
...
@@ -1420,9 +1420,9 @@ inform the patchers of the different prefix by setting ``patch.TEST_PREFIX``:
...
@@ -1420,9 +1420,9 @@ inform the patchers of the different prefix by setting ``patch.TEST_PREFIX``:
>>> @patch('__main__.value', 'not three')
>>> @patch('__main__.value', 'not three')
... class Thing:
... class Thing:
... def foo_one(self):
... def foo_one(self):
... print
value
... print
(value)
... def foo_two(self):
... def foo_two(self):
... print
value
... print
(value)
...
...
>>>
>>>
>>> Thing().foo_one()
>>> Thing().foo_one()
...
...
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