Migrate stepper tests to the level-list representation
Schedule test drives _pairs[i].explode/coalesce and patches _advance(index, buffer) for the stale L1->L2 feed mutant; remap rejection test patches _boundary_hosts entries and hierarchy.pairs instead of the read-only views; the GPU launch-failure test patches _pairs[0].explode. Assertions unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
edce582a2d
commit
7ecb179a41
@@ -251,14 +251,14 @@ class ConstructorAndSchedule(unittest.TestCase):
|
||||
initial_c=c.current
|
||||
def record(name):
|
||||
return lambda source,*a,**kw: events.append((name,source))
|
||||
run._explode.side_effect=record('explode01')
|
||||
run._child.explode.side_effect=record('explode12')
|
||||
run._pairs[0].explode.side_effect=record('explode01')
|
||||
run._pairs[1].explode.side_effect=record('explode12')
|
||||
for i,level in enumerate(run._levels):
|
||||
level.kernel.side_effect=record(f'step{i}')
|
||||
if bodies:
|
||||
g.boundary.kernel.side_effect=record('bfl2')
|
||||
run._child.coalesce.side_effect=lambda src,dst,*a,**kw: events.append(('restrict21',dst))
|
||||
run._coalesce.side_effect=lambda src,dst,*a,**kw: events.append(('restrict10',dst))
|
||||
run._pairs[1].coalesce.side_effect=lambda src,dst,*a,**kw: events.append(('restrict21',dst))
|
||||
run._pairs[0].coalesce.side_effect=lambda src,dst,*a,**kw: events.append(('restrict10',dst))
|
||||
run._status='ready'
|
||||
expected=[('explode01',initial_c)]
|
||||
for middle in (f.current,f.spare):
|
||||
@@ -278,13 +278,14 @@ class ConstructorAndSchedule(unittest.TestCase):
|
||||
self.assertEqual([l.kernel.call_count for l in run._levels],[1,2,4])
|
||||
# A stale-feed implementation must fail the source-identity guard.
|
||||
feeds=[]
|
||||
advance=run._advance_child
|
||||
def checked_advance(buffer, **kw):
|
||||
self.assertIs(buffer,(f.current,f.spare)[len(feeds)])
|
||||
feeds.append(buffer)
|
||||
advance(buffer,**kw)
|
||||
with patch.object(run,'_advance_child',side_effect=lambda buffer,**kw:
|
||||
checked_advance(f.current,**kw)):
|
||||
advance=run._advance
|
||||
def checked_advance(index, buffer, **kw):
|
||||
if index == 2: # L1 -> L2 feed: must be the L1 hop source
|
||||
self.assertIs(buffer,(f.current,f.spare)[len(feeds)])
|
||||
feeds.append(buffer)
|
||||
advance(index,buffer,**kw)
|
||||
with patch.object(run,'_advance',side_effect=lambda index,buffer,**kw:
|
||||
checked_advance(index,f.current if index == 2 else buffer,**kw)):
|
||||
with self.assertRaises(AssertionError):
|
||||
run.step()
|
||||
# A per-region shared-parent advance must fail the 1:2:4 guard.
|
||||
|
||||
Reference in New Issue
Block a user