本文整理汇总了Python中lofarpipe.support.data_map.DataMap.iterator方法的典型用法代码示例。如果您正苦于以下问题:Python DataMap.iterator方法的具体用法?Python DataMap.iterator怎么用?Python DataMap.iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lofarpipe.support.data_map.DataMap
的用法示例。
在下文中一共展示了DataMap.iterator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_tuple_iterator
# 需要导入模块: from lofarpipe.support.data_map import DataMap [as 别名]
# 或者: from lofarpipe.support.data_map.DataMap import iterator [as 别名]
def test_tuple_iterator(self):
data_map = DataMap(self.new_style_map)
data_map.iterator = DataMap.TupleIterator
tuples = [item for item in data_map]
self.assertEqual(len(tuples), 4)
self.assertTrue(all(isinstance(item, tuple) for item in tuples))
self.assertTrue(all(len(item) == 2 for item in tuples))
self.assertEqual(tuples[0], ('locus001', 'L12345_SB101.MS'))
示例2: test_skip_iterator
# 需要导入模块: from lofarpipe.support.data_map import DataMap [as 别名]
# 或者: from lofarpipe.support.data_map.DataMap import iterator [as 别名]
def test_skip_iterator(self):
data_map = DataMap(self.new_style_map)
data_map.iterator = DataMap.SkipIterator
unskipped = [item for item in data_map]
self.assertEqual(len(unskipped), 2)
self.assertTrue(all(isinstance(item, DataProduct) for item in unskipped))
self.assertEqual(unskipped[0].host, 'locus002')
self.assertEqual(unskipped[0].file, 'L12345_SB102.MS')
示例3: test_append_item_non_skip
# 需要导入模块: from lofarpipe.support.data_map import DataMap [as 别名]
# 或者: from lofarpipe.support.data_map.DataMap import iterator [as 别名]
def test_append_item_non_skip(self):
data_map = DataMap(self.new_style_map)
data_map.append(("host","file", False))
data_map.iterator = DataMap.TupleIterator
tuples = [item for item in data_map]
self.assertEqual(len(tuples), 5)
self.assertTrue(all(isinstance(item, tuple) for item in tuples))
self.assertTrue(all(len(item) == 2 for item in tuples))
self.assertEqual(tuples[-1], ('host', 'file'))
示例4: test_append_item_skip
# 需要导入模块: from lofarpipe.support.data_map import DataMap [as 别名]
# 或者: from lofarpipe.support.data_map.DataMap import iterator [as 别名]
def test_append_item_skip(self):
data_map = DataMap(self.new_style_map)
data_map.append(("host","file", True))
data_map.iterator = DataMap.SkipIterator
dataProducts = [item for item in data_map]
# default contains 2 nonskipped items
self.assertEqual(len(dataProducts), 2)
self.assertTrue(all(isinstance(item, DataProduct)
for item in dataProducts))
# The map already contains 2 skipped items, the final item is tested
# here
self.assertEqual(dataProducts[-1].host, 'locus004')
self.assertEqual(dataProducts[-1].file, 'L12345_SB104.MS')