Tests using numpy fail with bool and palette problem
python -m pytest
fails with (ultimately):
# palette sets colormap only if colormap has been defaulted
if colormap is None:
> colormap = bool(palette)
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The problem is that a numpy
array can not (any longer) be used as a palette. Because bool(x) fails when x is a numpy array. This used to work, but it seems unlikely that the numpy array would have had the same semantics as a Python list. For a Python list l bool(l)
will use the length as a bool value; numpy evaluated each element (i think).
No idea when numpy introduced this change, but for me it fails for numpy
version 1.20.3 on Python 3.9 and more recent versions on Python 3.10 and Python 3.11.