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

Method testFindAll

dm_control/mjcf/element_test.py:752–777  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

750 'submodel//unnamed_joint_1')
751
752 def testFindAll(self):
753 mujoco = parser.from_path(_TEST_MODEL_XML)
754 mujoco.model = 'model'
755
756 submujoco = copy.copy(mujoco)
757 submujoco.model = 'submodel'
758
759 subsubmujoco = copy.copy(mujoco)
760 subsubmujoco.model = 'subsubmodel'
761
762 submujoco.find('site', 'attachment').attach(subsubmujoco)
763 mujoco.attach(submujoco)
764
765 geoms = mujoco.find_all('geom')
766 self.assertLen(geoms, 6)
767 self.assertEqual(geoms[0].root, mujoco)
768 self.assertEqual(geoms[1].root, mujoco)
769 self.assertEqual(geoms[2].root, submujoco)
770 self.assertEqual(geoms[3].root, subsubmujoco)
771 self.assertEqual(geoms[4].root, subsubmujoco)
772 self.assertEqual(geoms[5].root, submujoco)
773
774 b_0 = submujoco.find('body', 'b_0')
775 self.assertLen(b_0.find_all('joint'), 6)
776 self.assertLen(b_0.find_all('joint', immediate_children_only=True), 1)
777 self.assertLen(b_0.find_all('joint', exclude_attachments=True), 2)
778
779 def testFindAllFrameJoints(self):
780 root_model = parser.from_path(_TEST_MODEL_XML)

Callers

nothing calls this directly

Calls 5

assertEqualMethod · 0.80
copyMethod · 0.45
attachMethod · 0.45
findMethod · 0.45
find_allMethod · 0.45

Tested by

no test coverage detected