Skip to content

Commit af6f42a

Browse files
author
Piotr Gularski
committed
UT for add_states
1 parent 28e8093 commit af6f42a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

test/test_pysm.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,11 +1200,15 @@ def do(event):
12001200
m.dispatch(_e('do'))
12011201

12021202

1203-
def test_add_states():
1204-
# TODO Implement
1205-
pass
1206-
1203+
def test_add_states_and_set_initial_state():
1204+
m = StateMachine('m')
1205+
s0 = StateMachine('s0')
1206+
s1 = StateMachine('s1')
1207+
s2 = State('s2')
12071208

1208-
def test_set_initial_state():
1209-
# TODO Implement
1210-
pass
1209+
m.add_states(s0, s1, s2)
1210+
assert all(state in m.states for state in (s0, s1, s2))
1211+
assert m.initial_state is None
1212+
m.set_initial_state(s0)
1213+
m.initialize()
1214+
assert m.initial_state is s0

0 commit comments

Comments
 (0)