keyword arguments (or an empty dictionary).
>>> mock = Mock(return_value=None)
- >>> print mock.call_args
+ >>> print(mock.call_args)
None
>>> mock()
>>> mock.call_args
>>> with patch('__main__.Foo.foo', new_callable=PropertyMock) as mock_foo:
... mock_foo.return_value = 'mockity-mock'
... this_foo = Foo()
- ... print this_foo.foo
+ ... print(this_foo.foo)
... this_foo.foo = 6
...
mockity-mock
>>> from io import StringIO
>>> def foo():
- ... print 'Something'
+ ... print('Something')
...
>>> @patch('sys.stdout', new_callable=StringIO)
... def test(mock_stdout):
>>> import os
>>> with patch.dict('os.environ', {'newkey': 'newvalue'}):
- ... print os.environ['newkey']
+ ... print(os.environ['newkey'])
...
newvalue
>>> assert 'newkey' not in os.environ
>>> @patch('__main__.value', 'not three')
... class Thing:
... def foo_one(self):
- ... print value
+ ... print(value)
... def foo_two(self):
- ... print value
+ ... print(value)
...
>>>
>>> Thing().foo_one()