• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tools.add_action函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.ism.tools.add_action函数的典型用法代码示例。如果您正苦于以下问题:Python add_action函数的具体用法?Python add_action怎么用?Python add_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_seq_a_b_n_actions

    def test_seq_a_b_n_actions(self):
        depgraph = digraph()
        na = random.randint(5, 10)
        actions = []
        for i in range(0, na):
            actions.append(("Rule"+str(i), "Cmd"+str(i)))

        add_action(depgraph, "a#ta", actions)

        nb = random.randint(5, 10)
        actions = []
        for i in range(0, nb):
            actions.append(("Rule"+str(i), "Cmd"+str(i)))

        add_action(depgraph, "b#tb", actions)
        depgraph.add_edge(("a#ta", "b#tb"))

        (ise_model, xml, error) = self.order(depgraph)
        self.assertActionsNb(ise_model, na+nb)
        instructions = ise_model.instructions
        self.assertNotEquals(instructions, None)
        self.assertEquals(len(instructions), 1)
        seq = instructions.pop()
        actions = self.assertSequence(seq, na+nb)
        for i in range(0, nb):
            self.assertAction(actions[i], id="b#tb/Rule"+str(i),
                              cs="b#tb", cmd="Cmd"+str(i))

        for i in range(0, na):
            self.assertAction(actions[nb+i], id="a#ta/Rule"+str(i),
                              cs="a#ta", cmd="Cmd"+str(i))
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:31,代码来源:testoptimalalgo.py


示例2: test_par_a_b_n_actions

    def test_par_a_b_n_actions(self):
        depgraph = digraph()
        na = random.randint(5, 10)
        actions = []
        for i in range(0, na):
            actions.append(("Rule"+str(i), "Cmd"+str(i)))

        add_action(depgraph, "a#ta", actions)

        nb = random.randint(5, 10)
        actions = []
        for i in range(0, nb):
            actions.append(("Rule"+str(i), "Cmd"+str(i)))

        add_action(depgraph, "b#tb", actions)
        (ise_model, xml, error) = self.order(depgraph)
        self.assertActionsNb(ise_model, na+nb)
        instructions = ise_model.instructions
        self.assertNotEquals(instructions, None)
        self.assertEquals(len(instructions), 1)
        par = instructions.pop()
        seqs = self.assertParallel(par, 2)
        seqa = self.assertSequence(seqs[0], na)
        for i in range(0, na):
            self.assertAction(seqa[i], id="a#ta/Rule"+str(i),
                              cs="a#ta", cmd="Cmd"+str(i))

        seqb = self.assertSequence(seqs[1], nb)

        for i in range(0, nb):
            self.assertAction(seqb[i], id="b#tb/Rule"+str(i),
                              cs="b#tb", cmd="Cmd"+str(i))
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:32,代码来源:testoptimalalgo.py


示例3: test_single_one_action

 def test_single_one_action(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta", [("Rule1", "cmd1")])
     print("Graph: %s" % depgraph.nodes())
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, 1)
     instructions = ise_model.instructions
     self.assertNotEquals(instructions, None)
     self.assertEquals(len(instructions), 1)
     a = instructions[0]
     self.assertAction(a, id="a#ta/Rule1", cs="a#ta", cmd="cmd1")
开发者ID:pv-bull,项目名称:sequencer,代码行数:11,代码来源:abstracttest.py


示例4: test_nop2many

 def test_nop2many(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta", [("Rule1", "cmd1")])
     add_action(depgraph, "b#tb", [("Rule2", "cmd2")])
     depgraph.add_node("nop#t")
     depgraph.add_edge(('nop#t', 'a#ta'))
     depgraph.add_edge(('nop#t', 'b#tb'))
     print("Graph: %s" % depgraph.nodes())
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, 2)
     self.assertTrue("a#ta/Rule1" in ise_model.actions)
     self.assertTrue("b#tb/Rule2" in ise_model.actions)
开发者ID:pv-bull,项目名称:sequencer,代码行数:12,代码来源:abstracttest.py


