[issue32153] mock.create_autospec fails if an attribute is a partial function

Anthony Flury report at bugs.python.org
Sat Sep 15 20:02:54 EDT 2018


Anthony Flury <anthony.flury at btinternet.com> added the comment:

It seems to me that we have three alternatives : 

  1. Refuse to create the mock object with a suitable Exception (rather than a crash
  2. Copy the object and simply ignore the missing dunder_name (so that funcopy dunder_name is not set
  3. Set funcopy dunder_name to a known string when the source dunder_name is missing

It seems obvious to me that option 3 is correct - just a question of what funcopy dunder_name should be set to. I would imagine there is code that uses funcopy dunder_name in some way ?

----------
nosy: +anthony-flury

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32153>
_______________________________________


More information about the Python-bugs-list mailing list