What steps will reproduce the problem?
from mock import patch
def foobar():
data = {
'first_name': 'Foo',
'last_name': 'Bar',
'title': 'Mr'
}
print_data(data)
data['address'] = 'homeless'
def print_data(data):
print data
@patch('__main__.print_data')
def test_foobar(mock_print_data):
data = {
'first_name': 'Foo',
'last_name': 'Bar',
'title': 'Mr'
}
foobar()
mock_print_data.assert_called_with(data)
test_foobar()
What is the expected output? What do you see instead?
Expected output is that the call is made with data and the test passes.
What happens is an assertion error is raised with the data that was appended
AFTER the call being the culprit:
AssertionError: Expected call: print_data({'first_name': 'Foo', 'last_name':
'Bar', 'title': 'Mr'})
Actual call: print_data({'first_name': 'Foo', 'last_name': 'Bar', 'address':
'homeless', 'title': 'Mr'})
What version of the product are you using? On what operating system?
mock - 1.0.1
osx - 10.10.2
python - 2.7.9
Please provide any additional information below.
Original issue reported on code.google.com by ArrantSq...@gmail.com on 3 Feb 2015 at 9:05
Original issue reported on code.google.com by
ArrantSq...@gmail.com
on 3 Feb 2015 at 9:05