示例5: test_par_a_b_single_action

 def test_par_a_b_single_action(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta")
     add_action(depgraph, "b#tb")
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, nb=2)
     instructions = ise_model.instructions
     self.assertNotEquals(instructions, None)
     self.assertEquals(len(instructions), 1)
     par = instructions.pop()
     actions = self.assertParallel(par, nb=2)
     self.assertAction(actions[0], id="a#ta/Rule", cs="a#ta", cmd="Cmd")
     self.assertAction(actions[1], id="b#tb/Rule", cs="b#tb", cmd="Cmd")
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:13,代码来源:testoptimalalgo.py


示例6: test_nop_a

 def test_nop_a(self):
     depgraph = digraph()
     depgraph.add_node("nop#t")
     add_action(depgraph, "a#ta", [("Rule1", "cmd1")])
     depgraph.add_edge(('nop#t', 'a#ta'))
     print("Graph: %s" % depgraph.nodes())
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, 1)
     instructions = ise_model.instructions
     self.assertNotEquals(instructions, None)
     self.assertEquals(len(instructions), 1)
     a = instructions[0]
     self.assertAction(a, id="a#ta/Rule1", cs="a#ta", cmd="cmd1")
开发者ID:pv-bull,项目名称:sequencer,代码行数:13,代码来源:abstracttest.py


