# Path: robel/utils/testing/mock_sim_scene.py
# class MockSimScene:
#     """Mock object that implements the SimScene interface."""
# 
#     @staticmethod
#     def create(*unused_args, **unused_kwargs):
#         raise NotImplementedError('`patch_sim_scene` must be called.')
# 
#     def __init__(self, *args, step_duration: float = 1, **kwargs):
#         """Initializes a new mock SimScene."""
#         self.sim = mock.Mock()
#         self.sim.model = MockMjModel(*args, **kwargs)
# 
#         self.model = self.sim.model
#         self.sim.data = self.model
#         self.data = self.model.data
# 
#         self.step_duration = step_duration
# 
#         self.close = mock.Mock()
#         self.advance = mock.Mock()
# 
#         self.renderer = mock.Mock()
#         self.renderer.render_offscreen = lambda w, h, **_: np.zeros((w, h))


from absl.testing import absltest
from robel.utils.testing.mock_sim_scene import MockSimScene
import numpy as np

class MockSimSceneTest(absltest.TestCase):
    """Tests MockSimScene."""

    def test_defaults(self):
        """Tests default initialization of the sim scene."""
        scene = MockSimScene(nq=2)

        # Ensure that properties exist.
        self.assertIsNotNone(scene.sim)
        self.assertIsNotNone(scene.model)
        self.assertIsNotNone(scene.data)
        self.assertIsNotNone(scene.step_duration)
        self.assertIsNotNone(scene.close)
        self.assertIsNotNone(scene.advance)

        np.testing.assert_array_equal(scene.model.actuator_ctrlrange, [(-1, 1),
                                                                       (-1, 1)])

        # Check that sizes are consistent.
        self.assertEqual(scene.model.nq, 2)
        self.assertEqual(scene.model.nv, 2)
        self.assertEqual(scene.model.nu, 2)
        self.assertEqual(scene.data.qpos.size, 2)
        self.assertEqual(scene.data.qvel.size, 2)
        self.assertEqual(scene.data.qacc.size, 2)
        self.assertEqual(scene.data.ctrl.size, 2)

    def test_explicit_init(self):
        """Tests initialization with explicit values."""

# Path: robel/utils/testing/mock_sim_scene.py
# class MockSimScene:
#     """Mock object that implements the SimScene interface."""
# 
#     @staticmethod
#     def create(*unused_args, **unused_kwargs):
#         raise NotImplementedError('`patch_sim_scene` must be called.')
# 
#     def __init__(self, *args, step_duration: float = 1, **kwargs):
#         """Initializes a new mock SimScene."""
#         self.sim = mock.Mock()
#         self.sim.model = MockMjModel(*args, **kwargs)
# 
#         self.model = self.sim.model
#         self.sim.data = self.model
#         self.data = self.model.data
# 
#         self.step_duration = step_duration
# 
#         self.close = mock.Mock()
#         self.advance = mock.Mock()
# 
#         self.renderer = mock.Mock()
#         self.renderer.render_offscreen = lambda w, h, **_: np.zeros((w, h))


# Path: robel/utils/testing/mock_sim_scene_test.py
from absl.testing import absltest
from robel.utils.testing.mock_sim_scene import MockSimScene
import numpy as np


class MockSimSceneTest(absltest.TestCase):
    """Tests MockSimScene."""

    def test_defaults(self):
        """Tests default initialization of the sim scene."""
        scene = MockSimScene(nq=2)

        # Ensure that properties exist.
        self.assertIsNotNone(scene.sim)
        self.assertIsNotNone(scene.model)
        self.assertIsNotNone(scene.data)
        self.assertIsNotNone(scene.step_duration)
        self.assertIsNotNone(scene.close)
        self.assertIsNotNone(scene.advance)

        np.testing.assert_array_equal(scene.model.actuator_ctrlrange, [(-1, 1),
                                                                       (-1, 1)])

        # Check that sizes are consistent.
        self.assertEqual(scene.model.nq, 2)
        self.assertEqual(scene.model.nv, 2)
        self.assertEqual(scene.model.nu, 2)
        self.assertEqual(scene.data.qpos.size, 2)
        self.assertEqual(scene.data.qvel.size, 2)
        self.assertEqual(scene.data.qacc.size, 2)
        self.assertEqual(scene.data.ctrl.size, 2)

    def test_explicit_init(self):
        """Tests initialization with explicit values."""

        scene = MockSimScene(