MCPcopy
hub / github.com/CadQuery/cadquery / test_assembly_step_import_roundtrip

Function test_assembly_step_import_roundtrip

tests/test_assembly.py:1306–1352  ·  view source on GitHub ↗

Tests that the assembly does not mutate during successive export-import round trips.

(assy_orig, kind, tmpdir, request)

Source from the content-addressed store, hash-verified

1304 "assy_orig", ["subshape_assy", "boxes0_assy", "nested_assy", "simple_assy"],
1305)
1306def test_assembly_step_import_roundtrip(assy_orig, kind, tmpdir, request):
1307 """
1308 Tests that the assembly does not mutate during successive export-import round trips.
1309 """
1310
1311 assy_orig = request.getfixturevalue(assy_orig)
1312
1313 round_trip_path = os.path.join(tmpdir, f"round_trip.{kind}")
1314
1315 # First export
1316 assy_orig.export(round_trip_path)
1317
1318 # First import
1319 assy = cq.Assembly.load(round_trip_path)
1320
1321 # Second export
1322 assy.export(round_trip_path)
1323
1324 # Second import
1325 assy = cq.Assembly.load(round_trip_path)
1326
1327 # Check some general aspects of the assembly structure now
1328 for k in assy_orig.objects:
1329 assert k in assy
1330
1331 for k in assy.objects:
1332 assert k in assy_orig
1333
1334 if kind == "step":
1335 # First meta export
1336 exportStepMeta(assy, round_trip_path)
1337
1338 # First meta import
1339 assy = cq.Assembly.importStep(round_trip_path)
1340
1341 # Second meta export
1342 exportStepMeta(assy, round_trip_path)
1343
1344 # Second meta import
1345 assy = cq.Assembly.importStep(round_trip_path)
1346
1347 # Check some general aspects of the assembly structure now
1348 for k in assy_orig.objects:
1349 assert k in assy
1350
1351 for k in assy.objects:
1352 assert k in assy_orig
1353
1354
1355def test_assembly_import_step_unit(tmp_path_factory):

Callers

nothing calls this directly

Calls 4

exportStepMetaFunction · 0.90
loadMethod · 0.80
importStepMethod · 0.80
exportMethod · 0.45

Tested by

no test coverage detected