'A method defined with L{makeStatefulDispatcher} invokes a second
method based on the current state of the object.'

def test_functionCalledByState(self):

    class Foo:
        _state = 'A'
        def bar(self):
            pass
        bar = makeStatefulDispatcher('quux', bar)
        def _quux_A(self):
            return 'a'
        def _quux_B(self):
            return 'b'
    stateful = Foo()
    self.assertEqual(stateful.bar(), 'a')
    stateful._state = 'B'
    self.assertEqual(stateful.bar(), 'b')
    stateful._state = 'C'
    self.assertRaises(RuntimeError, stateful.bar)
