test_objects

test_objects.test_adaptive_free_joint_translation_tolerances_are_stage_independent()[source]

Tests MJScene zeroes relTol only for free-joint translation records.

The relative-tolerance conditioning fix applies to any free-joint body at orbital scale, independent of how its gravity is applied, so the presence of a free body (cube here) alone should trigger it.

test_objects.test_body_borrowed_site_proxy_keeps_owner_chain_alive(proxy_case, expected_name)[source]

A borrowed site retains its body, which in turn retains the scene.

test_objects.test_geometry_rgba_matches_mujoco_material_precedence(geom_attributes, material_rgba, expected_rgba)[source]

Export material color and alpha unless the geom has non-default RGBA.

MuJoCo treats explicit default gray like omitted RGBA, but a change to any channel (including alpha alone) overrides all four material channels. A second material ensures the export follows the geom’s material index.

test_objects.test_loading()[source]

Tests that MJObject are created from the XML as expected

test_objects.test_scene_borrowed_proxy_keeps_scene_alive(proxy_case)[source]

Each borrowed scene result independently retains its native owner.

test_objects.test_unnamed_body_introspection(root_name)[source]

Body, parent, and geometry names agree before initialization and after reset.

Cover unnamed roots and children, a named child of an unnamed parent, and explicit names that would otherwise collide with generated names. Creating another scene must not change the generated names for identical XML.

test_objects.test_xml_save_recompiles_pending_changes(tmp_path, phase)[source]

Save and reload generated sites and pending structural edits.

Parameters:
  • tmp_path – Temporary directory supplied by pytest.

  • phase – Scene configuration to save before simulation updates.

test_objects.test_xml_save_reports_write_errors(tmp_path)[source]

Raise a Basilisk error when the requested XML file cannot be written.

Parameters:

tmp_path – Temporary directory supplied by pytest.