Compare commits

..
Author SHA1 Message Date
ClaudeandClaude Opus 5.5 32da2d7324 test: give the fault-guard fake backend its storage representation
download() now runs _check_storage(), which reads _ddf_shifting and the
per-level configs; the fake backend set neither. Both are set to the
unshifted default, so the download/step failure assertions run again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 18:14:02 +00:00
ClaudeandClaude Opus 5.5 56004f4482 test: update stale fixtures for current sources (no src change)
- test_channel_root: owner is uint64; int() before -1 so the probe slot
  stays an integer under NumPy 1 value-based promotion.
- test_shifted_storage: build FP32 fixtures with FP32 NaN; np.where with a
  Python NaN promoted to FP64 under NumPy 1, so the shifted FP32 contract
  rejected the fixture before the intended checks.
- test_block_stepper: fake backend sets _ddf_shifting (unshifted).
- test_fine_surface_gpu: set _boundary_hosts/_level_jets; fine_boundary
  is now a read-only view over the level lists.
- test_refinement_followup: set _layouts (fine_layout is a read-only
  view); a pair tau that disagrees with its level config is now rejected
  by hierarchy._check_chain before the per-level omega/tau check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 13:51:12 +00:00
5 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ def test_masks_and_minimal_footprint():
def test_actual_closure_read_conflicts():
pair, layout, targets = transfer((6, 6, 18, 14))
validate_channel_transfers(pair, layout, targets)
for target in (layout.slot(layout.owner[5, -1]-1, 2),
for target in (layout.slot(int(layout.owner[5, -1]) - 1, 2),
layout.slot(layout.owner[1, 4], 4),
layout.slot(layout.owner[-2, 4], 3)):
with pytest.raises(ValueError, match="immutable"):
+4 -2
View File
@@ -78,13 +78,15 @@ class ShiftedStorage(unittest.TestCase):
def test_shifted_density_and_tag_validation(self):
old,new = topology(A),topology(B)
a = tuple(np.where(m[None], np.float32(-.001), np.nan).repeat(9,axis=0) for m in old.leaf_masks)
a = tuple(np.where(m[None], np.float32(-.001), np.float32(np.nan)).repeat(9,axis=0)
for m in old.leaf_masks) # FP32 under numpy 1 and 2 promotion rules
remap(old,new,a)
with self.assertRaisesRegex(ValueError,'representation'): remap(old,new,a,False)
with self.assertRaisesRegex(ValueError,'FP32'): remap(old,new,tuple(x.astype(np.float64) for x in a))
a[0][:,old.leaf_masks[0]] = -1
with self.assertRaisesRegex(ValueError,'positive density'): remap(old,new,a)
rest = tuple(np.where(m[None],np.float32(0),np.nan).repeat(9,axis=0) for m in old.leaf_masks)
rest = tuple(np.where(m[None],np.float32(0),np.float32(np.nan)).repeat(9,axis=0)
for m in old.leaf_masks)
remap(old,new,rest)
with self.assertRaisesRegex(ValueError,'positive density'):
remap_synchronized(old,new,rest,base_count=7,level_steps=(7,14,28),phase='postcollision_g')
@@ -192,6 +192,7 @@ class CpuContracts(unittest.TestCase):
backend._lock = RLock()
backend._status = "ready"
backend._step_count = 0
backend._ddf_shifting = False # unshifted storage, as for the default config
backend._stream = Mock()
backend._module = Mock()
backend._copy = backend._step = Mock()
@@ -281,7 +281,8 @@ def test_fine_surface_four_hops(speed):
@pytest.mark.parametrize("missing", ["surface_velocity_gpu", "link_exchange_gpu"])
def test_missing_surface_device_buffer_rejects_before_launch(missing):
backend = implementation.FixedPatchStepper.__new__(implementation.FixedPatchStepper)
backend.fine_boundary = SimpleNamespace(objects=[object_spec(.002)])
backend._boundary_hosts = [None, SimpleNamespace(objects=[object_spec(.002)])]
backend._level_jets = [(), ()]
backend._fine_curved = SimpleNamespace(fluid_idx_gpu=object(),
surface_velocity_gpu=object(), link_exchange_gpu=object())
setattr(backend._fine_curved, missing, None)
@@ -106,7 +106,9 @@ class FaultGuardsCPU(unittest.TestCase):
def fake_backend(self):
backend = PeriodicPatchStepper.__new__(PeriodicPatchStepper)
backend.fine_layout = None # dense fine storage
backend._layouts = [None, None] # dense storage on both levels
backend._ddf_shifting = False # unshifted on every level, as _check_storage expects
backend._level_cfgs = [LBMConfig(nx=16, ny=16, viscosity=.1)] * 2 # ddf_shifting off
backend.ctx = Mock(activate=nullcontext)
backend._lock = RLock()
backend._status = "ready"
@@ -158,7 +160,9 @@ class FaultGuardsCPU(unittest.TestCase):
p = implementation.FixedPatch2D.from_config(cfg, (4, 4, 12, 12))
with patch.object(cuda, "Stream"), patch.object(implementation.FixedPatch2D, "from_config",
return_value=replace(p, tau_coarse=.9)):
with self.assertRaisesRegex(RuntimeError, "omega/tau"):
# The hierarchy rejects a pair tau that disagrees with its level config
# (hierarchy.py) before the per-level omega/tau check can be reached.
with self.assertRaisesRegex(RuntimeError, "config chain is inconsistent"):
PeriodicPatchStepper(cfg, p.bounds, context=context)
module = Mock()
module.get_global.return_value = (Mock(), 16)