本文整理匯總了Python中statemachine.StateMachine.inState方法的典型用法代碼示例。如果您正苦於以下問題:Python StateMachine.inState方法的具體用法?Python StateMachine.inState怎麽用?Python StateMachine.inState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類statemachine.StateMachine
的用法示例。
在下文中一共展示了StateMachine.inState方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_stateMachine_transitions_byAssignment
# 需要導入模塊: from statemachine import StateMachine [as 別名]
# 或者: from statemachine.StateMachine import inState [as 別名]
def test_stateMachine_transitions_byAssignment(self):
"""Test State Transations from State 1 to State2."""
machine = StateMachine(State1)
self.assertRaises(StateError, machine.goto, State1)
self.assertTrue(machine.inState(State1))
machine.state = State2
self.assertEqual(machine.message, 'Entered State 2')
self.assertTrue(machine.inState(State2))
示例2: test_stateMachine_finalState
# 需要導入模塊: from statemachine import StateMachine [as 別名]
# 或者: from statemachine.StateMachine import inState [as 別名]
def test_stateMachine_finalState(self):
"""Test Final State."""
machine = StateMachine(State1)
self.assertTrue(machine.inState(State1))
machine.goto(State2)
self.assertTrue(machine.inState(State2))
self.assertFalse(State1 in machine.state.movesTo)
self.assertFalse(State2 in machine.state.movesTo)
self.assertRaises(StateError, machine.goto, State1)
self.assertRaises(StateError, machine.goto, State2)
self.assertTrue(machine.inState(State2))
示例3: test_stateMachine_initialState
# 需要導入模塊: from statemachine import StateMachine [as 別名]
# 或者: from statemachine.StateMachine import inState [as 別名]
def test_stateMachine_initialState(self):
"""Test State Machine Initial set up."""
machine = StateMachine(State1)
self.assertTrue(machine.inState(State1))
self.assertFalse(State1 in machine.state.movesTo)
self.assertTrue(State2 in machine.state.movesTo)