2022-09-03 22:56:29 +01:00
|
|
|
from functools import partial
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2022-09-08 10:10:07 +01:00
|
|
|
from gymnasium import Space
|
|
|
|
from gymnasium.spaces import utils
|
2022-09-03 22:56:29 +01:00
|
|
|
|
2022-12-04 22:24:02 +08:00
|
|
|
|
2022-09-03 22:56:29 +01:00
|
|
|
TESTING_SPACE = Space()
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"func",
|
|
|
|
[
|
|
|
|
TESTING_SPACE.sample,
|
|
|
|
partial(TESTING_SPACE.contains, None),
|
|
|
|
partial(utils.flatdim, TESTING_SPACE),
|
|
|
|
partial(utils.flatten, TESTING_SPACE, None),
|
|
|
|
partial(utils.flatten_space, TESTING_SPACE),
|
|
|
|
partial(utils.unflatten, TESTING_SPACE, None),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
def test_not_implemented_errors(func):
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
|
|
func()
|