예제 #1
0
 def test_repr(self):
     wrapper = base.ImplementationWrapper(self.dummy, 'state1',
         base.Transition('foobar', [base.State('foo', 'Foo')],
             base.State('bar', 'Bar')), None,
         base.noop)
     self.assertIn('foobar', repr(wrapper))
     self.assertIn('state1', repr(wrapper))
     self.assertIn(repr(base.noop), repr(wrapper))
예제 #2
0
 def setUp(self):
     self.foo = base.State('foo', 'Foo')
     self.bar = base.State('bar', 'Bar')
     self.baz = base.State('baz', 'Baz')
     self.baz2 = base.State('baz', 'Baz')
     self.foobar = base.Transition('foobar', self.foo, self.bar)
     self.foobar2 = base.Transition('foobar', self.foo, self.bar)
     self.gobaz = base.Transition('gobaz', [self.foo, self.bar], self.baz)
     self.tl = base.TransitionList([self.foobar, self.gobaz])
예제 #3
0
    def test_state_setting(self):
        class MyWorkflowObject(base.WorkflowEnabled):
            state = self.MyWorkflow()

        obj = MyWorkflowObject()

        self.assertRaises(ValueError, setattr, obj, 'state',
                          base.State('a', 'A'))
예제 #4
0
    def setUp(self):
        class MyWorkflow(base.Workflow):
            states = (
                ('foo', "Foo"),
                ('bar', "Bar"),
                ('baz', "Baz"),
            )
            transitions = (
                ('foobar', 'foo', 'bar'),
                ('gobaz', ('foo', 'bar'), 'baz'),
                ('bazbar', 'baz', 'bar'),
            )
            initial_state = 'foo'

        self.foo = base.State('foo', 'Foo')
        self.bar = base.State('bar', 'Bar')
        self.wf = MyWorkflow
        self.sf = base.StateWrapper(self.foo, self.wf)
        self.sf2 = base.StateWrapper(self.foo, self.wf)
예제 #5
0
 def setUp(self):
     self.foo = base.State('foo', 'Foo')
     self.bar = base.State('bar', 'Bar')
     self.bar2 = base.State('bar', 'Bar')
     self.sl = base.StateList([self.foo, self.bar])
예제 #6
0
 def test_repr(self):
     a = base.State('foo', 'Foo')
     self.assertIn('foo', repr(a))
     self.assertNotIn('Foo', repr(a))
예제 #7
0
 def setUp(self):
     self.foo = base.State('foo', 'Foo')
     self.bar = base.State('bar', 'Bar')
     self.baz = base.State('baz', 'Baz')
     self.foobar = base.Transition('foobar', self.foo, self.bar)
예제 #8
0
 def test_equality(self):
     self.assertNotEqual(base.State('foo', 'Foo'), base.State('foo', 'Foo'))