Exemple #1
0
 def test_sorted_components(self) -> None:
     manager = self._make_manager()
     graph = {'a': State('a', None, 'import b, c', manager),
              'd': State('d', None, 'pass', manager),
              'b': State('b', None, 'import c', manager),
              'c': State('c', None, 'import b, d', manager),
              }
     res = sorted_components(graph)
     assert_equal(res, [frozenset({'d'}), frozenset({'c', 'b'}), frozenset({'a'})])
Exemple #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'])
Exemple #3
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'])
Exemple #4
0
 def test_sorted_components(self) -> None:
     manager = self._make_manager()
     graph = {
         'a': State('a', None, 'import b, c', manager),
         'd': State('d', None, 'pass', manager),
         'b': State('b', None, 'import c', manager),
         'c': State('c', None, 'import b, d', manager),
     }
     res = sorted_components(graph)
     assert_equal(
         res, [frozenset({'d'}),
               frozenset({'c', 'b'}),
               frozenset({'a'})])
Exemple #5
0
 def test_sorted_components(self) -> None:
     manager = BuildManager(
         data_dir="",
         lib_path=[],
         target=TYPE_CHECK,
         pyversion=(3, 5),
         flags=[],
         ignore_prefix="",
         custom_typing_module="",
         source_set=None,
         reports=None,
     )
     graph = {
         "a": State("a", None, "import b, c", manager),
         "b": State("b", None, "import c", manager),
         "c": State("c", None, "import b, d", manager),
         "d": State("d", None, "pass", manager),
     }
     res = sorted_components(graph)
     assert_equal(res, [frozenset({"d"}), frozenset({"c", "b"}), frozenset({"a"})])
 def test_sorted_components(self) -> None:
     manager = BuildManager(data_dir='',
                            lib_path=[],
                            target=TYPE_CHECK,
                            pyversion=(3, 5),
                            flags=[],
                            ignore_prefix='',
                            custom_typing_module='',
                            source_set=None,
                            reports=None)
     graph = {
         'a': State('a', None, 'import b, c', manager),
         'b': State('b', None, 'import c', manager),
         'c': State('c', None, 'import b, d', manager),
         'd': State('d', None, 'pass', manager)
     }
     res = sorted_components(graph)
     assert_equal(
         res, [frozenset({'d'}),
               frozenset({'c', 'b'}),
               frozenset({'a'})])