Skip to content

Commit bb59cff

Browse files
committed
Clean up test error function.
1 parent b3e3d5e commit bb59cff

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

tests/unit/test_sim.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -529,30 +529,29 @@ def test_change_material_errors(device: str):
529529
n_drones = 2
530530
sim = Sim(n_drones=n_drones, device=device)
531531

532-
# ---------- 1) Missing material name: mat_name="bad_mat" ----------
533-
drone_ids_ok = np.array([0, 1], dtype=int)
534-
rgba_ok = 0.42 * np.ones((n_drones, 4), dtype=float)
535-
emission_ok = 0.42 * np.ones((n_drones,), dtype=float)
532+
drone_ids = np.array([0, 1], dtype=int)
533+
rgba = np.ones((n_drones, 4), dtype=float)
534+
emission = np.ones((n_drones,), dtype=float)
536535

537-
with pytest.raises(ValueError, match=r"Material 'bad_mat:0' not found in MuJoCo model\."):
536+
with pytest.raises(ValueError):
538537
change_material(
539-
sim, mat_name="bad_mat", drone_ids=drone_ids_ok, rgba=rgba_ok, emission=emission_ok
538+
sim, mat_name="bad_mat", drone_ids=drone_ids, rgba=rgba, emission=emission
540539
)
541540

542541
with pytest.raises(ValueError, match=r"drone_ids must be 1D array"):
543542
change_material(
544543
sim,
545544
mat_name="led_top",
546545
drone_ids=np.array(2, dtype=int),
547-
rgba=rgba_ok,
548-
emission=emission_ok,
546+
rgba=rgba,
547+
emission=emission,
549548
)
550549

551550
with pytest.raises(ValueError, match=r"drone_ids must be in range \[0, 1\]"):
552551
change_material(
553552
sim,
554553
mat_name="led_top",
555554
drone_ids=np.arange(3, dtype=int),
556-
rgba=rgba_ok,
557-
emission=emission_ok,
555+
rgba=rgba,
556+
emission=emission,
558557
)

0 commit comments

Comments
 (0)