MCPcopy Create free account
hub / github.com/numpy/numpy / __bool__

Method __bool__

numpy/ma/tests/test_core.py:255–256  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

253 # an object array that cannot be converted to bool always:
254 class NotBool():
255 def __bool__(self):
256 raise ValueError("not a bool!")
257 masked_obj = np.ma.masked_array([NotBool(), 'b'], mask=[True, False])
258 # Check that the NotBool actually fails like we would expect:
259 with pytest.raises(ValueError, match="not a bool!"):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected