Merge pull request #2462 from jjyyxx:main
PiperOrigin-RevId: 731710330 Change-Id: If87dd2c06123bd9ddfc62b63370c8fedf320e721
This commit is contained in:
@@ -393,6 +393,9 @@ PYBIND11_MODULE(_specs, m) {
|
|||||||
mjSpec.def("copy", [](const MjSpec& self) -> MjSpec {
|
mjSpec.def("copy", [](const MjSpec& self) -> MjSpec {
|
||||||
return MjSpec(self);
|
return MjSpec(self);
|
||||||
});
|
});
|
||||||
|
mjSpec.def_property_readonly("_address", [](const MjSpec& self) {
|
||||||
|
return reinterpret_cast<uintptr_t>(self.ptr);
|
||||||
|
});
|
||||||
mjSpec.def_property(
|
mjSpec.def_property(
|
||||||
"copy_during_attach",
|
"copy_during_attach",
|
||||||
[](MjSpec& self) {
|
[](MjSpec& self) {
|
||||||
|
|||||||
@@ -1159,5 +1159,15 @@ class SpecsTest(absltest.TestCase):
|
|||||||
):
|
):
|
||||||
model_spec.compile()
|
model_spec.compile()
|
||||||
|
|
||||||
|
def test_address(self):
|
||||||
|
spec1 = mujoco.MjSpec()
|
||||||
|
spec2 = mujoco.MjSpec()
|
||||||
|
spec3 = spec1.copy()
|
||||||
|
|
||||||
|
self.assertGreater(spec1._address, 0)
|
||||||
|
self.assertGreater(spec2._address, 0)
|
||||||
|
self.assertGreater(spec3._address, 0)
|
||||||
|
self.assertLen({spec1._address, spec2._address, spec3._address}, 3)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
absltest.main()
|
absltest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user