def test_schaffer2_bound_fail(outbound):
    """Test schaffer2 bound exception"""
    with pytest.raises(ValueError):
        x = outbound(
            b["schaffer2"].low, b["schaffer2"].high, tol=200, size=(3, 2)
        )
        fx.schaffer2(x)
Exemplo n.º 2
0
def test_schaffer2_dim_fail(outdim):
    """Test schaffer2 dim exception"""
    with pytest.raises(IndexError):
        fx.schaffer2(outdim)
def test_schaffer2_output_size(common_minima, targetdim):
    """Test schaffer2 output size."""
    assert fx.schaffer2(common_minima).shape == targetdim
Exemplo n.º 4
0
def test_schaffer2_output(common_minima):
    """Test schaffer2 function output."""
    assert np.isclose(fx.schaffer2(common_minima), np.zeros(3)).all()