This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author valeriupredoi
Recipients valeriupredoi, xtreak
Date 2020-12-07.13:50:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1607349011.56.0.645840846775.issue42586@roundup.psfhosted.org>
In-reply-to
Content
Hello mate, yes it used to work fine with Python 3.8, no issue with Python 3.9 and numpy if you call mock as 

ob = mg.Mock(spec=np.array([4, 4]))

this results in a nice exception being raised:

Traceback (most recent call last):
  File "/home/valeriu/ESMValCore/tmock.py", line 20, in <module>
    ob = mg.Mock(spec=np.array([4, 4]))
  File "/home/valeriu/miniconda3/envs/esmvalcore39/lib/python3.9/unittest/mock.py", line 409, in __new__
    if spec_arg and _is_async_obj(spec_arg):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

which is pretty normal since that func performs an existence check on an array - hope this helps! Cheers
History
Date User Action Args
2020-12-07 13:50:11valeriupredoisetrecipients: + valeriupredoi, xtreak
2020-12-07 13:50:11valeriupredoisetmessageid: <1607349011.56.0.645840846775.issue42586@roundup.psfhosted.org>
2020-12-07 13:50:11valeriupredoilinkissue42586 messages
2020-12-07 13:50:11valeriupredoicreate