def test_not_arrays(self): class BadArray(object): dtype = 'f' fill_value = 9 ndim = 1 shape = (4,) bad_arrays = [BadArray()] with self.assertRaisesRegexp(ValueError, 'subclass'): LinearMosaic(bad_arrays, 0)
def setUp(self): self.a1 = ConstantArray([2, 3]) self.a2 = ConstantArray([4, 3]) self.a = LinearMosaic([self.a1, self.a2], axis=0)
def test_different_strings(self): array1 = fake_array('foo', np.dtype('S3')) array2 = fake_array('bar', np.dtype('S3')) mosaic = LinearMosaic(np.array([array1, array2]), 0) self.assertEqual(mosaic.fill_value, 'N/A')
def test_matching_strings(self): array1 = fake_array('foo', np.dtype('S3')) array2 = fake_array('foo', np.dtype('S3')) mosaic = LinearMosaic(np.array([array1, array2]), 0) self.assertEqual(mosaic.fill_value, 'foo')
def test_number_other_number(self): array1 = fake_array(42) array2 = fake_array(43) mosaic = LinearMosaic(np.array([array1, array2]), 0) self.assertEqual(mosaic.fill_value, 1e+20)
def test_nan_nan(self): array1 = fake_array(np.nan) array2 = fake_array(np.nan) mosaic = LinearMosaic(np.array([array1, array2]), 0) self.assertTrue(np.isnan(mosaic.fill_value))
def test_different_strings(self): array1 = fake_array('foo', np.dtype('S3')) array2 = fake_array('bar', np.dtype('S3')) with self.assertRaises(ValueError): mosaic = LinearMosaic(np.array([array1, array2]), 0)
def test_number_other_number(self): array1 = fake_array(42) array2 = fake_array(43) with self.assertRaises(ValueError): mosaic = LinearMosaic(np.array([array1, array2]), 0)