Exemple #1
0
 def test_add_nd_array(self):
     # Check that the ElementWise functionality accepts numpy arrays,
     # and the result is as expected.
     r = biggus.add(np.arange(4), np.arange(4) * 2)
     self.assertIsInstance(r._array1, biggus.NumpyArrayAdapter)
     self.assertIsInstance(r._array2, biggus.NumpyArrayAdapter)
     assert_array_equal(r.ndarray(), [0, 3, 6, 9])
Exemple #2
0
 def test_add_nd_array(self):
     # Check that the ElementWise functionality accepts numpy arrays,
     # and the result is as expected.
     r = biggus.add(np.arange(4), np.arange(4) * 2)
     self.assertIsInstance(r._array1, biggus.NumpyArrayAdapter)
     self.assertIsInstance(r._array2, biggus.NumpyArrayAdapter)
     assert_array_equal(r.ndarray(), [0, 3, 6, 9])
Exemple #3
0
 def test_add_integer(self):
     # Check that the ElementWise functionality accepts numpy arrays,
     # and the result is as expected.
     r = biggus.add(np.arange(3) * 2, 5)
     assert_array_equal(r.ndarray(), [5, 7, 9])
Exemple #4
0
 def test_add_non_supported_type(self):
     # Check that the ElementWise functionality raises a TypeError
     # if neither an Array or np.ndarray is given
     with self.assertRaises(TypeError):
         biggus.add(range(12), np.arange(12))
Exemple #5
0
 def test_other_array(self):
     a = FakeArray([2, 4])
     b = FakeArray([2, 4])
     r = a + b
     self.assertIsInstance(r, biggus._Elementwise)
     self.assertElementwise(r, biggus.add(a, b))
Exemple #6
0
 def test_add_integer(self):
     # Check that the ElementWise functionality accepts numpy arrays,
     # and the result is as expected.
     r = biggus.add(np.arange(3) * 2, 5)
     assert_array_equal(r.ndarray(), [5, 7, 9])
Exemple #7
0
 def test_add_non_supported_type(self):
     # Check that the ElementWise functionality raises a TypeError
     # if neither an Array or np.ndarray is given
     with self.assertRaises(TypeError):
         biggus.add(range(12), np.arange(12))
Exemple #8
0
 def test_other_array(self):
     a = FakeArray([2, 4])
     b = FakeArray([2, 4])
     r = a + b
     self.assertIsInstance(r, biggus._Elementwise)
     self.assertElementwise(r, biggus.add(a, b))