mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-23 15:04:20 +00:00
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:
24
tests/spaces/test_space.py
Normal file
24
tests/spaces/test_space.py
Normal 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()
|
Reference in New Issue
Block a user