[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Note however, that the need I have for my type of functionality is fulfilled and all works fine for Python 3.7 and 3.8, I noticed the problem only for 3.9 - the OP in that issue says their versions affected include 3.8 (maybe it creeps up for 3.8.6

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
New submission from Valeriu Predoi : Hey guys, the new unittest.mock.Mock for Python 3.9 can not accept a spec arg if it is a numpy array, it'll accept all other types but not ndarray, have a look at this quick minimal code: import numpy as np from unittest import mock as mg ob = mg.Mock

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Indeed so! Sorry, I only glossed over that one before posting mine, now that I looked at it more carefully you are right, it does need a check on None and not calling the __bool__ member, which is affecting functionally passing an ndarray as spec - what

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: 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/va

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Excellent, just gonna let my team know about this and we'll hold off on 3.9.0 then - good stuff, mate! -- ___ Python tracker <https://bugs.python.org/issue42

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Changed status to pending, will close once we've had 3.9.1 in our env and tested proper, but should be OK, cheers! -- status: pending -> open ___ Python tracker <https://bugs.python.org/issu

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Great, cheers mate, I read through the PR's (and sorry to have pestered you over at the mock backport GitHub too haha) - this looks it will fix the issue nicely. Do you know when will the release be available for us using Python from Anaconda etc.? Feel

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Change by Valeriu Predoi : -- status: open -> pending ___ Python tracker <https://bugs.python.org/issue42586> ___ ___ Python-bugs-list mailing list Unsubscrib