--- trunk/thuban/test/test_classgen.py 2003/05/12 11:21:02 895 +++ trunk/thuban/test/test_classgen.py 2003/05/12 11:21:14 896 @@ -35,64 +35,65 @@ cq = cg.CalculateQuantiles result = cq([1, 2, 3, 4], [.25, .5, .75, 1.0], Range("[1;4]")) - eq(result, (0, [(0, .25), (1, .5), (2, .75), (3, 1.0)])) + eq(result, (0, 0, 3, [(0, .25), (1, .5), (2, .75), (3, 1.0)])) result = cq(range(0, 100), [.25, .5, .75, 1.0], Range("[0;100]")) - eq(result, (0, [(24, .25), (49, .5), (74, .75), (99, 1.0)])) + eq(result, (0, 0, 99, [(24, .25), (49, .5), (74, .75), (99, 1.0)])) result = cq(range(0, 100), [.33, .66, 1.0], Range("[0;100]")) - eq(result, (0, [(32, .33), (65, .66), (99, 1.0)])) + eq(result, (0, 0, 99, [(32, .33), (65, .66), (99, 1.0)])) # negative input result = cq(range(-100, 100), [.33, .66, 1.0], Range("[-100;100]")) - eq(result, (0, [(65, .33), (131, .66), (199, 1.0)])) + eq(result, (0, 0, 199, [(65, .33), (131, .66), (199, 1.0)])) # unequal percentiles result = cq(range(0, 100), [.25, .66, .8, 1.0], Range("[0;100]")) - eq(result, (0, [(24, .25), (65, .66), (79, .8), (99, 1.0)])) + eq(result, (0, 0, 99, [(24, .25), (65, .66), (79, .8), (99, 1.0)])) # input all the same result = cq([1, 1, 1, 1], [.25, .5, .75, 1.0], Range("[1;4]")) - eq(result, (0, [(3, 1.0)])) + eq(result, (1, 0, 3, [(3, 1.0)])) # empty input result = cq([], [.25, .5, .75, 1.0], Range("[1;4]")) - eq(result, (0, [])) + eq(result, None) # empty range result = cq([1, 2, 3, 4], [.25, .5, .75, 1.0], Range("]0;1[")) - eq(result, (0, [])) + eq(result, None) # empty percentiles result = cq([1, 2, 3, 4], [], Range("]0;1[")) - eq(result, (0, [])) + eq(result, None) # single percentile result = cq([1, 2, 3, 4], [.5], Range("[0;4]")) - eq(result, (0, [(1, .5)])) + eq(result, (0, 0, 3, [(1, .5)])) # more percentiles than input result = cq([1], [.5, 1.0], Range("[0;4]")) - eq(result, (1, [(0, 1.0)])) + eq(result, (1, 0, 0, [(0, 1.0)])) result = cq([1], [.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.0], Range("[0;4]")) - eq(result, (1, [(0, 1.0)])) + eq(result, (1, 0, 0, [(0, 1.0)])) # range smaller than the input result = cq([1, 2, 3, 4], [.5, 1.0], Range("[2;3]")) - eq(result, (0, [(1, .5), (2, 1.0)])) + eq(result, (0, 1, 2, [(1, .5), (2, 1.0)])) # range outside the input result = cq([5, 6, 7, 8], [.5, 1.0], Range("[2;3]")) - eq(result, (0, [])) + eq(result, None) result = cq([1, 1, 1, 1, 1, 1], [.25, .5, .75, 1.0], Range("[1;4]")) - eq(result, (1, [(5, 1.0)])) + eq(result, (1, 0, 5, [(5, 1.0)])) result = cq([1, 1, 1, 1, 1, 2, 3], [.25, .5, .75, 1.0], Range("[1;4]")) - eq(result, (1, [(4, 0.7142857142857143), # the algorithm generated - (5, 0.8571428571428571), # these values, but they are - (6, 1.0)])) # right. + eq(result, (1, 0, 6, + [(4, 0.7142857142857143), # the algorithm generated + (5, 0.8571428571428571), # these values, but they are + (6, 1.0)])) # right. # adjusted quantiles result = cq([1, 1, 1, 1, 1, @@ -101,7 +102,7 @@ 4, 4, 4, 4, 4, 5, 5, 5, 5, 5], [.12, .24, .36, .50, .62, .76, .88, 1.0], Range("[1;5]")) - eq(result, (1, [(4, .2), (9, .4), (14, .6), (19, .8), (24, 1.0)])) + eq(result, (1, 0, 24, [(4, .2), (9, .4), (14, .6), (19, .8), (24, 1.0)])) if __name__ == "__main__": unittest.main()