mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-22 07:02:19 +00:00
Add explicit error messages when unflatten discrete and multidiscrete fail (#267)
This commit is contained in:
@@ -135,3 +135,15 @@ def test_flatten_roundtripping(space):
|
||||
|
||||
for original, roundtripped in zip(samples, unflattened_samples):
|
||||
assert data_equivalence(original, roundtripped)
|
||||
|
||||
|
||||
def test_unflatten_discrete_error():
|
||||
value = np.array([0])
|
||||
with pytest.raises(ValueError):
|
||||
utils.unflatten(gym.spaces.Discrete(1), value)
|
||||
|
||||
|
||||
def test_unflatten_multidiscrete_error():
|
||||
value = np.array([0, 0])
|
||||
with pytest.raises(ValueError):
|
||||
utils.unflatten(gym.spaces.MultiDiscrete([1, 1]), value)
|
||||
|
Reference in New Issue
Block a user