def __init__(self): StackMachineModule.__init__(self) StackMachineModule.set_start_module(self, TestStackElement1) self.pops = 0 self.pushs = 0 self.interrupts = 0 self.connector = None self.push_data = None
def test_internal_init(self): obj = StackMachineModule() event_framework = EventFrameworkMock() obj.internal_init(Scope("Test.Module"),event_framework) self.assertEquals(type(obj.debug) , Scope) self.assertEquals(obj.debug.get_name(), "Test.Module.StackMachine") self.assertEquals(len(obj.get_stack()), 0) self.assertEquals(event_framework, obj._event_framework)
def create_StackMachineModule_with_start_module_and_data(start_module, init_data=None): obj = StackMachineModule() obj.internal_init(Scope("Test.Module"), EventFrameworkMock()) data = {} obj.start(data) obj.set_start_module(start_module, init_data) return obj, data
def push(self, module, init_data=None): StackMachineModule.push(self, module, init_data) self.pushs += 1 self.push_data = (module, init_data)
def pop(self): StackMachineModule.pop(self) self.pops += 1
def interrupt(self): StackMachineModule.interrupt(self) self.interrupts += 1