File size: 1,034 Bytes
079c32c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import pytest
from easydict import EasyDict
import numpy as np
from dizoo.box2d.bipedalwalker.envs import BipedalWalkerEnv
@pytest.mark.envtest
class TestBipedalWalkerEnv:
def test_naive(self):
env = BipedalWalkerEnv(EasyDict({'act_scale': True, 'rew_clip': True, 'replay_path': None}))
env.seed(123)
assert env._seed == 123
obs = env.reset()
assert obs.shape == (24, )
for i in range(10):
random_action = env.random_action()
timestep = env.step(random_action)
print(timestep)
assert isinstance(timestep.obs, np.ndarray)
assert isinstance(timestep.done, bool)
assert timestep.obs.shape == (24, )
assert timestep.reward.shape == (1, )
assert timestep.reward >= env.reward_space.low
assert timestep.reward <= env.reward_space.high
# assert isinstance(timestep, tuple)
print(env.observation_space, env.action_space, env.reward_space)
env.close()
|