Raise error if trying to bind with a spec with an empty name.

PiperOrigin-RevId: 731360983
Change-Id: I00365d158c1cae1cd912962ef453f43e93701080
This commit is contained in:
Alessio Quaglino
2025-02-26 10:06:41 -08:00
committed by Copybara-Service
parent ed16f2daf2
commit 1c240d8bad
2 changed files with 13 additions and 2 deletions
+7
View File
@@ -333,6 +333,13 @@ class SupportTest(parameterized.TestCase):
vdx.bind(mx, s.bodies[i]).xpos, [d.xpos[i, :]] * batch_size
)
# test emtpy name
s.worldbody.add_body()
m = s.compile()
mx = mjx.put_model(m)
with self.assertRaises(KeyError, msg='cannot bind spec with empty name'):
mx.bind(s.bodies)
_CONTACTS = """
<mujoco>
<worldbody>