Exemplo n.º 1
0
 def test_order_ascc(self) -> None:
     manager = self._make_manager()
     graph = {'a': State('a', None, 'import b, c', manager),
              'd': State('d', None, 'def f(): import a', manager),
              'b': State('b', None, 'import c', manager),
              'c': State('c', None, 'import b, d', manager),
              }
     res = sorted_components(graph)
     assert_equal(res, [frozenset({'a', 'd', 'c', 'b'})])
     ascc = res[0]
     scc = order_ascc(graph, ascc)
     assert_equal(scc, ['d', 'c', 'b', 'a'])
Exemplo n.º 2
0
 def test_order_ascc(self) -> None:
     manager = self._make_manager()
     graph = {'a': State('a', None, 'import b, c', manager),
              'd': State('d', None, 'def f(): import a', manager),
              'b': State('b', None, 'import c', manager),
              'c': State('c', None, 'import b, d', manager),
              }
     res = sorted_components(graph)
     assert_equal(res, [frozenset({'a', 'd', 'c', 'b'})])
     ascc = res[0]
     scc = order_ascc(graph, ascc)
     assert_equal(scc, ['d', 'c', 'b', 'a'])