Esempio n. 1
0
 def test_values(self):
     shape = (3, 4, 5)
     value = 81
     array = ConstantArray(shape, value)
     result = array.ndarray()
     expected = np.empty(shape)
     expected[()] = value
     np.testing.assert_array_equal(result, expected)
Esempio n. 2
0
 def test_values(self):
     shape = (3, 4, 5)
     value = 81
     array = ConstantArray(shape, value)
     result = array.ndarray()
     expected = np.empty(shape)
     expected[()] = value
     np.testing.assert_array_equal(result, expected)
Esempio n. 3
0
 def test_dtype_default(self):
     shape = (3, 4, 5)
     array = ConstantArray(shape)
     result = array.ndarray()
     self.assertEqual(result.dtype, np.dtype('f8'))
Esempio n. 4
0
 def test_dtype(self):
     shape = (3, 4, 5)
     array = ConstantArray(shape, dtype='i4')
     result = array.ndarray()
     self.assertEqual(result.dtype, np.dtype('i4'))
Esempio n. 5
0
 def test_values_default(self):
     shape = (3, 4, 5)
     array = ConstantArray(shape)
     result = array.ndarray()
     np.testing.assert_array_equal(result, np.zeros(shape))
Esempio n. 6
0
 def test_dtype_default(self):
     shape = (3, 4, 5)
     array = ConstantArray(shape)
     result = array.ndarray()
     self.assertEqual(result.dtype, np.dtype("f8"))
Esempio n. 7
0
 def test_dtype(self):
     shape = (3, 4, 5)
     array = ConstantArray(shape, dtype="i4")
     result = array.ndarray()
     self.assertEqual(result.dtype, np.dtype("i4"))
Esempio n. 8
0
 def test_values_default(self):
     shape = (3, 4, 5)
     array = ConstantArray(shape)
     result = array.ndarray()
     np.testing.assert_array_equal(result, np.zeros(shape))