示例7: test_a_nop_b

 def test_a_nop_b(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta", [("Rule1", "cmd1")])
     add_action(depgraph, "b#tb", [("Rule2", "cmd2")])
     depgraph.add_node("nop#t")
     depgraph.add_edge(('a#ta', 'nop#t'))
     depgraph.add_edge(('nop#t', 'b#tb'))
     print("Graph: %s" % depgraph.nodes())
     (ise_model, xml, error) = self.order(depgraph)
     print("Tranformed Graph: %s" % ise_model.dag.nodes())
     self.assertActionsNb(ise_model, 2)
     self.assertTrue("a#ta/Rule1" in ise_model.actions)
     self.assertTrue("b#tb/Rule2" in ise_model.actions)
     self.assertTrue(self._pathExist(ise_model.dag, 'a#ta/Rule1', 'b#tb/Rule2'))
开发者ID:pv-bull,项目名称:sequencer,代码行数:14,代码来源:abstracttest.py


示例8: test_a_b_c_d_square

 def test_a_b_c_d_square(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta")
     add_action(depgraph, "b#tb")
     add_action(depgraph, "c#tc")
     add_action(depgraph, "d#td")
     depgraph.add_edge(("a#ta", "b#tb"))
     depgraph.add_edge(("a#ta", "d#td"))
     depgraph.add_edge(("c#tc", "b#tb"))
     depgraph.add_edge(("c#tc", "d#td"))
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, 4)
     instructions = ise_model.instructions
     self.assertNotEquals(instructions, None)
     self.assertEquals(len(instructions), 1)
     seq = instructions.pop()
     instructions = self.assertSequence(seq, nb=2)
     par = instructions[0]
     actions = self.assertParallel(par, nb=2)
     self.assertContainsAction(actions, "b#tb/Rule")
     self.assertContainsAction(actions, "d#td/Rule")
     par = instructions[1]
     actions = self.assertParallel(par, nb=2)
     self.assertContainsAction(actions, "a#ta/Rule")
     self.assertContainsAction(actions, "c#tc/Rule")
开发者ID:pv-bull,项目名称:sequencer,代码行数:25,代码来源:testmixedalgo.py


示例9: test_a_b_c_d_square

 def test_a_b_c_d_square(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta")
     add_action(depgraph, "b#tb")
     add_action(depgraph, "c#tc")
     add_action(depgraph, "d#td")
     depgraph.add_edge(("a#ta", "b#tb"))
     depgraph.add_edge(("a#ta", "d#td"))
     depgraph.add_edge(("c#tc", "b#tb"))
     depgraph.add_edge(("c#tc", "d#td"))
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, 4)
     instructions = ise_model.instructions
     self.assertNotEquals(instructions, None)
     self.assertEquals(len(instructions), 1)
     par = instructions.pop()
     actions = self.assertParallel(par, nb=4)
     a = self.assertContainsAction(actions, "a#ta/Rule")
     b = self.assertContainsAction(actions, "b#tb/Rule")
     c = self.assertContainsAction(actions, "c#tc/Rule")
     d = self.assertContainsAction(actions, "d#td/Rule")
     self.assertAction(a, id="a#ta/Rule", deps=set(['b#tb/Rule', 'd#td/Rule']))
     self.assertAction(b, id="b#tb/Rule", deps=set())
     self.assertAction(c, id="c#tc/Rule", deps=set(['b#tb/Rule', 'd#td/Rule']))
     self.assertAction(d, id="d#td/Rule", deps=set())
开发者ID:pv-bull,项目名称:sequencer,代码行数:25,代码来源:testparalgo.py


示例10: test_seq_a_b_single_action

 def test_seq_a_b_single_action(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta")
     add_action(depgraph, "b#tb")
     depgraph.add_edge(("a#ta", "b#tb"))
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, nb=2)
     instructions = ise_model.instructions
     self.assertNotEquals(instructions, None)
     self.assertEquals(len(instructions), 1)
     seq = instructions.pop()
     actions = self.assertSequence(seq, nb=2)
     self.assertAction(actions[0], id="b#tb/Rule", cs="b#tb", cmd="Cmd")
     self.assertAction(actions[1], id="a#ta/Rule", cs="a#ta", cmd="Cmd")
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:14,代码来源:testoptimalalgo.py


示例11: test_single_n_actions

    def test_single_n_actions(self):
        depgraph = digraph()
        n = random.randint(5, 10)
        actions = []
        for i in range(0, n):
            actions.append(("Rule"+str(i), "Cmd"+str(i)))

        add_action(depgraph, "a#ta", actions)
        print("Graph: %s" % depgraph)
        (ise_model, xml, error) = self.order(depgraph)
        self.assertActionsNb(ise_model, n)
        instructions = ise_model.instructions
        self.assertNotEquals(instructions, None)
        self.assertEquals(len(instructions), 1)
        container = instructions.pop()
        actions = self.assertContainer(container, nb=n)
        for i in range(0, n):
            a = actions[i]
            self.assertAction(a, id="a#ta/Rule"+str(i),
                              cs="a#ta", cmd="Cmd"+str(i))
开发者ID:pv-bull,项目名称:sequencer,代码行数:20,代码来源:abstracttest.py


示例12: test_many2nop2many

 def test_many2nop2many(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta", [("Rule1", "cmd1")])
     add_action(depgraph, "b#tb", [("Rule2", "cmd2")])
     depgraph.add_node("nop#t")
     add_action(depgraph, "c#tc", [("Rule3", "cmd3")])
     add_action(depgraph, "d#td", [("Rule4", "cmd4")])
     depgraph.add_edge(('a#ta', 'nop#t'))
     depgraph.add_edge(('b#tb', 'nop#t'))
     depgraph.add_edge(('nop#t', 'c#tc'))
     depgraph.add_edge(('nop#t', 'd#td'))
     print("Graph: %s" % depgraph.nodes())
     (ise_model, xml, error) = self.order(depgraph)
     print("Tranformed Graph: %s" % ise_model.dag.nodes())
     self.assertActionsNb(ise_model, 4)
     self.assertTrue("a#ta/Rule1" in ise_model.actions)
     self.assertTrue("b#tb/Rule2" in ise_model.actions)
     self.assertTrue("c#tc/Rule3" in ise_model.actions)
     self.assertTrue("d#td/Rule4" in ise_model.actions)
     self.assertTrue(self._pathExist(ise_model.dag, 'a#ta/Rule1', 'c#tc/Rule3'))
     self.assertTrue(self._pathExist(ise_model.dag, 'a#ta/Rule1', 'd#td/Rule4'))
     self.assertTrue(self._pathExist(ise_model.dag, 'b#tb/Rule2', 'c#tc/Rule3'))
     self.assertTrue(self._pathExist(ise_model.dag, 'b#tb/Rule2', 'd#td/Rule4'))
开发者ID:pv-bull,项目名称:sequencer,代码行数:23,代码来源:abstracttest.py


示例13: test_a_b_c_d_useless

 def test_a_b_c_d_useless(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta")
     add_action(depgraph, "b#tb")
     add_action(depgraph, "c#tc")
     add_action(depgraph, "d#td")
     depgraph.add_edge(("a#ta", "b#tb"))
     depgraph.add_edge(("b#tb", "c#tc"))
     depgraph.add_edge(("b#tb", "d#td"))
     depgraph.add_edge(("a#ta", "c#tc"))
     depgraph.add_edge(("a#ta", "d#td"))
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, 4)
     instructions = ise_model.instructions
     self.assertNotEquals(instructions, None)
     self.assertEquals(len(instructions), 1)
     instructions = instructions.pop()
     seq = self.assertSequence(instructions, nb=3)
     par = self.assertParallel(seq[0], nb=2)
     self.assertAction(par[0], id="c#tc/Rule", deps=set())
     self.assertAction(par[1], id="d#td/Rule", deps=set())
     self.assertAction(seq[1], id="b#tb/Rule", deps=set())
     self.assertAction(seq[2], id="a#ta/Rule", deps=set())
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:23,代码来源:testoptimalalgo.py


示例14: test_a_dep_b_c

 def test_a_dep_b_c(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta")
     add_action(depgraph, "b#tb")
     add_action(depgraph, "c#tc")
     depgraph.add_edge(("a#ta", "b#tb"))
     depgraph.add_edge(("a#ta", "c#tc"))
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, 3)
     instructions = ise_model.instructions
     self.assertNotEquals(instructions, None)
     self.assertEquals(len(instructions), 1)
     par = instructions.pop()
     actions = self.assertParallel(par, nb=3)
     self.assertContainsAction(actions, "a#ta/Rule")
     self.assertContainsAction(actions, "b#tb/Rule")
     self.assertContainsAction(actions, "c#tc/Rule")
开发者ID:pv-bull,项目名称:sequencer,代码行数:17,代码来源:testparalgo.py


示例15: test_a_b_dep_c

 def test_a_b_dep_c(self):
     depgraph = digraph()
     add_action(depgraph, "a#ta")
     add_action(depgraph, "b#tb")
     add_action(depgraph, "c#tc")
     depgraph.add_edge(("a#ta", "c#tc"))
     depgraph.add_edge(("b#tb", "c#tc"))
     (ise_model, xml, error) = self.order(depgraph)
     self.assertActionsNb(ise_model, 3)
     instructions = ise_model.instructions
     self.assertNotEquals(instructions, None)
     self.assertEquals(len(instructions), 1)
     par = instructions.pop()
     instructions = self.assertParallel(par, nb=2)
     seq = self.assertSequence(instructions[0], nb=2)
     self.assertAction(seq[0], id="c#tc/Rule")
     self.assertAction(seq[1], id="a#ta/Rule")
     self.assertAction(instructions[1], id="b#tb/Rule")
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:18,代码来源:testoptimalalgo.py


示例16: test_complex_case_a_b_c_f_e_d_diamond

    def test_complex_case_a_b_c_f_e_d_diamond(self):
        depgraph = digraph()
        add_action(depgraph, "a#ta")
        add_action(depgraph, "b#tb")
        add_action(depgraph, "c#tc")
        add_action(depgraph, "d#td")
        add_action(depgraph, "e#te")
        add_action(depgraph, "f#tf")


        depgraph.add_edge(("a#ta", "b#tb"))
        depgraph.add_edge(("a#ta", "c#tc"))

        depgraph.add_edge(("d#td", "e#te"))
        depgraph.add_edge(("d#td", "f#tf"))

        depgraph.add_edge(("f#tf", "b#tb"))
        depgraph.add_edge(("c#tc", "e#te"))

        (ise_model, xml, error) = self.order(depgraph)
        self.assertActionsNb(ise_model, 6)
        instructions = ise_model.instructions
        self.assertNotEquals(instructions, None)
        self.assertEquals(len(instructions), 1)
        par = instructions.pop()
        actions = self.assertParallel(par, nb=6)

        a = self.assertContainsAction(actions, "a#ta/Rule")
        b = self.assertContainsAction(actions, "b#tb/Rule")
        c = self.assertContainsAction(actions, "c#tc/Rule")
        d = self.assertContainsAction(actions, "d#td/Rule")
        e = self.assertContainsAction(actions, "e#te/Rule")
        f = self.assertContainsAction(actions, "f#tf/Rule")

        self.assertAction(a, "a#ta/Rule", deps=set(['b#tb/Rule', 'c#tc/Rule']))
        self.assertAction(b, "b#tb/Rule", deps=set())
        self.assertAction(c, "c#tc/Rule", deps=set(['e#te/Rule']))
        self.assertAction(d, "d#td/Rule", deps=set(['e#te/Rule', 'f#tf/Rule']))
        self.assertAction(e, "e#te/Rule", deps=set())
        self.assertAction(f, "f#tf/Rule", deps=set(['b#tb/Rule']))
开发者ID:pv-bull,项目名称:sequencer,代码行数:40,代码来源:testparalgo.py


示例17: test_complex_case_a_b_c_f_e_d_diamond

    def test_complex_case_a_b_c_f_e_d_diamond(self):
        depgraph = digraph()
        add_action(depgraph, "a#ta")
        add_action(depgraph, "b#tb")
        add_action(depgraph, "c#tc")
        add_action(depgraph, "d#td")
        add_action(depgraph, "e#te")
        add_action(depgraph, "f#tf")


        depgraph.add_edge(("a#ta", "b#tb"))
        depgraph.add_edge(("a#ta", "c#tc"))

        depgraph.add_edge(("d#td", "e#te"))
        depgraph.add_edge(("d#td", "f#tf"))

        depgraph.add_edge(("f#tf", "b#tb"))
        depgraph.add_edge(("c#tc", "e#te"))

        (ise_model, xml, error) = self.order(depgraph)
        self.assertActionsNb(ise_model, 6)
        instructions = ise_model.instructions
        self.assertNotEquals(instructions, None)
        self.assertEquals(len(instructions), 1)
        par = instructions.pop()
        instructions = self.assertParallel(par, nb=2)
        seqs_ebfd = self.assertSequence(instructions[0], nb=2)
        seqs_ca = self.assertSequence(instructions[1], nb=2)
        par_ebf = self.assertParallel(seqs_ebfd[0], nb=2)
        seq_bf = self.assertSequence(par_ebf[1], nb=2)
        self.assertAction(par_ebf[0], "e#te/Rule", deps=set())
        self.assertAction(seq_bf[0], "b#tb/Rule", deps=set())
        self.assertAction(seq_bf[1], "f#tf/Rule", deps=set())
        self.assertAction(seqs_ebfd[1], "d#td/Rule", deps=set())

        self.assertAction(seqs_ca[0], "c#tc/Rule", deps=set(['e#te/Rule']))
        self.assertAction(seqs_ca[1], "a#ta/Rule", deps=set(['b#tb/Rule']))
开发者ID:AdrienDebrie,项目名称:sequencer,代码行数:37,代码来源:testoptimalalgo.py


示例18: test_complex_case_a_b_c_f_e_d_diamond

    def test_complex_case_a_b_c_f_e_d_diamond(self):
        depgraph = digraph()
        add_action(depgraph, "a#ta")
        add_action(depgraph, "b#tb")
        add_action(depgraph, "c#tc")
        add_action(depgraph, "d#td")
        add_action(depgraph, "e#te")
        add_action(depgraph, "f#tf")


        depgraph.add_edge(("a#ta", "b#tb"))
        depgraph.add_edge(("a#ta", "c#tc"))

        depgraph.add_edge(("d#td", "e#te"))
        depgraph.add_edge(("d#td", "f#tf"))

        depgraph.add_edge(("f#tf", "b#tb"))
        depgraph.add_edge(("c#tc", "e#te"))

        (ise_model, xml, error) = self.order(depgraph)
        self.assertActionsNb(ise_model, 6)
        instructions = ise_model.instructions
        self.assertNotEquals(instructions, None)
        self.assertEquals(len(instructions), 1)
        seq = instructions.pop()
        instructions = self.assertSequence(seq, nb=3)
        par = instructions[0]
        actions = self.assertParallel(par, nb=2)
        self.assertContainsAction(actions, "b#tb/Rule")
        self.assertContainsAction(actions, "e#te/Rule")
        par = instructions[1]
        actions = self.assertParallel(par, nb=2)
        self.assertContainsAction(actions, "f#tf/Rule")
        self.assertContainsAction(actions, "c#tc/Rule")
        par = instructions[2]
        actions = self.assertParallel(par, nb=2)
        self.assertContainsAction(actions, "a#ta/Rule")
        self.assertContainsAction(actions, "d#td/Rule")
开发者ID:pv-bull,项目名称:sequencer,代码行数:38,代码来源:testmixedalgo.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python lib._change_test_package_version函数代码示例发布时间:2022-05-27
下一篇:
Python tools.getMockActionCmd函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap