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


Python AT.addoutput方法代码示例

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


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

示例1: test_AT_bdp

# 需要导入模块: from admit.AT import AT [as 别名]
# 或者: from admit.AT.AT import addoutput [as 别名]
    def test_AT_bdp(self):
        """ test AT bdp methods """
        at = AT({'alias': 'w'})
        self.project.addtask(at)

        # input bdp
        at.set_bdp_in([(BDP,1, bt.REQUIRED)])
        self.assertEqual(len(at._bdp_in), 1)
 
        at.clearinput()
        self.assertIsNone(at._bdp_in[0])
 
        at.addinput(BDP())
        self.assertIsNotNone(at._bdp_in[0])
         
        # output bdp
        at.set_bdp_out([(BDP,1)])
        self.assertEqual(len(at._bdp_out), 1)
 
        # test clearoutput
        at.clearoutput()
        self.assertIsNone(at._bdp_out[0])

        output1 = BDP()
        at.addoutput(output1)
        isIn = output1 in at   # call __contains__
        self.assertTrue(isIn)

        output2 = File_BDP({'file': 'test.file'})
        at[0] = output2   # call __setitem__
        isIn = output2 in at   # call __contains__ again
        self.assertTrue(isIn)

        # test __iter__
        counter = 0
        for b in at._bdp_out:
            counter += 1
        self.assertEqual(counter, 1)

        item1 = at[0]  # call __getitem__ at index = 0
        self.assertIsInstance(item1, admit.File_BDP)
开发者ID:radio-astro,项目名称:casa,代码行数:43,代码来源:test_admit.py

示例2: test_bdp

# 需要导入模块: from admit.AT import AT [as 别名]
# 或者: from admit.AT.AT import addoutput [as 别名]
    def test_bdp(self):
        at = AT({'alias': 'w'})
        self.project.addtask(at)

        # input bdp
        at.set_bdp_in([(BDP,1, bt.REQUIRED)])
        bdpin = len(at._bdp_in)
        if(self.verbose):
            print "\nAT Class number of BDP input:", bdpin

        self.assertEqual(bdpin, 1)  ## should have one input bdp
 
        at.clearinput()
        bdpin = at._bdp_in[0]
        if(self.verbose):
            print "\nAT Class BDP input:", bdpin
 
        self.assertEqual(bdpin, None)
 
        at.addinput(BDP())
        bdpin= at._bdp_in[0]
         
        self.assertFalse(bdpin is None)
 
        # output bdp
        at.set_bdp_out([(BDP,1)])  # set_bdp_out
        bdpout = len(at._bdp_out)
        if(self.verbose):
            print "\nAT Class number of BDP output:", bdpout
 
        self.assertEqual(bdpout, 1)  ## should have one output bdp

        # test clearoutput
        at.clearoutput()
        bdpout = at._bdp_out[0]
        if(self.verbose):
            print "\nAT Class BDP output:", bdpout
 
        self.assertEqual(bdpout, None)

        output1 = BDP()
        at.addoutput(output1)

        isIn = output1 in at   # call __contains__
        self.assertTrue(isIn)

        #at.set_bdp_out([(File_BDP,2)])
        output2 = File_BDP({'file': 'test.file'})

        at[0] = output2   # call __setitem__

        isIn = output2 in at   # call __contains__ again
        self.assertTrue(isIn)

        # test __iter__
        counter = 0
        for b in at._bdp_out:
            counter += 1
            if(self.verbose):
                print "Output BDP:", b

        self.assertEqual(counter, 1)

        item1 = at[0]  # call __getitem__ at index = 0
        type = isinstance(item1, admit.File_BDP)
        self.assertTrue(type)
开发者ID:teuben,项目名称:admit,代码行数:68,代码来源:unittest_AT.py


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