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