Exemplo n.º 1
0
 def test_lazy_with_lazy(self):
     dm = DataManager(as_lazy_data(self.real_array))
     data = as_lazy_data(self.real_array) * 10
     result = dm._deepcopy(self.memo, data=data)
     expected = DataManager(data)
     self.assertEqual(result, expected)
     self.assertIs(result._lazy_array, data)
Exemplo n.º 2
0
 def test_real_with_real(self):
     dm = DataManager(self.real_array)
     data = self.real_array.copy() * 10
     result = dm._deepcopy(self.memo, data=data)
     expected = DataManager(data)
     self.assertEqual(result, expected)
     self.assertIs(result._real_array, data)
Exemplo n.º 3
0
 def test_real_with_real(self):
     dm = DataManager(self.real_array)
     data = self.real_array.copy() * 10
     result = dm._deepcopy(self.memo, data=data)
     expected = DataManager(data)
     self.assertEqual(result, expected)
     self.assertIs(result._real_array, data)
Exemplo n.º 4
0
 def test_lazy_with_lazy(self):
     dm = DataManager(as_lazy_data(self.real_array))
     data = as_lazy_data(self.real_array) * 10
     result = dm._deepcopy(self.memo, data=data)
     expected = DataManager(data)
     self.assertEqual(result, expected)
     self.assertIs(result._lazy_array, data)
Exemplo n.º 5
0
 def test_lazy_with_realised_dtype(self):
     dm = DataManager(as_lazy_data(self.real_array),
                      realised_dtype=np.dtype('int16'))
     data = as_lazy_data(self.real_array) * 10
     dtype = np.dtype('int8')
     result = dm._deepcopy(self.memo, data=data, realised_dtype=dtype)
     expected = DataManager(data, realised_dtype=dtype)
     self.assertEqual(result, expected)
     self.assertIs(result._lazy_array, data)
Exemplo n.º 6
0
 def test_lazy_with_realised_dtype(self):
     dm = DataManager(as_lazy_data(self.real_array),
                      realised_dtype=np.dtype('int16'))
     data = as_lazy_data(self.real_array) * 10
     dtype = np.dtype('int8')
     result = dm._deepcopy(self.memo, data=data, realised_dtype=dtype)
     expected = DataManager(data, realised_dtype=dtype)
     self.assertEqual(result, expected)
     self.assertIs(result._lazy_array, data)
Exemplo n.º 7
0
 def test_lazy(self):
     dm = DataManager(as_lazy_data(self.real_array))
     result = dm._deepcopy(self.memo)
     self.assertEqual(dm, result)
Exemplo n.º 8
0
 def test_real(self):
     dm = DataManager(self.real_array)
     result = dm._deepcopy(self.memo)
     self.assertEqual(dm, result)
Exemplo n.º 9
0
 def test_real(self):
     dm = DataManager(self.real_array)
     result = dm._deepcopy(self.memo)
     self.assertEqual(dm, result)
Exemplo n.º 10
0
 def test__set_fill_value(self):
     fill_value = 1234
     dm = DataManager(np.array(0))
     self.assertIsNone(dm.fill_value)
     result = dm._deepcopy(self.memo, fill_value=fill_value)
     self.assertEqual(result.fill_value, fill_value)
Exemplo n.º 11
0
 def test__default_fill_value(self):
     dm = DataManager(np.array(0))
     self.assertIsNone(dm.fill_value)
     result = dm._deepcopy(self.memo)
     self.assertIsNone(result.fill_value)
Exemplo n.º 12
0
 def test_real_with_realised_dtype_failure(self):
     dm = DataManager(self.real_array)
     emsg = 'Cannot copy'
     with self.assertRaisesRegexp(ValueError, emsg):
         dm._deepcopy(self.memo, realised_dtype=np.dtype('int16'))
