Remove TEST_FILES from MJX test_util.py.
PiperOrigin-RevId: 599886327 Change-Id: I4d166e09db22fffc959dbe34fa3469bd4a1b9f84
This commit is contained in:
committed by
Copybara-Service
parent
a1ddbdf7f8
commit
5cbaa23388
@@ -59,7 +59,7 @@ def _assert_eq(testcase, a, b, attr=None, name=None):
|
||||
|
||||
class DeviceTest(parameterized.TestCase):
|
||||
|
||||
@parameterized.parameters(test_util.TEST_FILES)
|
||||
@parameterized.parameters('constraints.xml', 'pendula.xml')
|
||||
def testdevice_put(self, fname):
|
||||
"""Test putting MjData and MjModel on device."""
|
||||
m = test_util.load_test_file(fname)
|
||||
@@ -71,7 +71,7 @@ class DeviceTest(parameterized.TestCase):
|
||||
_assert_eq(self, mjx.device_put(d), d)
|
||||
_assert_eq(self, mjx.device_put(m), m)
|
||||
|
||||
@parameterized.parameters(test_util.TEST_FILES)
|
||||
@parameterized.parameters('constraints.xml', 'pendula.xml')
|
||||
def testdevice_get(self, fname):
|
||||
"""Test getting MjData from a device."""
|
||||
m = test_util.load_test_file(fname)
|
||||
@@ -81,7 +81,7 @@ class DeviceTest(parameterized.TestCase):
|
||||
device.device_get_into(d, dx)
|
||||
_assert_eq(self, dx, d)
|
||||
|
||||
@parameterized.parameters(set(test_util.TEST_FILES) - {'convex.xml'})
|
||||
@parameterized.parameters('constraints.xml', 'pendula.xml')
|
||||
def testdevice_get_batched(self, fname):
|
||||
"""Test getting MjData from a device."""
|
||||
m = test_util.load_test_file(fname)
|
||||
|
||||
@@ -27,7 +27,7 @@ import numpy as np
|
||||
|
||||
class SupportTest(parameterized.TestCase):
|
||||
|
||||
@parameterized.parameters(set(test_util.TEST_FILES) - {'convex.xml'})
|
||||
@parameterized.parameters('constraints.xml', 'pendula.xml')
|
||||
def test_jac(self, fname):
|
||||
np.random.seed(0)
|
||||
|
||||
|
||||
@@ -15,20 +15,13 @@
|
||||
"""Utilities for testing."""
|
||||
|
||||
import sys
|
||||
from typing import Dict, List, Tuple
|
||||
from typing import Dict, Tuple
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
from etils import epath
|
||||
import mujoco
|
||||
import numpy as np
|
||||
|
||||
TEST_FILES: List[str] = [
|
||||
'constraints.xml',
|
||||
'convex.xml',
|
||||
'pendula.xml',
|
||||
'ray.xml',
|
||||
]
|
||||
|
||||
_ACTUATOR_TYPES = ['motor', 'velocity', 'position', 'general', 'intvelocity']
|
||||
_DYN_TYPES = ['none', 'integrator', 'filter', 'filterexact']
|
||||
_DYN_PRMS = ['0.189', '2.1']
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
# Copyright 2023 DeepMind Technologies Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ==============================================================================
|
||||
"""Tests for the test_util."""
|
||||
|
||||
from absl.testing import absltest
|
||||
from etils import epath
|
||||
from mujoco.mjx._src import test_util
|
||||
|
||||
|
||||
class TestUtilTest(absltest.TestCase):
|
||||
|
||||
def test_files_in_test_data_match(self):
|
||||
directory = epath.resource_path('mujoco.mjx') / 'test_data'
|
||||
files = set([f.name for f in directory.glob('*.xml')])
|
||||
self.assertSetEqual(
|
||||
files,
|
||||
set(test_util.TEST_FILES),
|
||||
msg=(
|
||||
'`_test_util.TEST_FILES` must match the files in the '
|
||||
'test_data/*.xml directory'
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
absltest.main()
|
||||
Reference in New Issue
Block a user