本文整理汇总了Python中admit.AT.AT._baseDir方法的典型用法代码示例。如果您正苦于以下问题:Python AT._baseDir方法的具体用法?Python AT._baseDir怎么用?Python AT._baseDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类admit.AT.AT
的用法示例。
在下文中一共展示了AT._baseDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_FM_add_remove
# 需要导入模块: from admit.AT import AT [as 别名]
# 或者: from admit.AT.AT import _baseDir [as 别名]
def test_FM_add_remove(self):
""" test FM add() and remove() """
fm = admit.Flow()
# connection map diagram: a0->a1->a2->a3
# structure of an element of the triple-nested dictionary of connmap:
# src_taskid: {des_taskid: {des_bdpport: (si,sp, di,dp)}}
self.correct_connmap = {0: {1: {0: (0, 0, 1, 0)}},
1: {2: {0: (1, 0, 2, 0)}},
2: {3: {0: (2, 0, 3, 0)}}}
tasklist= list()
for i in range(0,4):
a = AT()
a._baseDir = admit.Project.baseDir
# Each AT needs an output BDP
b = File_BDP();
b.type="TEST_BDP%d" % i
a._bdp_out.append( b )
tasklist.append( a )
if i == 0:
taskid = fm.add( tasklist[i] )
else:
taskid = fm.add( tasklist[i], [(tasklist[i-1]._taskid,0)])
self.assertEqual(fm._connmap, self.correct_connmap)
# Remove a2 and its downstream from a0->a1->a2->a3
# The result diagram is a0->a1
self.correct_connmap = {0: {1: {0: (0, 0, 1, 0)}}}
fm.remove(2)
self.assertEqual(fm._connmap, self.correct_connmap)
示例2: test_flow
# 需要导入模块: from admit.AT import AT [as 别名]
# 或者: from admit.AT.AT import _baseDir [as 别名]
def test_flow(self):
# Test insertion of tasks (FM method: add(at, stuples, dtuples))
if (self.verbose) : print "\n------- Test Insertion ------------"
# connection map diagram: a0->a1->a2->a3
# structure of an element of the triple-nested dictionary of connmap:
# src_taskid: {des_taskid: {des_bdpport: (si,sp, di,dp)}}
self.correct_connmap = {0: {1: {0: (0, 0, 1, 0)}},
1: {2: {0: (1, 0, 2, 0)}},
2: {3: {0: (2, 0, 3, 0)}}}
for i in range(0,4):
name = "TEST_AT%d" % i;
if (self.verbose) : print "inserting task %s " % name
a = AT()
a._baseDir = admit.Project.baseDir
# Each AT needs an output BDP
b = BDP();
b.type="TEST_BDP%d" % i
a._bdp_out.append( b )
self.task.append( a )
if i == 0:
taskid = self.fm.add( self.task[i] )
else:
taskid = self.fm.add( self.task[i], [(self.task[i-1]._taskid,0)])
if (self.verbose) : self.fm.show()
self.assertEqual(self.fm._connmap, self.correct_connmap)
if (self.verbose) : print "-------- End of Test Insertion ------------"
# Print the 4-tuples of the connection map
if (self.verbose) : print "\n------- Print Connection Map ------------"
cm = self.fm._connmap
if (self.verbose) : print cm
for si in cm.keys():
for di in cm[si].keys():
for dp in cm[si][di].keys():
if (self.verbose) : print cm[si][di][dp]
if (self.verbose) : print "-------- End of Print ConnMap ------------"
# Remove a2 and its downstream from a0->a1->a2->a3
# The result diagram is a0->a1
if (self.verbose) : print "\n------- Test Remove ------------"
self.correct_connmap = {0: {1: {0: (0, 0, 1, 0)}}}
self.fm.remove(2)
if (self.verbose): self.fm.show()
self.assertEqual(self.fm._connmap, self.correct_connmap)
if (self.verbose) : print "-------- End of Test Remove ------------"