Skip to content

Commit

Permalink
Store assets by address instead of value in MjSpec.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 733343350
Change-Id: I42ee2a184ebff37a080dace0422bb61e1ba53527
  • Loading branch information
quagla authored and copybara-github committed Mar 4, 2025
1 parent 7d9df8c commit 51f6aa8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/mujoco/specs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# ==============================================================================
"""Tests for mjSpec bindings."""

import gc
import inspect
import os
import textwrap
Expand Down Expand Up @@ -750,6 +751,10 @@ def test_assets(self):
model = spec.compile()
self.assertEqual(model.nmeshvert, 8)
self.assertEqual(spec.assets['cube.obj'], cube)
self.assertIs(
spec.assets['cube.obj'], cube,
'Asset dict should contain a reference, not a copy'
)

xml = """
<mujoco model="test">
Expand All @@ -766,6 +771,13 @@ def test_assets(self):
model = spec.compile()
self.assertEqual(model.nmeshvert, 8)
self.assertEqual(spec.assets['cube.obj'], cube)
self.assertIs(
spec.assets['cube.obj'], cube,
'Asset dict should contain a reference, not a copy'
)
del assets
gc.collect()
self.assertEqual(spec.assets['cube.obj'], cube)

def test_include(self):
included_xml = """
Expand Down

0 comments on commit 51f6aa8

Please sign in to comment.