Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_himmelblau_dim_fail(outdim):
"""Test himmelblau dim exception"""
with pytest.raises(IndexError):
fx.himmelblau(outdim)
def test_himmelblau_output(x):
"""Tests himmelblau function output."""
assert np.isclose(fx.himmelblau(x), np.zeros(4)).all()
def test_himmelblau_output_size(common_minima, targetdim):
"""Test himmelblau output size."""
assert fx.himmelblau(common_minima).shape == targetdim
def test_himmelblau_bound_fail(outbound):
"""Test himmelblau bound exception"""
with pytest.raises(ValueError):
x = outbound(b["himmelblau"].low, b["himmelblau"].high, size=(3, 2))
fx.himmelblau(x)