Check type correctness in all bind paths.

PiperOrigin-RevId: 727877128
Change-Id: I4f4f74a1fb96d3fc5abdea531b78eb54dc53d186
This commit is contained in:
Alessio Quaglino
2025-02-17 08:45:20 -08:00
committed by Copybara-Service
parent 0a4eda5065
commit d5065f867b
2 changed files with 22 additions and 6 deletions
+13 -3
View File
@@ -282,12 +282,22 @@ class SupportTest(parameterized.TestCase):
)
# test invalid name
with self.assertRaises(AttributeError):
with self.assertRaises(
AttributeError, msg='ctrl is not available for this type'
):
print(dx.bind(mx, s.geoms).ctrl)
with self.assertRaises(AttributeError):
with self.assertRaises(
AttributeError, msg='ctrl is not available for this type'
):
print(dx.bind(mx, s.actuators).actuator_ctrl)
with self.assertRaises(AttributeError):
with self.assertRaises(
AttributeError, msg='ctrl is not available for this type'
):
print(dx.bind(mx, s.actuators).set('actuator_ctrl', [1, 2, 3]))
with self.assertRaises(
AttributeError, msg='qpos and qvel are not available for this type'
):
print(dx.bind(mx, s.geoms).qpos)
with self.assertRaises(KeyError, msg='invalid name: invalid_actuator_name'):
s.actuators[0].name = 'invalid_actuator_name'
print(dx.bind(mx, s.actuators).set('ctrl', [1, 2, 3]))