|
8 | 8 | import re |
9 | 9 | from unittest.mock import MagicMock, patch |
10 | 10 |
|
11 | | -import pytest |
12 | 11 | from newton import GeoType, ModelBuilder, ShapeFlags |
13 | 12 |
|
14 | 13 |
|
@@ -197,8 +196,18 @@ def test_shape_patterns_match_shape_label(self): |
197 | 196 | builder = self._make_builder( |
198 | 197 | bodies=["/World/Robot/base", "/World/Robot/arm"], |
199 | 198 | shapes=[ |
200 | | - {"body_idx": 0, "label": "/World/Robot/base/gear_mesh", "geo_type": GeoType.MESH, "flags": ShapeFlags.COLLIDE_SHAPES}, |
201 | | - {"body_idx": 1, "label": "/World/Robot/arm/plain_mesh", "geo_type": GeoType.MESH, "flags": ShapeFlags.COLLIDE_SHAPES}, |
| 199 | + { |
| 200 | + "body_idx": 0, |
| 201 | + "label": "/World/Robot/base/gear_mesh", |
| 202 | + "geo_type": GeoType.MESH, |
| 203 | + "flags": ShapeFlags.COLLIDE_SHAPES, |
| 204 | + }, |
| 205 | + { |
| 206 | + "body_idx": 1, |
| 207 | + "label": "/World/Robot/arm/plain_mesh", |
| 208 | + "geo_type": GeoType.MESH, |
| 209 | + "flags": ShapeFlags.COLLIDE_SHAPES, |
| 210 | + }, |
202 | 211 | ], |
203 | 212 | ) |
204 | 213 | # Mock the mesh sources |
@@ -232,9 +241,24 @@ def test_body_patterns_match_body_label(self): |
232 | 241 | builder = self._make_builder( |
233 | 242 | bodies=["/World/Robot/arm", "/World/Robot/base"], |
234 | 243 | shapes=[ |
235 | | - {"body_idx": 0, "label": "/World/Robot/arm/mesh_a", "geo_type": GeoType.MESH, "flags": ShapeFlags.COLLIDE_SHAPES}, |
236 | | - {"body_idx": 0, "label": "/World/Robot/arm/mesh_b", "geo_type": GeoType.MESH, "flags": ShapeFlags.COLLIDE_SHAPES}, |
237 | | - {"body_idx": 1, "label": "/World/Robot/base/mesh_c", "geo_type": GeoType.MESH, "flags": ShapeFlags.COLLIDE_SHAPES}, |
| 244 | + { |
| 245 | + "body_idx": 0, |
| 246 | + "label": "/World/Robot/arm/mesh_a", |
| 247 | + "geo_type": GeoType.MESH, |
| 248 | + "flags": ShapeFlags.COLLIDE_SHAPES, |
| 249 | + }, |
| 250 | + { |
| 251 | + "body_idx": 0, |
| 252 | + "label": "/World/Robot/arm/mesh_b", |
| 253 | + "geo_type": GeoType.MESH, |
| 254 | + "flags": ShapeFlags.COLLIDE_SHAPES, |
| 255 | + }, |
| 256 | + { |
| 257 | + "body_idx": 1, |
| 258 | + "label": "/World/Robot/base/mesh_c", |
| 259 | + "geo_type": GeoType.MESH, |
| 260 | + "flags": ShapeFlags.COLLIDE_SHAPES, |
| 261 | + }, |
238 | 262 | ], |
239 | 263 | ) |
240 | 264 | for s in builder.shape_source: |
@@ -268,8 +292,18 @@ def test_non_mesh_shapes_are_skipped(self): |
268 | 292 | builder = self._make_builder( |
269 | 293 | bodies=["/World/Robot/base"], |
270 | 294 | shapes=[ |
271 | | - {"body_idx": 0, "label": "/World/Robot/base/box", "geo_type": GeoType.BOX, "flags": ShapeFlags.COLLIDE_SHAPES}, |
272 | | - {"body_idx": 0, "label": "/World/Robot/base/mesh", "geo_type": GeoType.MESH, "flags": ShapeFlags.COLLIDE_SHAPES}, |
| 295 | + { |
| 296 | + "body_idx": 0, |
| 297 | + "label": "/World/Robot/base/box", |
| 298 | + "geo_type": GeoType.BOX, |
| 299 | + "flags": ShapeFlags.COLLIDE_SHAPES, |
| 300 | + }, |
| 301 | + { |
| 302 | + "body_idx": 0, |
| 303 | + "label": "/World/Robot/base/mesh", |
| 304 | + "geo_type": GeoType.MESH, |
| 305 | + "flags": ShapeFlags.COLLIDE_SHAPES, |
| 306 | + }, |
273 | 307 | ], |
274 | 308 | ) |
275 | 309 | for s in builder.shape_source: |
@@ -302,7 +336,12 @@ def test_visual_shapes_skipped_when_use_visual_meshes_false(self): |
302 | 336 | builder = self._make_builder( |
303 | 337 | bodies=["/World/Robot/arm"], |
304 | 338 | shapes=[ |
305 | | - {"body_idx": 0, "label": "/World/Robot/arm/visual", "geo_type": GeoType.MESH, "flags": ShapeFlags.VISIBLE}, |
| 339 | + { |
| 340 | + "body_idx": 0, |
| 341 | + "label": "/World/Robot/arm/visual", |
| 342 | + "geo_type": GeoType.MESH, |
| 343 | + "flags": ShapeFlags.VISIBLE, |
| 344 | + }, |
306 | 345 | ], |
307 | 346 | ) |
308 | 347 | for s in builder.shape_source: |
@@ -334,7 +373,12 @@ def test_margin_applied_when_set(self): |
334 | 373 | builder = self._make_builder( |
335 | 374 | bodies=["/World/Robot/arm"], |
336 | 375 | shapes=[ |
337 | | - {"body_idx": 0, "label": "/World/Robot/arm/mesh", "geo_type": GeoType.MESH, "flags": ShapeFlags.COLLIDE_SHAPES}, |
| 376 | + { |
| 377 | + "body_idx": 0, |
| 378 | + "label": "/World/Robot/arm/mesh", |
| 379 | + "geo_type": GeoType.MESH, |
| 380 | + "flags": ShapeFlags.COLLIDE_SHAPES, |
| 381 | + }, |
338 | 382 | ], |
339 | 383 | ) |
340 | 384 | for s in builder.shape_source: |
@@ -365,7 +409,12 @@ def test_margin_none_leaves_default(self): |
365 | 409 | builder = self._make_builder( |
366 | 410 | bodies=["/World/Robot/arm"], |
367 | 411 | shapes=[ |
368 | | - {"body_idx": 0, "label": "/World/Robot/arm/mesh", "geo_type": GeoType.MESH, "flags": ShapeFlags.COLLIDE_SHAPES}, |
| 412 | + { |
| 413 | + "body_idx": 0, |
| 414 | + "label": "/World/Robot/arm/mesh", |
| 415 | + "geo_type": GeoType.MESH, |
| 416 | + "flags": ShapeFlags.COLLIDE_SHAPES, |
| 417 | + }, |
369 | 418 | ], |
370 | 419 | ) |
371 | 420 | for s in builder.shape_source: |
|
0 commit comments