예제 #1
0
 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)
예제 #2
0
 def setUp(self):
     self.a1 = ConstantArray([2, 3])
     self.a2 = ConstantArray([4, 3])
     self.a = LinearMosaic([self.a1, self.a2], axis=0)
예제 #3
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')
예제 #4
0
 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')
예제 #5
0
 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)
예제 #6
0
 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))
예제 #7
0
 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)
예제 #8
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)