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_easom_dim_fail(outdim):
"""Test easom dim exception"""
with pytest.raises(IndexError):
fx.easom(outdim)
def test_easom_bound_fail(outbound):
"""Test easom bound exception"""
with pytest.raises(ValueError):
x = outbound(b["easom"].low, b["easom"].high, size=(3, 2))
fx.easom(x)
def test_easom_output_size(common_minima2, targetdim):
"""Test easom output size."""
assert fx.easom([-10, 0] * common_minima2).shape == targetdim
def test_easom_output(common_minima2):
"""Tests easom function output."""
assert np.isclose(
fx.easom([np.pi, np.pi] * common_minima2), (-1 * np.ones(3))
).all()