Exemplo n.º 13
0
 def test_lazy_with_realised_dtype_failure(self):
     dm = DataManager(as_lazy_data(self.real_array))
     emsg = 'Cannot copy'
     with self.assertRaisesRegexp(ValueError, emsg):
         dm._deepcopy(self.memo, realised_dtype=np.dtype('float32'))
Exemplo n.º 14
0
 def test_real_with_realised_dtype_failure(self):
     dm = DataManager(self.real_array)
     emsg = 'Cannot copy'
     with self.assertRaisesRegexp(ValueError, emsg):
         dm._deepcopy(self.memo, realised_dtype=np.dtype('int16'))
Exemplo n.º 15
0
 def test_lazy(self):
     dm = DataManager(as_lazy_data(self.real_array))
     result = dm._deepcopy(self.memo)
     self.assertEqual(dm, result)
Exemplo n.º 16
0
 def test_lazy_with_lazy_failure(self):
     dm = DataManager(as_lazy_data(self.real_array))
     emsg = 'Cannot copy'
     with self.assertRaisesRegexp(ValueError, emsg):
         dm._deepcopy(self.memo, data=as_lazy_data(np.array(0)))
Exemplo n.º 17
0
 def test__default_fill_value(self):
     dm = DataManager(np.array(0))
     self.assertIsNone(dm.fill_value)
     result = dm._deepcopy(self.memo)
     self.assertIsNone(result.fill_value)
Exemplo n.º 18
0
 def test_lazy_with_realised_dtype_failure(self):
     dm = DataManager(as_lazy_data(self.real_array))
     emsg = 'Cannot copy'
     with self.assertRaisesRegexp(ValueError, emsg):
         dm._deepcopy(self.memo, realised_dtype=np.dtype('float32'))
Exemplo n.º 19
0
 def test__default_with_fill_value(self):
     fill_value = 1234
     dm = DataManager(np.array(0), fill_value=fill_value)
     self.assertEqual(dm.fill_value, fill_value)
     result = dm._deepcopy(self.memo)
     self.assertEqual(result.fill_value, fill_value)
Exemplo n.º 20
0
 def test_lazy_with_lazy_failure(self):
     dm = DataManager(as_lazy_data(self.real_array))
     emsg = 'Cannot copy'
     with self.assertRaisesRegexp(ValueError, emsg):
         dm._deepcopy(self.memo, data=as_lazy_data(np.array(0)))
Exemplo n.º 21
0
 def test__set_fill_value(self):
     fill_value = 1234
     dm = DataManager(np.array(0))
     self.assertIsNone(dm.fill_value)
     result = dm._deepcopy(self.memo, fill_value=fill_value)
     self.assertEqual(result.fill_value, fill_value)
Exemplo n.º 22
0
 def test__default_with_fill_value(self):
     fill_value = 1234
     dm = DataManager(np.array(0), fill_value=fill_value)
     self.assertEqual(dm.fill_value, fill_value)
     result = dm._deepcopy(self.memo)
     self.assertEqual(result.fill_value, fill_value)
Exemplo n.º 23
0
 def test__set_fill_value_failure(self):
     dm = DataManager(np.array(0))
     self.assertIsNone(dm.fill_value)
     emsg = 'Cannot copy'
     with self.assertRaisesRegexp(ValueError, emsg):
         dm._deepcopy(self.memo, fill_value=1e+20)
Exemplo n.º 24
0
 def test__set_fill_value_failure(self):
     dm = DataManager(np.array(0))
     self.assertIsNone(dm.fill_value)
     emsg = 'Cannot copy'
     with self.assertRaisesRegexp(ValueError, emsg):
         dm._deepcopy(self.memo, fill_value=1e+20)
Exemplo n.º 25
0
 def test_real_with_real_failure(self):
     dm = DataManager(self.real_array)
     emsg = "Cannot copy"
     with self.assertRaisesRegex(ValueError, emsg):
         dm._deepcopy(self.memo, data=np.array(0))