Exemple #1
0
 def test_transition_wrong_to4(self):
     with self.assertRaisesRegex(ValueError, 'The to state is not'):
         Transition('frm', 'label', {''})
Exemple #2
0
 def test_transition_wrong_label2(self):
     with self.assertRaisesRegex(ValueError, 'The label is not'):
         Transition('frm', '', 'to')
Exemple #3
0
 def test_transition_wrong_from4(self):
     with self.assertRaisesRegex(ValueError, 'The frm state is not'):
         Transition({''}, 'label', 'to')
Exemple #4
0
 def test_transition_set(self):
     self.assertEqual('{frm}-label->{to}', str(Transition({'frm'}, 'label', {'to'})))
Exemple #5
0
 def test_transition_setofitems(self):
     self.assertEqual('{A -> •B}-label->{C -> •D}', str(Transition({Item('A', ('B', ))}, 'label', {Item('C', ('D',))})))
Exemple #6
0
 def test_transition_hash(self):
     S = {
         Transition('a', 'b', 'c'): 1,
         Transition('a', 'b', 'c'): 2
     }
     self.assertEqual(1, len(S))
Exemple #7
0
 def test_transition_str(self):
     self.assertEqual('frm-label->to', str(Transition('frm', 'label', 'to')))
Exemple #8
0
 def test_transition_lto(self):
     self.assertIs(Transition('a', 'b', 'c').__lt__(object()), NotImplemented)
Exemple #9
0
 def test_transition_eqo(self):
     self.assertFalse(Transition('a', 'b', 'c') == object())
Exemple #10
0
 def test_transition_totalorder(self):
     self.assertTrue(Transition('a', 'b', 'c') > Transition('a', 'b', 'b'))
Exemple #11
0
 def test_transition_unpack(self):
     f, l, t = Transition('a', 'b', 'c')
     self.assertEqual(('a', 'b', 'c'), (f, l, t))
Exemple #12
0
 def test_transition_tupleofitems(self):
     self.assertEqual(
         '(A -> •B)-label->(C -> •D)',
         str(
             Transition((Item('A', ('B', )), ), 'label',
                        (Item('C', ('D', )), ))))