def test_beale_bound_fail(self): """Test beale bound exception""" x = - np.random.uniform(low=4.6666,high=100,size=(3,2)) x_ = np.random.uniform(low=4.6666,high=100,size=(3,2)) with self.assertRaises(ValueError): fx.beale_func(x) with self.assertRaises(ValueError): fx.beale_func(x_)
def test_beale_output(common_minima2): """Tests beale function output.""" assert np.isclose(fx.beale_func([3, 0.5] * common_minima2), np.zeros(3)).all()
def test_beale_bound_fail(outbound): """Test beale bound exception""" with pytest.raises(ValueError): x = outbound(b["beale"].low, b["beale"].high, size=(3, 2)) fx.beale_func(x)
def test_beale_dim_fail(outdim): """Test beale dim exception""" with pytest.raises(IndexError): fx.beale_func(outdim)
def test_beale_output_size(self): """Tests beale output size.""" self.assertEqual(fx.beale_func(self.input).shape, self.target_size)
def test_beale_output(self): """Tests beale function output.""" assert np.isclose(fx.beale_func([3, 0.5] * self.input2), self.target).all()
def test_beale_dim_fail(self): """Test beale dim exception""" with self.assertRaises(IndexError): fx.beale_func(self.bad_input)
def test_beale_output_size(common_minima, targetdim): """Tests beale output size.""" assert fx.beale_func(common_minima).shape == targetdim