def test_3d_input(self): """Test 3D input results in expected error""" input_array = np.array([[[-40, 200, 1000]]]) msg = "Expected 2D input" with self.assertRaisesRegex(ValueError, msg): concatenate_2d_array_with_2d_array_endpoints( input_array, -100, 10000)
def test_3d_input(self): """ Test that a 3d input array results in the expected error. """ input_array = np.array([[[-40, 200, 1000]]]) msg = "all the input arrays must have same number of dimensions" with self.assertRaisesRegex(ValueError, msg): concatenate_2d_array_with_2d_array_endpoints( input_array, -100, 10000)
def test_basic(self): """Test that result is a numpy array with the expected contents.""" expected = np.array([[0, 20, 50, 80, 100]]) input_array = np.array([[20, 50, 80]]) result = concatenate_2d_array_with_2d_array_endpoints(input_array, 0, 100) self.assertIsInstance(result, np.ndarray) self.assertArrayAlmostEqual(result, expected)
def test_another_example(self): """ Another basic test that the result is a numpy array with the expected contents. """ expected = np.array( [[-100, -40, 200, 1000, 10000], [-100, -40, 200, 1000, 10000]]) input_array = np.array([[-40, 200, 1000], [-40, 200, 1000]]) result = concatenate_2d_array_with_2d_array_endpoints( input_array, -100, 10000) self.assertIsInstance(result, np.ndarray) self.assertArrayAlmostEqual(result, expected)