Add testing for Fundamental spaces with full coverage (#3048)

* initial commit

* Fix the multi-binary sample and upgrade multi-discrete sample

* Fix MultiBinary sample tests and pre-commit

* Adds coverage tests and updates test_utils.py to use the utils.py spaces. Fix bug in text.py

* pre-commit
This commit is contained in:
Mark Towers
2022-09-03 22:56:29 +01:00
committed by GitHub
parent 43b42d5280
commit 8e74fe3b62
17 changed files with 933 additions and 1456 deletions

View File

@@ -0,0 +1,24 @@
from functools import partial
import pytest
from gym import Space
from gym.spaces import utils
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()