ref argument bug

13 views
Skip to first unread message

김동주

unread,
Mar 11, 2011, 2:03:55 AM3/11/11
to mockito-python
I have some trouble, but I'm not sure it is my fault or bug

sample code like that


from mockito import mock, verify, verifyNoMoreInteractions

m = mock()

dic = {'key': 'value1'}
m.add_something(dic)

dic['key'] = 'value2'
m.add_something(dic)

verify(m).add_something({'key': 'value1'})
verify(m).add_something({'key': 'value2'})
verifyNoMoreInteractions(m)

I expect this test code success but, failed

Because add_something store ref of argument (not copy).

I think add_something should store copy of argument.

szczepiq

unread,
Mar 11, 2011, 5:20:16 AM3/11/11
to mockito...@googlegroups.com, 김동주
Hey,

>Because add_something store ref of argument (not copy).

I agree. Is there a safe way of implementing it? Not all objects are deep-cloneables.

Cheers,
Szczepan


--
You received this message because you are subscribed to the Google Groups "mockito-python" group.
To post to this group, send email to mockito...@googlegroups.com.
To unsubscribe from this group, send email to mockito-pytho...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mockito-python?hl=en.


Reply all
Reply to author
Forward
0 new messages