Closed GoogleCodeExporter closed 8 years ago
What is happening here (with the case that doesn't work) is that you are
putting a method object into a dictionary. Then your "call_method_from_dict"
fetches the object back out of the dictionary and calls it.
patch works by overriding name lookup (with the patch in place looking up the
method "dummy_method" returns the mock). With "call_method_from_dict" the
*name* "dummy_method" is never looked up, the object is fetched out of the
dictionary.
You could use patch.dict to replace the method in the dictionary instead.
Original comment by fuzzyman
on 10 Nov 2011 at 10:36
Original issue reported on code.google.com by
misha...@gmail.com
on 10 Nov 2011 at 10:14Attachments: