MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / test_timeout

Method test_timeout

dm_control/rl/control_test.py:74–91  ·  view source on GitHub ↗
(self, expected_steps, physics_timestep, control_timestep)

Source from the content-addressed store, hash-verified

72 {'physics_timestep': .01, 'control_timestep': .05,
73 'expected_steps': 5000})
74 def test_timeout(self, expected_steps, physics_timestep, control_timestep):
75 self._physics.timestep.return_value = physics_timestep
76 time_limit = expected_steps * (control_timestep or physics_timestep)
77 env = control.Environment(
78 physics=self._physics, task=self._task, time_limit=time_limit,
79 control_timestep=control_timestep)
80
81 time_step = env.reset()
82 steps = 0
83 while not time_step.last():
84 time_step = env.step([1])
85 steps += 1
86
87 self.assertEqual(steps, expected_steps)
88 self.assertTrue(time_step.last())
89
90 time_step = env.step([1])
91 self.assertTrue(time_step.first())
92
93 def test_observation_spec(self):
94 observation_spec = self._env.observation_spec()

Callers

nothing calls this directly

Calls 4

resetMethod · 0.95
stepMethod · 0.95
assertEqualMethod · 0.80
firstMethod · 0.80

Tested by

no test coverage detected