feat: added is_in_final_state method
This commit is contained in:
@@ -210,6 +210,22 @@ class TestMachine(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
m.reset()
|
||||
|
||||
# IS_IN_FINAL_STATE
|
||||
|
||||
def test_is_in_final_state(self):
|
||||
m = Machine()
|
||||
m.add_state("A", True, False)
|
||||
m.add_state("B", False, True)
|
||||
m.add_transition("X", "A", "B", lambda context: print("A -> B"))
|
||||
m.process_input("X")
|
||||
self.assertTrue(m.is_in_final_state())
|
||||
m.reset()
|
||||
self.assertFalse(m.is_in_final_state())
|
||||
|
||||
def test_is_in_final_state_not_started(self):
|
||||
m = Machine()
|
||||
self.assertFalse(m.is_in_final_state())
|
||||
|
||||
# STATE
|
||||
|
||||
def test_state_str(self):
|
||||
|
||||
Reference in New Issue
Block a user