本文整理汇总了Python中sequencer.dgm.model.RuleSet类的典型用法代码示例。如果您正苦于以下问题:Python RuleSet类的具体用法?Python RuleSet怎么用?Python RuleSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RuleSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_multiple_actions_nodeps
def test_multiple_actions_nodeps(self):
"""
Check that a given component can contain multiple actions.
RuleSet: #ta, #ta
Components: a#ta
Expecting: a#ta with 2 actions.
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="R1",
action="Action for a",
types=["[email protected]"]))
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="R2",
action="Action for a",
types=["[email protected]"]))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("a#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 1, "Map: %s" % components)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("R1" in components["a#[email protected]"].actions)
self.assertTrue("R2" in components["a#[email protected]"].actions)
self.assertEquals(len(components["a#[email protected]"].actions), 2)
self.assertEquals(len(depgraph.dag.node_attributes("a#[email protected]")), 2)
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:27,代码来源:testmodel_depgraph.py
示例2: test_filtered_components
def test_filtered_components(self):
"""
Check that filter other than NONE and ALL works as expected.
RuleSet: #root (filter = in.*)
Components: in#root in_foo#root out#root
Expecting: in#root, in_foo#root out#root
(out#root has no action, it has been filtered out)
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="R",
types=["[email protected]"],
action="Root Action",
# WARNING: space is important here!!
filter="%name =~ in.*"))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("in#[email protected]"),
Component("in_foo#[email protected]"),
Component("out#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 3)
self.assertTrue("in#[email protected]" in components)
self.assertTrue("in_foo#[email protected]" in components)
self.assertTrue("out#[email protected]" in components)
self.assertTrue(depgraph.dag is not None)
self.assertTrue(depgraph.dag.has_node("in#[email protected]"))
self.assertTrue(depgraph.dag.has_node("in_foo#[email protected]"))
self.assertTrue(depgraph.dag.has_node("out#[email protected]"))
self.assertTrue("R" in components["in#[email protected]"].actions)
self.assertEquals("Root Action", components["in#[email protected]"].actions["R"])
self.assertTrue("R" in components["in_foo#[email protected]"].actions)
self.assertEquals("Root Action", components["in_foo#[email protected]"].actions["R"])
self.assertTrue("Root Action" not in components["out#[email protected]"].actions)
开发者ID:af-bull,项目名称:sequencer,代码行数:34,代码来源:testmodel_depgraph_basic.py
示例3: test_simple_nodeps_ta_tb_a_b
def test_simple_nodeps_ta_tb_a_b(self):
"""
RuleSet: #ta, #tb,
Components: a#ta, b#tb
Expecting: a#ta, b#tb
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Ra",
action="Action for a",
types=["[email protected]"]))
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Rb",
action="Action for b",
types=["[email protected]"]))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("a#[email protected]"),
Component("b#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 2)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("b#[email protected]" in components)
self.assertTrue(depgraph.dag is not None)
self.assertTrue(depgraph.dag.has_node("a#[email protected]"))
self.assertTrue(depgraph.dag.has_node("b#[email protected]"))
self.assertTrue("Ra" in components["a#[email protected]"].actions)
self.assertEquals("Action for a", components["a#[email protected]"].actions["Ra"])
self.assertTrue("Rb" in components["b#[email protected]"].actions)
self.assertEquals("Action for b", components["b#[email protected]"].actions["Rb"])
self.assertNoEdgeBetween(depgraph.dag, "a#[email protected]", "b#[email protected]")
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:31,代码来源:testmodel_depgraph.py
示例4: test_no_root_with_self_cycle_in_graph_rules
def test_no_root_with_self_cycle_in_graph_rules(self):
"""
There are no match in the given component list.
RuleSet: #ta->#ta
Components: c#tc
Expecting: c#tc.
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Ra",
action="Action for a",
types=["[email protected]"],
depsfinder=tools.getMockDepsFinderCmd(["foo#[email protected]"]),
dependson=["Ra"]))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("c#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 1, "Map: %s" % components)
self.assertTrue("c#[email protected]" in components)
self.assertTrue(depgraph.dag is not None)
self.assertEquals(len(depgraph.dag.nodes()), 1)
self.assertTrue(depgraph.dag.has_node("c#[email protected]"))
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:25,代码来源:testmodel_depgraph.py
示例5: test_root_in_simple_cycle
def test_root_in_simple_cycle(self):
"""
The root is in a simple cycle.
RuleSet: #ta->#tb, #tb->#tc, #tc->#ta (triangle)
Components: b#tb
Expecting: b#tb
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Ra",
action="Action for a",
types=["[email protected]"],
dependson=["Rb"]))
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Rb",
action="Action for b",
types=["[email protected]"],
dependson=["Rc"]))
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Rc",
action="Action for c",
dependson=["Ra"],
types=["[email protected]"]))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("b#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 1, "Map: %s" % components)
self.assertTrue("b#[email protected]" in components)
self.assertTrue(depgraph.dag is not None)
self.assertTrue(depgraph.dag.has_node("b#[email protected]"))
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:32,代码来源:testmodel_depgraph.py
示例6: test_simple_deps_ta_tb_b_a_withdepsfinder
def test_simple_deps_ta_tb_b_a_withdepsfinder(self):
"""
RuleSet: #ta->#tb,
Components: b#tb, a#ta (reverse)
Component a does provide a depfinder that returns b#tb
Expecting: a#ta -> b#tb
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Ra",
action="Action for a",
types=["[email protected]"],
depsfinder=tools.getMockDepsFinderCmd(["b#[email protected]"]),
dependson=["Rb"]))
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Rb",
action="Action for b",
types=["[email protected]"]))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("b#[email protected]"),
Component("a#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 2, "Map: %s" % components)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("b#[email protected]" in components)
self.assertTrue(depgraph.dag is not None)
self.assertTrue(depgraph.dag.has_node("a#[email protected]"))
self.assertTrue(depgraph.dag.has_node("b#[email protected]"))
self.assertTrue(depgraph.dag.has_edge(("a#[email protected]", "b#[email protected]")))
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:31,代码来源:testmodel_depgraph.py
示例7: test_simple_deps_ta_tb_b_a_nodepsfinder
def test_simple_deps_ta_tb_b_a_nodepsfinder(self):
"""
RuleSet: #ta->#tb,
Components: b#tb, a#ta (reverse than test_simple_deps_ta_tb_a_b_nodepsfinder)
Expecting: a#ta, b#tb (order does not count)
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Ra",
action="Action for a",
types=["[email protected]"],
dependson=["Rb"]))
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Rb",
action="Action for b",
types=["[email protected]"]))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("b#[email protected]"),
Component("a#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 2)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("b#[email protected]" in components)
self.assertTrue(depgraph.dag is not None)
self.assertTrue(depgraph.dag.has_node("a#[email protected]"))
self.assertTrue(depgraph.dag.has_node("b#[email protected]"))
self.assertNoEdgeBetween(depgraph.dag, "a#[email protected]", "b#[email protected]")
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:28,代码来源:testmodel_depgraph.py
示例8: test_filtered_none_components_deps
def test_filtered_none_components_deps(self):
"""
Check that dependencies are not in the graph when they are filtered out.
RuleSet: #root -> #deps (filter = NONE)
Components: a#root
Component a provides a depfinder that returns b#deps
Expecting: a#root, b#deps (b#deps has no action, it has been filtered out)
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="R-root",
action="Root Action",
types=["[email protected]"],
depsfinder=tools.getMockDepsFinderCmd(["b#[email protected]"]),
dependson=["R-Deps"]))
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="R-Deps",
action="Deps Action",
types=["[email protected]"],
filter=NONE))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("a#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 2)
self.assertTrue(depgraph.dag is not None)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("R-root" in components["a#[email protected]"].actions)
self.assertEquals("Root Action", components["a#[email protected]"].actions["R-root"])
self.assertTrue("b#[email protected]" in components)
self.assertTrue(depgraph.dag.has_node("a#[email protected]"))
self.assertTrue(depgraph.dag.has_node("b#[email protected]"))
self.assertTrue("Deps Action" not in components["b#[email protected]"].actions)
开发者ID:af-bull,项目名称:sequencer,代码行数:33,代码来源:testmodel_depgraph_basic.py
示例9: test_a_nop_b
def test_a_nop_b(self):
"""
Check that action NONE are understood correctly.
RuleSet: #root, #dep (filter = ALL),
a#root -> b#dep (a.action=NONE)
Expecting: a#root -> b#dep
But a#root has no attribute in the xml graph.
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Root",
types=["[email protected]"],
action=NONE,
depsfinder=tools.getMockDepsFinderCmd(["b#[email protected]"]),
dependson=['Dep']))
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="Dep",
types=["[email protected]"],
action="Dep Action"))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("a#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 2)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("b#[email protected]" in components)
self.assertTrue(depgraph.dag is not None)
self.assertTrue(depgraph.dag.has_node("a#[email protected]"))
self.assertTrue(depgraph.dag.has_node("b#[email protected]"))
self.assertFalse("Root" in components["a#[email protected]"].actions, components)
self.assertTrue("Dep" in components["b#[email protected]"].actions)
attributes = depgraph.dag.node_attributes("a#[email protected]")
self.assertEquals(len(attributes), 0)
attributes = depgraph.dag.node_attributes("b#[email protected]")
self.assertEquals(len(attributes), 1)
开发者ID:af-bull,项目名称:sequencer,代码行数:35,代码来源:testmodel_depgraph_basic.py
示例10: test_multiple_actions_cycle
def test_multiple_actions_cycle(self):
"""
Check that a given component can contain multiple actions.
RuleSet: R1:#ta, R2:#ta->R1
Components: a#ta (R1 depsfinder returns itself: a#ta)
Expecting: a#ta with 2 actions and a cycle.
"""
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="R1",
action="Action for a",
types=["[email protected]"]))
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="R2",
action="Action for a",
types=["[email protected]"],
depsfinder=tools.getMockDepsFinderCmd(["a#[email protected]"]),
dependson=["R1"]))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("a#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 1, "Map: %s" % components)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("R1" in components["a#[email protected]"].actions)
self.assertTrue("R2" in components["a#[email protected]"].actions)
self.assertEquals(len(components["a#[email protected]"].actions), 2)
self.assertEquals(len(depgraph.dag.node_attributes("a#[email protected]")), 2)
self.assertTrue(depgraph.dag.has_edge(("a#[email protected]", "a#[email protected]")))
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:30,代码来源:testmodel_depgraph.py
示例11: test_ruleset_field_empty
def test_ruleset_field_empty(self):
ruleset = RuleSet(set())
self.assertTrue(ruleset.name is None)
self.assertEquals(ruleset.rules, set())
graph = ruleset.get_rules_graph()
self.assertTrue(graph is not None)
self.assertEquals(len(graph.edges()), 0)
self.assertEquals(len(graph.nodes()), 0)
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:8,代码来源:testmodel_basic.py
示例12: test_ruleset_field_single
def test_ruleset_field_single(self):
rules = set()
rules.add(tools.create_rule(self.__class__.__name__,
"ruleset_field_single"))
ruleset = RuleSet(rules)
self.assertEquals(ruleset.name, self.__class__.__name__)
self.assertEquals(ruleset.rules, rules)
graph = ruleset.get_rules_graph()
self.assertTrue(graph is not None)
self.assertEquals(len(graph.edges()), 0)
self.assertEquals(len(graph.nodes()), 1)
self.assertTrue(graph.has_node("ruleset_field_single"))
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:12,代码来源:testmodel_basic.py
示例13: test_only_root_rules_applied
def test_only_root_rules_applied(self):
"""
Check that a rule is applied on a parameter only if it is a
potential root.
RuleSet: #t(action1)->#t(action2)
Components: a#t, b#t (a#t depsfinder returns b#t)
Expecting: a#t contains only 1 action while b#t contains two actions.
"""
rules = set()
rules.add(
tools.create_rule(
ruleset=self.__class__.__name__,
name="Ra",
action="Action for a",
types=["[email protected]"],
filter="%name =~ a",
depsfinder=tools.getMockDepsFinderCmd(["b#[email protected]"]),
dependson=["Rdep"],
)
)
rules.add(
tools.create_rule(
ruleset=self.__class__.__name__,
name="Rb",
action="Action for b",
types=["[email protected]"],
filter="%name =~ b",
dependson=["Rdep"],
)
)
rules.add(
tools.create_rule(ruleset=self.__class__.__name__, name="Rdep", action="Action for dep", types=["[email protected]"])
)
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("a#[email protected]"), Component("b#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 2, "Map: %s" % components)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("b#[email protected]" in components)
self.assertEquals(len(components["a#[email protected]"].actions), 1)
self.assertTrue("Ra" in components["a#[email protected]"].actions)
self.assertEquals(len(components["b#[email protected]"].actions), 2)
self.assertTrue("Rb" in components["b#[email protected]"].actions)
self.assertTrue("Rdep" in components["b#[email protected]"].actions)
self.assertEquals(len(depgraph.dag.node_attributes("a#[email protected]")), 1)
self.assertEquals(len(depgraph.dag.node_attributes("b#[email protected]")), 2)
开发者ID:af-bull,项目名称:sequencer,代码行数:51,代码来源:testmodel_depgraph.py
示例14: test_unknown_component
def test_unknown_component(self):
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="test_unknown_component",
types=["[email protected]"]))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("foo#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 1)
self.assertTrue("foo#[email protected]" in components)
self.assertEquals(len(components["foo#[email protected]"].actions), 0)
self.assertTrue(depgraph.dag is not None)
self.assertTrue(depgraph.dag.has_node("foo#[email protected]"))
开发者ID:af-bull,项目名称:sequencer,代码行数:14,代码来源:testmodel_depgraph_basic.py
示例15: test_ruleset_dependencies
def test_ruleset_dependencies(self):
rules = set()
rules.add(tools.create_rule(self.__class__.__name__,
"ruleset_dependencies"))
rules.add(tools.create_rule(self.__class__.__name__,
"ruleset_dependencies2",
dependson=["ruleset_dependencies"]))
ruleset = RuleSet(rules)
self.assertEquals(ruleset.name, self.__class__.__name__)
self.assertEquals(ruleset.rules, rules)
graph = ruleset.get_rules_graph()
self.assertTrue(graph is not None)
self.assertEquals(len(graph.edges()), 1)
self.assertTrue(graph.has_edge(("ruleset_dependencies2",
"ruleset_dependencies")))
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:15,代码来源:testmodel_basic.py
示例16: test_filtered_all_components
def test_filtered_all_components(self):
rules = set()
rules.add(tools.create_rule(ruleset=self.__class__.__name__,
name="test_filtered_all_components",
types=["[email protected]"],
filter=ALL))
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("in#[email protected]"),
Component("out#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 2)
self.assertTrue(depgraph.dag is not None)
self.assertTrue("in#[email protected]" in components)
self.assertTrue("out#[email protected]" in components)
self.assertTrue(depgraph.dag.has_node("in#[email protected]"))
self.assertTrue(depgraph.dag.has_node("out#[email protected]"))
开发者ID:af-bull,项目名称:sequencer,代码行数:17,代码来源:testmodel_depgraph_basic.py
示例17: test_simple_noroot
def test_simple_noroot(self):
"""
There are no root in the given component list.
RuleSet: #ta->#tb, #ta->#tc, #tb->#tc (triangle)
Components: b#tb, a#ta (each depsfinder returns c#tc)
Expecting: a#ta -> b#tb, a#ta -> c#tc
"""
rules = set()
rules.add(
tools.create_rule(
ruleset=self.__class__.__name__,
name="Ra",
action="Action for a",
types=["[email protected]"],
depsfinder=tools.getMockDepsFinderCmd(["c#[email protected]"]),
dependson=["Rb", "Rc"],
)
)
rules.add(
tools.create_rule(
ruleset=self.__class__.__name__,
name="Rb",
action="Action for b",
types=["[email protected]"],
depsfinder=tools.getMockDepsFinderCmd(["c#[email protected]"]),
dependson=["Rc"],
)
)
rules.add(
tools.create_rule(ruleset=self.__class__.__name__, name="Rc", action="Action for c", types=["[email protected]"])
)
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("b#[email protected]"), Component("a#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 3, "Map: %s" % components)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("b#[email protected]" in components)
self.assertTrue("c#[email protected]" in components)
self.assertTrue(depgraph.dag is not None)
self.assertTrue(depgraph.dag.has_node("a#[email protected]"))
self.assertTrue(depgraph.dag.has_node("b#[email protected]"))
self.assertTrue(depgraph.dag.has_node("c#[email protected]"))
self.assertTrue(depgraph.dag.has_edge(("a#[email protected]", "c#[email protected]")))
self.assertTrue(depgraph.dag.has_edge(("b#[email protected]", "c#[email protected]")))
开发者ID:af-bull,项目名称:sequencer,代码行数:46,代码来源:testmodel_depgraph.py
示例18: test_root_rules_all_type_apply_to_any_component
def test_root_rules_all_type_apply_to_any_component(self):
rules = set()
r1 = tools.create_rule(ruleset=self.__class__.__name__, name="R1", action="A1", types=["ALL"])
rules.add(r1)
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("a#[email protected]"), Component("b#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 2)
self.assertTrue("a#[email protected]" in components)
self.assertTrue("b#[email protected]" in components)
self.assertTrue(depgraph.dag is not None)
self.assertTrue(depgraph.dag.has_node("a#[email protected]"))
self.assertTrue(depgraph.dag.has_node("b#[email protected]"))
self.assertTrue("R1" in components["a#[email protected]"].actions)
self.assertTrue("R1" in components["b#[email protected]"].actions)
self.assertNoEdgeBetween(depgraph.dag, "a#[email protected]", "b#[email protected]")
开发者ID:af-bull,项目名称:sequencer,代码行数:17,代码来源:testmodel_depgraph.py
示例19: test_rule_applied_at_most_once
def test_rule_applied_at_most_once(self):
"""
Check that a given rule is applied at most once for a given component.
RuleSet: #ta->#tc, #tb->#tc
Components: a#ta, b#tb (each depsfinder returns c#tc)
Expecting: c#tc contains a single action (applied once only).
"""
rules = set()
rules.add(
tools.create_rule(
ruleset=self.__class__.__name__,
name="Ra",
action="Action for a",
types=["[email protected]"],
depsfinder=tools.getMockDepsFinderCmd(["c#[email protected]"]),
dependson=["Rc"],
)
)
rules.add(
tools.create_rule(
ruleset=self.__class__.__name__,
name="Rb",
action="Action for b",
types=["[email protected]"],
depsfinder=tools.getMockDepsFinderCmd(["c#[email protected]"]),
dependson=["Rc"],
)
)
rules.add(
tools.create_rule(ruleset=self.__class__.__name__, name="Rc", action="Action for c", types=["[email protected]"])
)
ruleset = RuleSet(rules)
depgraph = ruleset.get_depgraph([Component("b#[email protected]"), Component("a#[email protected]")])
components = depgraph.components_map
self.assertTrue(components is not None)
self.assertEquals(len(components), 3, "Map: %s" % components)
self.assertTrue("c#[email protected]" in components)
self.assertTrue("Rc" in components["c#[email protected]"].actions)
self.assertEquals(components["c#[email protected]"].actions["Rc"], "Action for c")
self.assertEquals(len(components["c#[email protected]"].actions), 1)
self.assertEquals(len(depgraph.dag.node_attributes("c#[email protected]")), 1)
开发者ID:af-bull,项目名称:sequencer,代码行数:42,代码来源:testmodel_depgraph.py
示例20: graphrules
def graphrules(db, config, args):
"""
This action fetch the rules from the DB sequencer table and call
the DGM stage for the computation of the related graph.
This graph is then given to the user in the DOT format.
"""
usage = "Usage: %prog [global_options] " + GRAPHRULES_ACTION_NAME + \
" [action_options] ruleset"
doc = GRAPHRULES_DOC + \
" The graph is given in DOT format."
parser = optparse.OptionParser(usage, description=doc)
add_options_to(parser, ['--out'], config)
(options, action_args) = parser.parse_args(args)
if len(action_args) != 1:
parser.error(GRAPHRULES_ACTION_NAME + ": ruleSet is missing.")
req_ruleset = action_args[0]
rules = db.get_rules_for(req_ruleset)
ruleset = RuleSet(rules.values())
write_graph_to(ruleset.get_rules_graph(), options.out)
开发者ID:af-bull,项目名称:sequencer,代码行数:20,代码来源:cli.py
注:本文中的sequencer.dgm.model.RuleSet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论