The previous implementation was clearly wrong (the isinstance check
would raise TypeError as the second argument would be a bool), but the
tests didn't catch that because the bug led to _is_tensorflow_array
returning False, then _unpack_to_numpy returning the original input,
and then assert_array_equal implicitly converting `result` by calling
`__array__` on it. Fix the test by explicitly checking that `result`
is indeed a numpy array, and also fix _is_tensorflow_array with more
restrictive exception catching (also applied to _is_torch_array,
_is_jax_array, and _is_pandas_dataframe, while we're at it).
The previous implementation was clearly wrong (the isinstance check would raise TypeError as the second argument would be a bool), but the tests didn't catch that because the bug led to _is_tensorflow_array returning False, then _unpack_to_numpy returning the original input, and then assert_array_equal implicitly converting result by calling __array__ on it. Fix the test by explicitly checking that result is indeed a numpy array, and also fix _is_tensorflow_array with more restrictive exception catching (also applied to _is_torch_array, _is_jax_array, and _is_pandas_dataframe, while we're at it).
PR summary
PR checklist