mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-17 20:39:12 +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:
27
tests/spaces/utils.py
Normal file
27
tests/spaces/utils.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from typing import List
|
||||
|
||||
import numpy as np
|
||||
|
||||
from gym.spaces import Box, Discrete, MultiBinary, MultiDiscrete, Space, Text
|
||||
|
||||
TESTING_FUNDAMENTAL_SPACES = [
|
||||
Discrete(3),
|
||||
Discrete(3, start=-1),
|
||||
Box(low=0.0, high=1.0),
|
||||
Box(low=0.0, high=np.inf, shape=(2, 2)),
|
||||
Box(low=np.array([-10.0, 0.0]), high=np.array([10.0, 10.0]), dtype=np.float64),
|
||||
Box(low=-np.inf, high=0.0, shape=(2, 1)),
|
||||
Box(low=0.0, high=np.inf, shape=(2, 1)),
|
||||
MultiDiscrete([2, 2]),
|
||||
MultiDiscrete([[2, 3], [3, 2]]),
|
||||
MultiBinary(8),
|
||||
MultiBinary([2, 3]),
|
||||
Text(6),
|
||||
Text(min_length=3, max_length=6),
|
||||
Text(6, charset="abcdef"),
|
||||
]
|
||||
TESTING_FUNDAMENTAL_SPACES_IDS = [f"{space}" for space in TESTING_FUNDAMENTAL_SPACES]
|
||||
|
||||
|
||||
TESTING_SPACES: List[Space] = TESTING_FUNDAMENTAL_SPACES # + TESTING_COMPOSITE_SPACES
|
||||
TESTING_SPACES_IDS = TESTING_FUNDAMENTAL_SPACES_IDS # + TESTING_COMPOSITE_SPACES_IDS
|
Reference in New Issue
Block a user