コード例 #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])
コード例 #2
0
ファイル: test_elementwise.py プロジェクト: Jozhogg/biggus
 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])
コード例 #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])
コード例 #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))
コード例 #5
0
ファイル: test_Array.py プロジェクト: rhattersley/biggus
 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))
コード例 #6
0
ファイル: test_elementwise.py プロジェクト: Jozhogg/biggus
 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])
コード例 #7
0
ファイル: test_elementwise.py プロジェクト: Jozhogg/biggus
 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))
コード例 #8
0
ファイル: test_Array.py プロジェクト: JosephHogg/biggus
 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))