Vedran Čačić added the comment: > # passes, even though we didn't make the exact same call twice!
Weird. It looks like a matter of perspective, but to me it surely _does_ seem like you _did_ make the exact same call twice. > test_function(arg) > test_function(arg) Neither test_function nor arg were rebound in the meantime. (If there's a "bug", it's a subtle thing that += seems like rebinding, and in fact it does rebind immutable objects. But that's off topic here.) [*Also, it could be argued that assert_has_calls should compare the arguments with `is` instead of `==`, but that would probably break too many things.] But let's try to be constructive. IIRC, unittest was modelled after Java's analogous library. Can someone check how Java solves this? I'm pretty sure it has the same "problem" (when arguments are objects), but maybe it keeps the reference semantics totally as conjectured in the previous paragraph. ---------- nosy: +veky _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28318> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com