Tests that the assembly does not mutate during successive export-import round trips.
(assy_orig, kind, tmpdir, request)
| 1304 | "assy_orig", ["subshape_assy", "boxes0_assy", "nested_assy", "simple_assy"], |
| 1305 | ) |
| 1306 | def 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 | |
| 1355 | def test_assembly_import_step_unit(tmp_path_factory): |
nothing calls this directly
no test coverage detected