def test_unpackList(self): lists = [ [1, 2, 3, 4], [1, 2, 3], [1, 2], [1] ] rst = util.unpackList(lists) self.assertEqual(len(rst), 10)
def run(classify): def applyRule(rule): def mapClass(className): return list(map(rule, classify[className])) return list(map(mapClass, classify)) return list(map(applyRule ,unpackList(rules)))