diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-11-06 03:06:06 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-11-06 03:06:06 (GMT) |
commit | c7c7f94fc5d7e9f7e4f175c06dd52628aa357e3d (patch) | |
tree | 25008422c07d68028c0c64d8f41c0fbef54e9ade /tutorius/core.py | |
parent | fe07a6fa0fa0d67d2ada6be1f3da2cb128f9038b (diff) | |
parent | 74dcbcb643cfd66df071020320ba6c0004e92c17 (diff) |
Merge branch 'lp448319' of ../mainline
Conflicts:
addons/readfile.py
tests/probetests.py
tests/run-tests.py
tutorius/TProbe.py
tutorius/constraints.py
tutorius/core.py
tutorius/engine.py
tutorius/properties.py
tutorius/service.py
Diffstat (limited to 'tutorius/core.py')
-rw-r--r-- | tutorius/core.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tutorius/core.py b/tutorius/core.py index bfbe07b..80e1b4f 100644 --- a/tutorius/core.py +++ b/tutorius/core.py @@ -616,3 +616,25 @@ class FiniteStateMachine(State): # If we made it here, then all the states in this FSM could be matched to an # identical state in the other FSM. return True + if len(self._states) != len(otherFSM._states): + return False + + # For each state, try to find a corresponding state in the other FSM + for state_name in self._states.keys(): + state = self._states[state_name] + other_state = None + try: + # Attempt to use this key in the other FSM. If it's not present + # the dictionary will throw an exception and we'll know we have + # at least one different state in the other FSM + other_state = otherFSM._states[state_name] + except: + return False + # If two states with the same name exist, then we want to make sure + # they are also identical + if not state == other_state: + return False + + # If we made it here, then all the states in this FSM could be matched to an + # identical state in the other FSM. + return True |