From fa7fd9097a54d65e5378d4292a6ab9c62560a7f5 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 16 Oct 2026 03:14:55 +0000 Subject: [PATCH] Test: map the q<.5 variant of a sparse cut link separately The fixture listed (fluid_idx=13, dir=3) twice with different q, so the existing repeated-link rejection fired before the sparse checks. Co-Authored-By: Claude Opus 5.5 --- tests/unit/test_block_layout.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/unit/test_block_layout.py b/tests/unit/test_block_layout.py index 3d7f482..da18501 100644 --- a/tests/unit/test_block_layout.py +++ b/tests/unit/test_block_layout.py @@ -382,13 +382,16 @@ class SparseBlockLayoutTests(unittest.TestCase): def test_cut_links_in_or_next_to_absent_blocks_are_rejected(self): layout = BlockLayout2D.build(6, 12, 3, 4, periodic=(False, False), origins=L_ORIGINS) - ok = [link(1, 1, 3, .6), link(1, 1, 3, .3), link(1, 7, 2, .6), link(1, 4, 2, .3)] + ok = [link(1, 1, 3, .6), link(1, 7, 2, .6), link(1, 4, 2, .3)] mapped = layout.map_cut_links(ok) # fully owned stencils, incl. across a seam cells = int(np.prod(layout.local_shape)) - np.testing.assert_array_equal(mapped.block, [0, 0, 1, 1]) - np.testing.assert_array_equal(mapped.receiver, [layout.owner[1, 1]] * 2 - + [layout.owner[1, 7], layout.owner[1, 4]]) - self.assertEqual(int(mapped.donor[1]), int(layout.owner[0, 1])) + np.testing.assert_array_equal(mapped.block, [0, 1, 1]) + np.testing.assert_array_equal(mapped.receiver, [layout.owner[1, 1], layout.owner[1, 7], + layout.owner[1, 4]]) + self.assertEqual(int(mapped.donor[2]), int(layout.owner[1, 5])) + # Same physical link with q<.5 is mapped separately (repeats are rejected). + donor = layout.map_cut_links([link(1, 1, 3, .3)]).donor + self.assertEqual(int(donor[0]), int(layout.owner[0, 1])) self.assertTrue((mapped.write < np.uint64(layout.nblocks * NQ * cells)).all()) for bad in (link(4, 1, 1, .6), # receiver in an absent block link(2, 1, 3, .6), # solid neighbor (3,1) absent