def test_numpy_ndarray_instance(self): array = np.arange(10) result = ensure_array(array) self.assertIsInstance(result, NumpyArrayAdapter) assert_array_equal(array, result.ndarray())
def test_other_type(self): with self.assertRaises(TypeError): ensure_array(range(10))
def test_array_instance(self): array = mock.Mock(spec=Array) result = ensure_array(array) self.assertIs(array, result)