def test_requires_non_null(self): with self.assertRaises(TypeError): ts.in_array23(None)
def test_no_bigger_dimensions(self): array = np.arange(100, 200, dtype='int32').reshape(2, 5, 5, 2) with self.assertRaises(ValueError): ts.in_array23(array)
def test_no_other_data_type(self): array = np.arange(100, 150, dtype='double').reshape(10, 5) with self.assertRaises(ValueError): ts.in_array23(array)
def test_non_contiguous_array_3d(self): array = np.empty((3, 4, 5, 8), dtype='int32')[...,2] self.assertEqual((flatten(array), 3, 4, 5), ts.in_array23(array))
def test_non_contiguous_array_2d(self): array = np.arange(150, dtype='int32').reshape((3, 5, 10))[..., 1] self.assertEqual((flatten(array), 0, 3, 5), ts.in_array23(array))
def test_run_3d(self): array = np.arange(100, 150, dtype='int32').reshape(10, 1, 5) expected_result = (flatten(array),) + tuple(array.shape) self.assertEqual(expected_result, ts.in_array23(array))