# Path: zoonado/states.py
# class States(object):
# class SessionStateMachine(object):
#     CONNECTED = "connected"
#     SUSPENDED = "suspended"
#     READ_ONLY = "read_only"
#     LOST = "lost"
#     def __init__(self):
#     def transition_to(self, state):
#     def wait_for(self, *states):
#     def __eq__(self, state):
#     def __ne__(self, state):


from tornado import testing
from zoonado import states

        yield wait

        self.fsm.transition_to(states.States.LOST)

        wait = self.fsm.wait_for(
            states.States.CONNECTED, states.States.READ_ONLY
        )

        assert wait.done() is False

        self.fsm.transition_to(states.States.READ_ONLY)

        yield wait

    @testing.gen_test
    def test_waiting_on_current_state_yield_immediately(self):
        yield self.fsm.wait_for(states.States.LOST)

    def test_valid_transitions(self):
        # lost/initial sessions can connect
        assert self.fsm == states.States.LOST
        self.fsm.transition_to(states.States.CONNECTED)

        # connected sessions can be suspended
        assert self.fsm == states.States.CONNECTED
        self.fsm.transition_to(states.States.SUSPENDED)

        # suspended session can reconnect
        assert self.fsm == states.States.SUSPENDED

# Path: zoonado/states.py
# class States(object):
# class SessionStateMachine(object):
#     CONNECTED = "connected"
#     SUSPENDED = "suspended"
#     READ_ONLY = "read_only"
#     LOST = "lost"
#     def __init__(self):
#     def transition_to(self, state):
#     def wait_for(self, *states):
#     def __eq__(self, state):
#     def __ne__(self, state):


# Path: tests/test_states.py
from tornado import testing
from zoonado import states


        yield wait

        self.fsm.transition_to(states.States.LOST)

        wait = self.fsm.wait_for(
            states.States.CONNECTED, states.States.READ_ONLY
        )

        assert wait.done() is False

        self.fsm.transition_to(states.States.READ_ONLY)

        yield wait

    @testing.gen_test
    def test_waiting_on_current_state_yield_immediately(self):
        yield self.fsm.wait_for(states.States.LOST)

    def test_valid_transitions(self):
        # lost/initial sessions can connect
        assert self.fsm == states.States.LOST
        self.fsm.transition_to(states.States.CONNECTED)

        # connected sessions can be suspended
        assert self.fsm == states.States.CONNECTED
        self.fsm.transition_to(states.States.SUSPENDED)

        # suspended session can reconnect
        assert self.fsm == states.States.SUSPENDED

        self.fsm.transition_to(states.States.CONNECTED)