Update spec.from_string() and spec.from_file() to match the respective mjModel functions.
PiperOrigin-RevId: 678230403 Change-Id: I7f3d8c5fd44d30b5695eee1f8513cc27f4158d94
This commit is contained in:
committed by
Copybara-Service
parent
910cd89cc7
commit
5bca7876c4
@@ -611,6 +611,25 @@ class SpecsTest(absltest.TestCase):
|
||||
model = spec.compile({'cube.obj': cube})
|
||||
self.assertEqual(model.nmeshvert, 8)
|
||||
|
||||
def test_include(self):
|
||||
included_xml = """
|
||||
<mujoco>
|
||||
<worldbody>
|
||||
<body>
|
||||
<geom type="box" size="1 1 1"/>
|
||||
</body>
|
||||
</worldbody>
|
||||
</mujoco>
|
||||
"""
|
||||
spec = mujoco.MjSpec()
|
||||
spec.from_string(textwrap.dedent("""
|
||||
<mujoco model="MuJoCo Model">
|
||||
<include file="included.xml"/>
|
||||
</mujoco>
|
||||
"""), {'included.xml': included_xml.encode('utf-8')})
|
||||
self.assertEqual(spec.worldbody.first_body().first_geom().type,
|
||||
mujoco.mjtGeom.mjGEOM_BOX)
|
||||
|
||||
def test_delete(self):
|
||||
filename = '../../test/testdata/model.xml'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user