Author mcscope@gmail.com
Recipients mcscope@gmail.com, pawelj
Date 2018-05-28.16:32:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527525155.43.0.682650639539.issue33667@psf.upfronthosting.co.za>
In-reply-to
Content
To have the behavior that you are expecting, I believe the mock would have to store a deep copy of every mutable object that is passed in to any of it's calls, in case that object later mutates. 

That would really expand the memory and time footprint of working with a Mock object.  The mock object would grow with every call to. (This is already true, as it's adding to it's mock_calls list... but it would grow much more. )

I'm also not sure about the safety of trying to deepcopy all objects passed in. 

I think that in addition to the safety and memory/performance issues that I've highlighted, deepcopying all objects would lead to it's own unintuitive behaviors.  Objects you get back from mock_call wouldn't be the objects that it was actually called with, they would be copies. 

I am attaching a file that illustrates this last point.
History
Date User Action Args
2018-05-28 16:32:35mcscope@gmail.comsetrecipients: + mcscope@gmail.com, pawelj
2018-05-28 16:32:35mcscope@gmail.comsetmessageid: <1527525155.43.0.682650639539.issue33667@psf.upfronthosting.co.za>
2018-05-28 16:32:35mcscope@gmail.comlinkissue33667 messages
2018-05-28 16:32:35mcscope@gmail.comcreate