<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi!<div><br></div><div>So, I'm aware of mock.patch.object, but I have a use case at hand that seems to most easily be accomplished by patching properties (/ arbitrary descriptors) on an already existing instance.</div><div><br></div><div>Here's a test case showing my use case, along with a partial implementation that happens to work for me.</div><div><br></div><div><a href="http://paste.pocoo.org/show/469788/">http://paste.pocoo.org/show/469788/</a></div><div><br></div><div>It happens to be that in my case, as of right now I have strictly non-data descriptors, so the quickly thrown together implementation simply uses the AttributeError (yeah sorry :P) to tell if we have a property or not, but obviously this could be done by checking to see if the class' attr has __get__ defined.</div><div><br></div><div>As far as some quick thought can tell, the only issue with this would be when klass.foo was a thing with __get__ while instance_of_klass.foo was an evil thing that replaced the descriptor on itself, but I highly doubt that's something at all to worry about?</div><div><br></div><div>Is there a particular aversion to including at least the possibility of trying to patch a property on an instance by doing something similar?</div><div><br></div><div>Thanks,</div><div><br></div><div>Julian</div></body></html>