tests: the cell-cache test of restored Pieces makes its Part from one piece

DECISION: the notebook in test_cell_cache_store.py::TestPiecesComeBackAsPieces made `make_part_rpart(body=moved)`
from the pieces of a split cut, which was a multi-body Part with bodies body_1 / body_2. A Part holds exactly
one solid now (design-docs/part-holds-one-solid.md), so the last cell makes the Part from one piece.

WHY: the test is about the cell cache restoring `Pieces` as `Pieces` (marimo stores a list as a plain list), not
about multi-body Parts, so what it protects is kept: the restored split still feeds the next cell as pieces
(kind == "Pieces", the translate runs per piece). Only the product cell and the final assertion changed: the
Part is `moved[0]`, and the assertion compares the Part's body (id and the moved height: +1 mm between the
first and the second run) instead of the number of `definition.bodies`, which no longer exists.

Found by running the test files that mention bodies / Pieces after the one-solid change (178 other tests in
those files passed). Checked: test_cell_cache_store.py passes (9 tests).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Ni Jingzhe
2026-11-10 04:14:05 +08:00
parent a0923a65f4
commit b56634ee6e
+3 -2
View File
@@ -163,7 +163,7 @@ SPLIT = notebook_text(
reads="pieces",
returns="moved, kind",
),
cell("part = scad.make_part_rpart(part_id='split', body=moved)", reads="moved", returns="part"),
cell("part = scad.make_part_rpart(part_id='split', body=moved[0])", reads="moved", returns="part"), # a Part holds one solid: one piece
table='id = "split"',
)
@@ -179,4 +179,5 @@ class TestPiecesComeBackAsPieces(NotebookTestCase):
second = run_notebook(nb)
self.assertEqual(self.statuses(second), ["ran", "cached", "ran", "ran"])
self.assertEqual(second.values["kind"], "Pieces")
self.assertEqual(len(second.definition.bodies), len(first.definition.bodies))
self.assertEqual(second.product.body_ids(), first.product.body_ids()) # one piece is the Part (a Part holds one solid)
self.assertAlmostEqual(second.product.body.get_center().z, first.product.body.get_center().z + 1.0, places=6)