mujoco_maze/tests/test_envs.py

21 lines
577 B
Python
Raw Normal View History

2020-05-25 10:26:57 +02:00
import gym
import pytest
2020-06-24 11:44:47 +02:00
import mujoco_maze
2020-05-25 10:26:57 +02:00
2020-06-29 18:38:02 +02:00
@pytest.mark.parametrize("maze_id", mujoco_maze.TaskRegistry.keys())
2020-05-25 10:26:57 +02:00
def test_ant_maze(maze_id):
env = gym.make("Ant{}-v0".format(maze_id))
2020-05-25 10:26:57 +02:00
assert env.reset().shape == (30,)
2020-06-04 07:38:15 +02:00
s, _, _, _ = env.step(env.action_space.sample())
assert s.shape == (30,)
2020-05-25 10:26:57 +02:00
2020-06-29 18:38:02 +02:00
@pytest.mark.parametrize("maze_id", mujoco_maze.TaskRegistry.keys())
2020-05-25 10:26:57 +02:00
def test_point_maze(maze_id):
env = gym.make("Point{}-v0".format(maze_id))
2020-05-25 10:26:57 +02:00
assert env.reset().shape == (7,)
2020-06-04 07:38:15 +02:00
s, _, _, _ = env.step(env.action_space.sample())
assert s.shape == (7,)