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)
Make synthetic data in the shape of a pinwheel.
dataset/ETHPy150Open twisted/twisted/twisted/web/test/test_newclient.py/MakeStatefulDispatcherTests.test_functionCalledByState--crossover with--dataset/ETHPy150Open HIPS/autograd/examples/gmm.py/make_pinwheel_data