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

Method test_caching

dm_control/mjcf/physics_test.py:225–239  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

223 self.assertEqual(0, binding.act)
224
225 def test_caching(self):
226 all_joints = self.model.find_all('joint')
227
228 original = self.physics.bind(all_joints)
229 cached = self.physics.bind(all_joints)
230 self.assertIs(cached, original)
231
232 different_order = self.physics.bind(all_joints[::-1])
233 self.assertIsNot(different_order, original)
234
235 # Reloading the `Physics` instance should clear the cache.
236 self.physics.reload_from_xml_string(
237 self.model.to_xml_string(), assets=self.model.get_assets())
238 after_reload = self.physics.bind(all_joints)
239 self.assertIsNot(after_reload, original)
240
241 def test_exceptions(self):
242 joint = self.model.find_all('joint')[0]

Callers

nothing calls this directly

Calls 5

get_assetsMethod · 0.80
find_allMethod · 0.45
bindMethod · 0.45
to_xml_stringMethod · 0.45

Tested by

no test coverage detected