示例#1
0
 def test_getattr_current(self):
     """Accessing the 'current' property should return the current state."""
     assert transports.State().current == transports.State.pending
示例#2
0
 def test_instantiation_init_ok(self):
     """A new State with a valid init value should start in this state."""
     state = transports.State(init=transports.State.running)
     assert state._state == transports.State.running
示例#3
0
 def test_instantiation_init_ko(self):
     """A new State with an invalid init value should raise InvalidStateError."""
     with pytest.raises(transports.InvalidStateError,
                        match='is not a valid state'):
         transports.State(init='invalid_state')
示例#4
0
 def test_instantiation_no_init(self):
     """A new State without an init value should start in the pending state."""
     state = transports.State()
     assert state._state == transports.State.pending