mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
cb2f20b2b6
Two paired test files for the framework infrastructure landed earlier in this PR. test_decorator_cache.py (11 tests): * The 4-hook invalidation list (depsgraph_update_post + undo_post + redo_post + load_post) is symmetrically managed by install_decorator_cache_handlers / uninstall_decorator_cache_handlers. A future edit that drops a hook from one side without the other would land as a Blender segfault when a cached bpy.types.Object ref outlives its underlying ID block — the regression must surface as a test failure first. * install is idempotent (calling twice doesn't double-register). * uninstall when not installed doesn't raise. * The bump handler accepts Blender's variadic args. * The depsgraph predicate gates correctly: bumps on Object geometry or transform updates, silently skips on Material / NodeTree / Image updates (which would otherwise rebuild every cache on every node edit). * TokenCache.get_or_compute short-circuits on key+token match and recomputes when the token bumps. test_undo_resync_parametric_drafts.py (3 tests): * UNDO_REGENERATORS keys must all be in tool.Parametric.EDIT_TYPES. A typo would silently no-op on Ctrl+Z, restoring the desync the helper is meant to prevent. * The dispatcher skips objects with no active parametric edit (undo_post fires for every undo, most of which touch zero drafts). * The dispatcher silently skips parametric types that have no UNDO_REGENERATORS entry (door / window / array are IFC-derived with no draft preview mesh — they don't need a regenerator). Mocks use spec=bpy.types.Depsgraph / spec=bpy.types.DepsgraphUpdate / spec=tool.parametric.ParametricObject so typos in mocked-attribute access fail loudly (CLAUDE.md test discipline). Generated with the assistance of an AI coding tool.