def test_non_rejecting_scc(self): automaton = self._create_automaton({'init', '1', '2'}, 'init', {'init->1':False, '1->2':False, '2->init':False}) rejecting_sccs = find_rejecting_sccs(automaton) assert len(rejecting_sccs) == 0, str(rejecting_sccs)
def test_tricky_rejecting_scc(self): automaton = self._create_automaton({'init', '1', '2'}, 'init', {'init->1':True, '1->1':True, '1->2':False, '2->1':False}) rejecting_sccs = find_rejecting_sccs(automaton) assert len(rejecting_sccs) == 1, str(rejecting_sccs) assert set(map(lambda n: n.name, chain(*rejecting_sccs))) == {'1', '2'}
def test_two_rejecting_sccs(self): automaton = self._create_automaton({'init', '1', '2'}, 'init', {'init->1':False, '1->1':True, '1->2':False, '2->2':True}) rejecting_sccs = find_rejecting_sccs(automaton) assert len(rejecting_sccs) == 2, str(rejecting_sccs) assert set(map(lambda s: frozenset(map(lambda n: n.name, s)), rejecting_sccs)) \ == {frozenset({'1'}), frozenset({'2'})}, str(rejecting_sccs)