当前位置: 首页>>代码示例>>Python>>正文


Python DependencyGraph.add_dependency方法代码示例

本文整理汇总了Python中vunit.dependency_graph.DependencyGraph.add_dependency方法的典型用法代码示例。如果您正苦于以下问题:Python DependencyGraph.add_dependency方法的具体用法?Python DependencyGraph.add_dependency怎么用?Python DependencyGraph.add_dependency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vunit.dependency_graph.DependencyGraph的用法示例。


在下文中一共展示了DependencyGraph.add_dependency方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_should_resort_after_additions

# 需要导入模块: from vunit.dependency_graph import DependencyGraph [as 别名]
# 或者: from vunit.dependency_graph.DependencyGraph import add_dependency [as 别名]
 def test_should_resort_after_additions(self):
     nodes = ["a", "b", "c", "d", "e", "f"]
     dependencies = [("a", "b"), ("a", "c"), ("b", "d"), ("e", "f")]
     graph = DependencyGraph()
     self._add_nodes_and_dependencies(graph, nodes, dependencies)
     graph.toposort()
     dependencies = [("a", "b"), ("a", "c"), ("b", "d"), ("e", "f"), ("b", "g")]
     graph.add_node("g")
     graph.add_dependency("b", "g")
     result = graph.toposort()
     self._check_result(result, dependencies)
开发者ID:mark-newsam,项目名称:vunit,代码行数:13,代码来源:test_dependency_graph.py

示例2: test_should_resort_after_additions

# 需要导入模块: from vunit.dependency_graph import DependencyGraph [as 别名]
# 或者: from vunit.dependency_graph.DependencyGraph import add_dependency [as 别名]
 def test_should_resort_after_additions(self):
     nodes = ['a', 'b', 'c', 'd', 'e', 'f']
     dependencies = [('a', 'b'), ('a', 'c'), ('b', 'd'), ('e', 'f')]
     g = DependencyGraph()
     self._add_nodes_and_dependencies(g, nodes, dependencies)
     g.toposort()
     dependencies = [('a', 'b'), ('a', 'c'), ('b', 'd'), ('e', 'f'), ('b', 'g')]
     g.add_node('g')
     g.add_dependency('b', 'g')
     result = g.toposort()
     for d in dependencies:
         self.assertTrue(result.index(d[0]) < result.index(d[1]), "%s is not before %s" % d)
开发者ID:tomasnilefrost,项目名称:vunit,代码行数:14,代码来源:test_dependency_graph.py


注:本文中的vunit.dependency_graph.DependencyGraph.add_dependency方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。