def test_matyas_bound_fail(self): """Test matyas bound exception""" x = - np.random.uniform(low=10.001,high=100,size=(3,2)) x_ = np.random.uniform(low=10.001,high=100,size=(3,2)) with self.assertRaises(ValueError): fx.matyas_func(x) with self.assertRaises(ValueError): fx.matyas_func(x_)
def test_bukin6_output(common_minima): """Test bukin function output.""" assert np.isclose(fx.matyas_func(common_minima), np.zeros(3)).all()
def test_matyas_bound_fail(outbound): """Test matyas bound exception""" with pytest.raises(ValueError): x = outbound(b["matyas"].low, b["matyas"].high, size=(3, 2)) fx.matyas_func(x)
def test_matyas_dim_fail(outdim): """Test matyas dim exception""" with pytest.raises(IndexError): fx.matyas_func(outdim)
def test_bukin6_output(self): """Test bukin function output.""" assert np.isclose(fx.matyas_func(self.input),self.target).all()
def test_matyas_dim_fail(self): """Test matyas dim exception""" with self.assertRaises(IndexError): fx.matyas_func(self.bad_input)