def test_reset(self):
        sm = StateMachine(
            {"initial": "foo", "transitions": {("foo", "bar"): lambda: True}}
        )

        self.assertIsNone(sm.state)
        sm.reset()
        self.assertIsNone(sm.state)

        sm.process(0.1)
        self.assertEqual(sm.state, "foo")
        sm.reset()
        self.assertIsNone(sm.state)

        sm.process(0.2)
        sm.process(0.3)
        self.assertEqual(sm.state, "bar")
        sm.reset()
        self.assertIsNone(sm.state)
Beispiel #2
0
    def test_reset(self):
        sm = StateMachine({
            'initial': 'foo',
            'transitions': {
                ('foo', 'bar'): lambda: True
            }
        })

        self.assertIsNone(sm.state)
        sm.reset()
        self.assertIsNone(sm.state)

        sm.process(0.1)
        self.assertEqual(sm.state, 'foo')
        sm.reset()
        self.assertIsNone(sm.state)

        sm.process(0.2)
        sm.process(0.3)
        self.assertEqual(sm.state, 'bar')
        sm.reset()
        self.assertIsNone(sm.state)
    def test_reset(self):
        sm = StateMachine({
            'initial': 'foo',
            'transitions': {
                ('foo', 'bar'): lambda: True
            }
        })

        self.assertIsNone(sm.state)
        sm.reset()
        self.assertIsNone(sm.state)

        sm.process(0.1)
        self.assertEqual(sm.state, 'foo')
        sm.reset()
        self.assertIsNone(sm.state)

        sm.process(0.2)
        sm.process(0.3)
        self.assertEqual(sm.state, 'bar')
        sm.reset()
        self.assertIsNone(sm.state)