class documentation

class MethodicalTests(TestCase): (source)

View In Hierarchy

Tests for MethodicalMachine.

Method test_badTransitionForCurrentState Calling any input method that lacks a transition for the machine's current state raises an informative NoTransition.
Method test_collectOutputs Outputs can be combined with the "collector" argument to "upon".
Method test_defaultOutputs It is possible to write a transition with no outputs
Method test_filterArgs filterArgs() should not filter the `args` parameter if outputSpec accepts `*args`.
Method test_getArgNames Type annotations should be included in the set of
Method test_inputFunctionsMustBeEmpty The wrapped input function must have an empty body.
Method test_inputOutputMismatch All the argument lists of the outputs for a given input must match; if one does not the call to upon will raise a TypeError.
Method test_inputWithArguments If an input takes an argument, it will pass that along to its output.
Method test_machineItselfIsPrivate MethodicalMachine is an implementation detail. If you attempt to access it on an instance of your class, you will get an exception. However, since tools may need to access it for the purposes of, for example, visualization, you may access it on the class itself.
Method test_methodName Input methods preserve their declared names.
Method test_multipleInitialStatesFailure A MethodicalMachine can only have one initial state.
Method test_multipleMachines Two machines may co-exist happily on the same instance; they don't interfere with each other.
Method test_multipleTransitionsFailure A MethodicalMachine can only have one transition per start/event pair.
Method test_oneTransition MethodicalMachine provides a way for you to declare a state machine with inputs, outputs, and states as methods. When you have declared an input, an output, and a state, calling the input method in that state will produce the specified output.
Method test_outputsArePrivate One of the benefits of using a state machine is that your output method implementations don't need to take invalid state transitions into account - the methods simply won't be called. This property would be broken if client code called output methods directly, so output methods are not directly visible under their names.
Method test_outputWithSubsetOfArguments Inputs pass arguments that output will accept.
Method test_restoreState MethodicalMachine.unserializer decorates a function that becomes a machine-state unserializer; its return value is mapped to the serialized parameter to state, and the MethodicalMachine associated with that instance's state is updated to that state.
Method test_saveState MethodicalMachine.serializer is a decorator that modifies its decoratee's signature to take a "state" object as its first argument, which is the "serialized" argument to the MethodicalMachine.state decorator.
Method test_stateLoop It is possible to write a self-loop by omitting "enter"
def test_badTransitionForCurrentState(self): (source)

Calling any input method that lacks a transition for the machine's current state raises an informative NoTransition.

def test_collectOutputs(self): (source)

Outputs can be combined with the "collector" argument to "upon".

def test_defaultOutputs(self): (source)

It is possible to write a transition with no outputs

def test_filterArgs(self): (source)

filterArgs() should not filter the `args` parameter if outputSpec accepts `*args`.

def test_getArgNames(self): (source)

Type annotations should be included in the set of

def test_inputFunctionsMustBeEmpty(self): (source)

The wrapped input function must have an empty body.

def test_inputOutputMismatch(self): (source)

All the argument lists of the outputs for a given input must match; if one does not the call to upon will raise a TypeError.

def test_inputWithArguments(self): (source)

If an input takes an argument, it will pass that along to its output.

def test_machineItselfIsPrivate(self): (source)

MethodicalMachine is an implementation detail. If you attempt to access it on an instance of your class, you will get an exception. However, since tools may need to access it for the purposes of, for example, visualization, you may access it on the class itself.

def test_methodName(self): (source)

Input methods preserve their declared names.

def test_multipleInitialStatesFailure(self): (source)

A MethodicalMachine can only have one initial state.

def test_multipleMachines(self): (source)

Two machines may co-exist happily on the same instance; they don't interfere with each other.

def test_multipleTransitionsFailure(self): (source)

A MethodicalMachine can only have one transition per start/event pair.

def test_oneTransition(self): (source)

MethodicalMachine provides a way for you to declare a state machine with inputs, outputs, and states as methods. When you have declared an input, an output, and a state, calling the input method in that state will produce the specified output.

def test_outputsArePrivate(self): (source)

One of the benefits of using a state machine is that your output method implementations don't need to take invalid state transitions into account - the methods simply won't be called. This property would be broken if client code called output methods directly, so output methods are not directly visible under their names.

def test_outputWithSubsetOfArguments(self): (source)

Inputs pass arguments that output will accept.

def test_restoreState(self): (source)

MethodicalMachine.unserializer decorates a function that becomes a machine-state unserializer; its return value is mapped to the serialized parameter to state, and the MethodicalMachine associated with that instance's state is updated to that state.

def test_saveState(self): (source)

MethodicalMachine.serializer is a decorator that modifies its decoratee's signature to take a "state" object as its first argument, which is the "serialized" argument to the MethodicalMachine.state decorator.

def test_stateLoop(self): (source)

It is possible to write a self-loop by omitting "enter"