mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-31 10:09:53 +00:00
* feat: add `isort` to `pre-commit` * ci: skip `__init__.py` file for `isort` * ci: make `isort` mandatory in lint pipeline * docs: add a section on Git hooks * ci: check isort diff * fix: isort from master branch * docs: add pre-commit badge * ci: update black + bandit versions * feat: add PR template * refactor: PR template * ci: remove bandit * docs: add Black badge * ci: try to remove all `|| true` statements * ci: remove lint_python job - Remove `lint_python` CI job - Move `pyupgrade` job to `pre-commit` workflow * fix: avoid messing with typing * docs: add a note on running `pre-cpmmit` manually * ci: apply `pre-commit` to the whole codebase
22 lines
572 B
Python
22 lines
572 B
Python
import numpy as np
|
|
import pytest
|
|
|
|
import gym
|
|
from gym import spaces
|
|
from gym.wrappers import FlattenObservation
|
|
|
|
|
|
@pytest.mark.parametrize("env_id", ["Blackjack-v1"])
|
|
def test_flatten_observation(env_id):
|
|
env = gym.make(env_id)
|
|
wrapped_env = FlattenObservation(env)
|
|
|
|
obs = env.reset()
|
|
wrapped_obs = wrapped_env.reset()
|
|
|
|
space = spaces.Tuple((spaces.Discrete(32), spaces.Discrete(11), spaces.Discrete(2)))
|
|
wrapped_space = spaces.Box(0, 1, [32 + 11 + 2], dtype=np.int64)
|
|
|
|
assert space.contains(obs)
|
|
assert wrapped_space.contains(wrapped_obs)
|