Skip to content

Commit

Permalink
Added loop automaton test.
Browse files Browse the repository at this point in the history
  • Loading branch information
nazavode committed Oct 12, 2015
1 parent 713fcb5 commit 44a351d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_automaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,29 @@ class Sink(Automaton):
assert auto.state == "sink1"
auto.event3()
assert auto.state == "sink2"


def test_sink_state_loop():
class Sink(Automaton):
event1 = Event("state_a", "state_b")
event2 = Event(("state_a", "state_b", "state_c", "state_d"), "sink1")
event3 = Event(("state_a", "state_b", "state_c", "state_d", "sink1"), "sink2")
event4 = Event("sink2", "state_a")

auto = Sink(initial_state="state_a")
auto.event1()
assert auto.state == "state_b"
auto.event2()
assert auto.state == "sink1"
auto.event3()
assert auto.state == "sink2"
auto.event4()
assert auto.state == "state_a"
auto.event1()
assert auto.state == "state_b"
auto.event2()
assert auto.state == "sink1"
auto.event3()
assert auto.state == "sink2"
auto.event4()
assert auto.state == "state_a"

0 comments on commit 44a351d

Please sign in to comment.