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

Method setUp

dm_control/composer/hooks_test_utils.py:269–312  ·  view source on GitHub ↗

Sets up the test case.

(self)

Source from the content-addressed store, hash-verified

267 """A mixin for an `absltest.TestCase` to track call order of callbacks."""
268
269 def setUp(self):
270 """Sets up the test case."""
271 super().setUp()
272
273 self.num_episodes = 5
274 self.steps_per_episode = 100
275
276 self.control_timestep = 0.05
277 self.physics_timestep = 0.002
278
279 self.extra_hooks = HooksTracker(physics_timestep=self.physics_timestep,
280 control_timestep=self.control_timestep,
281 test_case=self)
282
283 self.entities = []
284 for i in range(9):
285 self.entities.append(TrackedEntity(name='entity_{}'.format(i),
286 physics_timestep=self.physics_timestep,
287 control_timestep=self.control_timestep,
288 test_case=self))
289
290 ########################################
291 # Make the following entity hierarchy #
292 # 0 #
293 # 1 2 3 #
294 # 4 5 6 7 #
295 # 8 #
296 ########################################
297
298 self.entities[4].attach(self.entities[8])
299 self.entities[1].attach(self.entities[4])
300 self.entities[1].attach(self.entities[5])
301 self.entities[0].attach(self.entities[1])
302
303 self.entities[2].attach(self.entities[6])
304 self.entities[2].attach(self.entities[7])
305 self.entities[0].attach(self.entities[2])
306
307 self.entities[0].attach(self.entities[3])
308
309 self.task = TrackedTask(root_entity=self.entities[0],
310 physics_timestep=self.physics_timestep,
311 control_timestep=self.control_timestep,
312 test_case=self)
313
314 @contextlib.contextmanager
315 def track_episode(self):

Callers

nothing calls this directly

Calls 4

HooksTrackerClass · 0.85
TrackedEntityClass · 0.85
TrackedTaskClass · 0.85
attachMethod · 0.45

Tested by

no test coverage detected