def test_no_smaller_dimension(self): array = np.arange(100, 150, dtype='int32') with self.assertRaises(ValueError): ts.in_array2_3(array)
def test_requires_non_null(self): with self.assertRaises(TypeError): ts.in_array2_3(None)
def test_no_bigger_dimension(self): array = np.arange(100, 150, dtype='int32').reshape(1, 10, 5) with self.assertRaises(ValueError): ts.in_array2_3(array)
def test_no_other_data_type(self): array = np.arange(100, 150, dtype='float').reshape(10, 5) with self.assertRaises(ValueError): ts.in_array2_3(array)
def test_no_other_width(self): array = np.arange(100, 150, dtype='int32').reshape(5, 10) with self.assertRaises(ValueError): ts.in_array2_3(array)
def test_non_contiguous_array(self): array = np.arange(150, dtype='int32').reshape((3, 5, 10))[..., 2] self.assertEqual((flatten(array), 3, 5), ts.in_array2_3(array))
def test_basic_run(self): array = np.arange(100, 150, dtype='int32').reshape(10, 5) self.assertEqual((flatten(array), 10, 5), ts.in_array2_3(array)) self.assertEqual((flatten(array[1:]), 9, 5), ts.in_array2_3(array[1:]))