Skip to content

Commit

Permalink
set correct values for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaux1 committed May 27, 2024
1 parent c6a3c60 commit 2ba7315
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
6 changes: 4 additions & 2 deletions tests/envs/test_floating_mia_grasp_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ def env():
gui=False,
verbose=False,
horizon=10,
object_name="insole_on_conveyor_belt/back")
object_name="insole_on_conveyor_belt/back",
#observable_object_pos=True,
)


action_space_dims_expected = 10
observation_space_dims_expected = 16
action_space_dims_expected = 10
SEED = 42


Expand Down
8 changes: 3 additions & 5 deletions tests/envs/test_floating_shadow_grasp_env.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import pytest
from numpy.testing import assert_allclose

from deformable_gym.envs.floating_shadow_grasp_env import \
FloatingShadowGraspEnv
from deformable_gym.envs.floating_shadow_grasp_env import (FloatingShadowGraspEnv)


@pytest.fixture
Expand All @@ -16,8 +15,8 @@ def env():
)


observation_space_dims_expected = 28
action_space_dims_expected = 32
observation_space_dims_expected = 31
action_space_dims_expected = 31
SEED = 42


Expand All @@ -35,7 +34,6 @@ def test_obs_space_dims(env: FloatingShadowGraspEnv):
obs_space = env.observation_space
assert obs_space.shape[0] == obs_space_dims_expected


def test_initial_sensor_info(env: FloatingShadowGraspEnv):
sensor_readings = []
env.action_space.seed(SEED)
Expand Down
8 changes: 4 additions & 4 deletions tests/envs/test_ur10_shadow_grasp_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
def env():
return UR10ShadowGraspEnv(
gui=False,
verbose=True,
verbose=False,
horizon=10,
object_name="insole",
#observable_object_pos=True,
observable_object_pos=True,
)


observation_space_dims_expected = 28
action_space_dims_expected = 32
observation_space_dims_expected = 31
action_space_dims_expected = 31
SEED = 42


Expand Down
12 changes: 8 additions & 4 deletions tests/envs/test_ur5_mia_grasp_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
def env():
return UR5MiaGraspEnv(
gui=False,
verbose=True,
verbose=False,
horizon=10,
object_name="insole",
#observable_object_pos=True,
)


Expand All @@ -26,9 +27,12 @@ def test_action_space_dims(env):

def test_obs_space_dims(env):
if env._observable_object_pos:
assert env.observation_space.shape[0] == observation_space_dims_expected + 3
obs_space_dims_expected = observation_space_dims_expected + 3
else:
assert env.observation_space.shape[0] == observation_space_dims_expected
obs_space_dims_expected = observation_space_dims_expected

obs_space = env.observation_space
assert obs_space.shape[0] == obs_space_dims_expected


def test_episode_reproducibility():
Expand Down Expand Up @@ -70,7 +74,7 @@ def test_eps_done(env):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)

assert len(obs) == 16
assert len(obs) == observation_space_dims_expected
assert isinstance(reward, float)
assert isinstance(terminated, bool)
assert not terminated
Expand Down

0 comments on commit 2ba7315

Please sign in to comment.