match=r"expect their types to be np\.ndarray, an integer or a float",
):
Box(low=value,high=value)
@pytest.mark.parametrize(
"low,high,kwargs,error,message",
[
(
0,
1,
{"dtype":None},
AssertionError,
"Box dtype must be explicitly provided, cannot be None.",
),
(
0,
1,
{"shape":(None,)},
AssertionError,
"Expect all shape elements to be an integer, actual type: (<class 'NoneType'>,)",
),
(
0,
1,
{
"shape":(
1,
None,
)
},
AssertionError,
"Expect all shape elements to be an integer, actual type: (<class 'int'>, <class 'NoneType'>)",
),
(
0,
1,
{
"shape":(
np.int64(1),
None,
)
},
AssertionError,
"Expect all shape elements to be an integer, actual type: (<class 'numpy.int64'>, <class 'NoneType'>)",
),
(
None,
None,
{},
ValueError,
"Box shape is inferred from low and high, expect their types to be np.ndarray, an integer or a float, actual type low: <class 'NoneType'>, high: <class 'NoneType'>",
),
(
0,
None,
{},
ValueError,
"Box shape is inferred from low and high, expect their types to be np.ndarray, an integer or a float, actual type low: <class 'int'>, high: <class 'NoneType'>",
),
(
np.zeros(3),
np.ones(2),
{},
AssertionError,
"high.shape doesn't match provided shape, high.shape: (2,), shape: (3,)",