You've already forked HeurAMS-legacy
fix
This commit is contained in:
@@ -15,15 +15,15 @@ class TestPhaser(unittest.TestCase):
|
||||
self.atom_new = Mock(spec=Atom)
|
||||
self.atom_new.registry = {"electron": Mock(spec=Electron)}
|
||||
self.atom_new.registry["electron"].is_activated.return_value = False
|
||||
|
||||
|
||||
self.atom_old = Mock(spec=Atom)
|
||||
self.atom_old.registry = {"electron": Mock(spec=Electron)}
|
||||
self.atom_old.registry["electron"].is_activated.return_value = True
|
||||
|
||||
|
||||
# 模拟 Procession 类以避免复杂依赖
|
||||
self.procession_patcher = patch('heurams.kernel.reactor.phaser.Procession')
|
||||
self.procession_patcher = patch("heurams.kernel.reactor.phaser.Procession")
|
||||
self.mock_procession_class = self.procession_patcher.start()
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
self.procession_patcher.stop()
|
||||
|
||||
@@ -31,10 +31,10 @@ class TestPhaser(unittest.TestCase):
|
||||
"""测试混合新旧原子的初始化"""
|
||||
atoms = [self.atom_old, self.atom_new, self.atom_old]
|
||||
phaser = Phaser(atoms)
|
||||
|
||||
|
||||
# 应该创建两个 Procession:一个用于旧原子,一个用于新原子,以及一个总体复习
|
||||
self.assertEqual(self.mock_procession_class.call_count, 3)
|
||||
|
||||
|
||||
# 检查调用参数
|
||||
calls = self.mock_procession_class.call_args_list
|
||||
# 第一个调用应该是旧原子的初始复习
|
||||
@@ -51,7 +51,7 @@ class TestPhaser(unittest.TestCase):
|
||||
"""测试只有旧原子"""
|
||||
atoms = [self.atom_old, self.atom_old]
|
||||
phaser = Phaser(atoms)
|
||||
|
||||
|
||||
# 应该创建两个 Procession:一个初始复习,一个总体复习
|
||||
self.assertEqual(self.mock_procession_class.call_count, 2)
|
||||
calls = self.mock_procession_class.call_args_list
|
||||
@@ -64,7 +64,7 @@ class TestPhaser(unittest.TestCase):
|
||||
"""测试只有新原子"""
|
||||
atoms = [self.atom_new, self.atom_new]
|
||||
phaser = Phaser(atoms)
|
||||
|
||||
|
||||
self.assertEqual(self.mock_procession_class.call_count, 2)
|
||||
calls = self.mock_procession_class.call_args_list
|
||||
self.assertEqual(calls[0][0][0], atoms)
|
||||
@@ -80,10 +80,10 @@ class TestPhaser(unittest.TestCase):
|
||||
mock_proc2 = Mock()
|
||||
mock_proc2.state = ProcessionState.RUNNING
|
||||
mock_proc2.phase = PhaserState.QUICK_REVIEW
|
||||
|
||||
|
||||
phaser = Phaser([])
|
||||
phaser.processions = [mock_proc1, mock_proc2]
|
||||
|
||||
|
||||
result = phaser.current_procession()
|
||||
self.assertEqual(result, mock_proc2)
|
||||
self.assertEqual(phaser.state, PhaserState.QUICK_REVIEW)
|
||||
@@ -92,10 +92,10 @@ class TestPhaser(unittest.TestCase):
|
||||
"""测试所有 Procession 都完成"""
|
||||
mock_proc = Mock()
|
||||
mock_proc.state = ProcessionState.FINISHED
|
||||
|
||||
|
||||
phaser = Phaser([])
|
||||
phaser.processions = [mock_proc]
|
||||
|
||||
|
||||
result = phaser.current_procession()
|
||||
self.assertEqual(result, 0)
|
||||
self.assertEqual(phaser.state, PhaserState.FINISHED)
|
||||
@@ -104,11 +104,11 @@ class TestPhaser(unittest.TestCase):
|
||||
"""测试没有 Procession"""
|
||||
phaser = Phaser([])
|
||||
phaser.processions = []
|
||||
|
||||
|
||||
result = phaser.current_procession()
|
||||
self.assertEqual(result, 0)
|
||||
self.assertEqual(phaser.state, PhaserState.FINISHED)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user