Mercurial Hosting > traffic-intelligence
diff python/tests/utils.txt @ 733:c35e4a4b199d dev
sortbylength
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 11 Aug 2015 12:06:10 -0400 |
parents | 9990ef119bce |
children | fe71639f1ee7 |
line wrap: on
line diff
--- a/python/tests/utils.txt Tue Aug 11 11:49:01 2015 -0400 +++ b/python/tests/utils.txt Tue Aug 11 12:06:10 2015 -0400 @@ -50,6 +50,13 @@ >>> mostCommon([range(2), range(4), range(2)]) [0, 1] +>>> res = sortByLength([range(3), range(4), range(1)]) +>>> [len(r) for r in res] +[1, 3, 4] +>>> res = sortByLength([range(3), range(4), range(1), range(5)], reverse = True) +>>> [len(r) for r in res] +[5, 4, 3, 1] + >>> lcss = LCSS(similarityFunc = lambda x,y: abs(x-y) <= 0.1) >>> lcss.compute(range(5), range(5)) 5