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

Function test_step_export_filesize

tests/test_assembly.py:2390–2409  ·  view source on GitHub ↗

A sanity check of STEP file size. Multiple instances of a shape with same color is not expected to result in significant file size increase.

(tmpdir)

Source from the content-addressed store, hash-verified

2388
2389
2390def test_step_export_filesize(tmpdir):
2391 """A sanity check of STEP file size.
2392 Multiple instances of a shape with same color is not expected to result
2393 in significant file size increase.
2394 """
2395 part = box(1, 1, 1)
2396 N = 10
2397 filesize = {}
2398
2399 for i, color in enumerate((None, cq.Color("red"))):
2400 assy = cq.Assembly()
2401 for j in range(1, N + 1):
2402 assy.add(
2403 part, name=f"part{j}", loc=cq.Location(x=j * 1), color=copy.copy(color)
2404 )
2405 stepfile = Path(tmpdir) / f"assy_step_filesize{i}.step"
2406 assy.export(str(stepfile))
2407 filesize[i] = stepfile.stat().st_size
2408
2409 assert filesize[1] < 1.2 * filesize[0]
2410
2411
2412def test_assembly_remove_no_name_match():

Callers

nothing calls this directly

Calls 4

addMethod · 0.95
exportMethod · 0.95
boxFunction · 0.85
copyMethod · 0.45

Tested by

no test coverage detected