Check for duplicated names when setting element names.
PiperOrigin-RevId: 778827590 Change-Id: I77a208c1571cf735cae80840ea830aa347681f71
This commit is contained in:
committed by
Copybara-Service
parent
594e17074a
commit
564c51ddb9
@@ -887,7 +887,7 @@ class SpecsTest(absltest.TestCase):
|
||||
):
|
||||
s.compile()
|
||||
|
||||
def test_recompile_error(self):
|
||||
def test_duplicate_name_error(self):
|
||||
main_xml = """
|
||||
<mujoco>
|
||||
<worldbody>
|
||||
@@ -899,16 +899,11 @@ class SpecsTest(absltest.TestCase):
|
||||
"""
|
||||
|
||||
spec = mujoco.MjSpec.from_string(main_xml)
|
||||
model = spec.compile()
|
||||
data = mujoco.MjData(model)
|
||||
|
||||
spec.add_material().name = 'yellow'
|
||||
spec.add_material().name = 'yellow'
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
ValueError, "Error: repeated name 'yellow' in material"
|
||||
):
|
||||
spec.recompile(model, data)
|
||||
spec.add_material().name = 'yellow'
|
||||
|
||||
def test_delete_unused_plugin(self):
|
||||
spec = mujoco.MjSpec.from_string("""
|
||||
|
||||
Reference in New Issue
Block a user