本文整理汇总了Python中admit.AT.AT.set_bdp_in方法的典型用法代码示例。如果您正苦于以下问题:Python AT.set_bdp_in方法的具体用法?Python AT.set_bdp_in怎么用?Python AT.set_bdp_in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类admit.AT.AT
的用法示例。
在下文中一共展示了AT.set_bdp_in方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_AT_bdp
# 需要导入模块: from admit.AT import AT [as 别名]
# 或者: from admit.AT.AT import set_bdp_in [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)
示例2: test_bdp
# 需要导入模块: from admit.AT import AT [as 别名]
# 或者: from admit.AT.AT import set_bdp_in [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)