Open GoogleCodeExporter opened 8 years ago
The trouble is that calling delattr is the correct thing to do if (for example)
overriding an attribute inherited from a class. In this case "hasattr(obj,
attr)" will return True, but the original value will be non-local and become
local after setting. When patching is complete the correct way to restore the
original value is to delete the value we set.
If you can propose a patch that passes all the existing tests (retains current
behaviour), but fixes the issue, then I'll happily consider it.
Original comment by fuzzyman
on 2 Dec 2012 at 7:58
Here's a patch that passes the current tests and adds a new one:
https://code.google.com/r/bendarnell-mock/source/detail?r=32f174a14fac7af66d7301
8eda14e573c27b7df0
Original comment by ben.darn...@gmail.com
on 3 Dec 2012 at 4:58
Scratch that. The unittest2 tests pass, but the doctests fail (when the target
of the patch is itself a Mock)
Original comment by ben.darn...@gmail.com
on 3 Dec 2012 at 5:05
Original issue reported on code.google.com by
ben.darn...@gmail.com
on 1 Dec 2012 at 6:05