Exemplo n.º 1
0
    def test_scale_system(self):
        scale = ScaleSystem(FixedScale(resolution=1.0),
                            FixedScale(resolution=2.5),
                            FixedScale(resolution=5.0),
                            FixedScale(resolution=10.0),
                            FixedScale(resolution=20.0),
                            FixedScale(resolution=100.0))

        test_intervals = (
            (1, 100, 200),
            (1, 100, 80),
            (1, 100, 40),
            (1, 100, 20),
            (1, 100, 5),
            (1, 10, 100),
            (1, 10, 50),
            (1, 10, 20),
        )
        print
        for start, end, width in test_intervals:
            labels = scale.labels(start, end, char_width=width)
            print "(%d,%d)" % (start, end), " avail:", width,
            print " used:", sum([len(x[1]) for x in labels]),
            print zip(*labels)[1]
        return
Exemplo n.º 2
0
    def test_width_based_default_scale(self):
        scale = ScaleSystem()

        test_intervals = ((1, 100, 80),
                          (1, 100, 40),
                          (1, 100, 20),)
        print
        for start, end, width in test_intervals:
            labels = scale.labels(start, end, char_width=width)
            print "(%d,%d)" % (start,end), " avail:", width,
            print " used:", sum([len(x[1]) for x in labels])
        return
Exemplo n.º 3
0
    def test_width_based_default_scale(self):
        scale = ScaleSystem()

        test_intervals = ((1, 100, 80),
                          (1, 100, 40),
                          (1, 100, 20),)
        print
        for start, end, width in test_intervals:
            labels = scale.labels(start, end, char_width=width)
            print "(%d,%d)" % (start,end), " avail:", width,
            print " used:", sum([len(x[1]) for x in labels])
        return
Exemplo n.º 4
0
    def test_labels(self):
        fmt = TimeFormatter()
        scale = ScaleSystem(*HMSScales)

        test_intervals = ([(2005,3,15,10,30), (2005,3,15,10,50), 150],
                          )
        print
        for start, end, width in test_intervals:
            labels = scale.labels(DTS(*start), DTS(*end), char_width=width)
            print start, end, " avail:", width,
            print " used:", sum([len(x[1]) for x in labels]),
            print labels
        return
Exemplo n.º 5
0
    def test_scale_system(self):
        scale = ScaleSystem(FixedScale(resolution = 1.0),
                            FixedScale(resolution = 2.5),
                            FixedScale(resolution = 5.0),
                            FixedScale(resolution = 10.0),
                            FixedScale(resolution = 20.0),
                            FixedScale(resolution = 100.0))

        test_intervals = ((1,100,200),
                          (1, 100, 80),
                          (1, 100, 40),
                          (1, 100, 20),
                          (1, 100, 5),
                          (1, 10, 100),
                          (1, 10, 50),
                          (1, 10, 20),)
        print
        for start, end, width in test_intervals:
            labels = scale.labels(start, end, char_width=width)
            print "(%d,%d)" % (start,end), " avail:", width,
            print " used:", sum([len(x[1]) for x in labels]),
            print list(zip(*labels))[1]
        return