[issue25000] _mock_call does not properly grab args and kwargs

2015-09-04 Thread Alex Etling

New submission from Alex Etling:

Consider the following lines of code:

def test_mock(val):
fake_mock = Mock()
a = {}  
fake_mock.func(a)
a['val'] = 5
fake_mock.func.assert_has_calls([call({})])
What i would expect would be for this statement to pass. What I actually see is 
the following:

Traceback (most recent call last):
File "/gc/gclib/python/tests/kafka_production/encoding_test.py", line 121, in 
test_mock
fake_mock.func.assert_has_calls([call({})])
File "/usr/local/lib/python2.7/dist-packages/mock.py", line 863, in 
assert_has_calls
'Actual: %r' % (calls, self.mock_calls)
AssertionError: Calls not found.
Expected: [call({})]
Actual: [call({'val': 5})]
Mock thinks that I have passed in {'val': 5}, when I in fact did pass in {}. 
The errors seems to be the way args and kwargs are being grabbed in _mock_call 
function

--
components: Macintosh
messages: 249757
nosy: ned.deily, paetling, ronaldoussoren
priority: normal
severity: normal
status: open
title: _mock_call does not properly grab args and kwargs
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 
<http://bugs.python.org/issue25000>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25000] _mock_call does not properly grab args and kwargs

2015-09-04 Thread Alex Etling

Alex Etling added the comment:

I attempted to fix this by just deepcopying on creation of the _call object, on 
line 927 of mock.py but this caused a lot of strange errors I did not expect.  
If you could advise on how best to proceed to fix, I would greatly appreciate 
it.

--

___
Python tracker 
<http://bugs.python.org/issue25000>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com