def subtest(sa, d):
     pc = Pie()
     pc.direction = d
     pc.startAngle = sa
     arcs = _makeSideArcDefs(sa, d)
     A = [x[1] for x in pc.makeAngles()]
     arcsum = sum([a[2] - a[1] for a in arcs])
     isum = intSum(arcs, A)
     mi = max([a[2] - a[1] for a in arcs])
     ni = min([a[2] - a[1] for a in arcs])
     l = []
     s = arcsum - 360
     if s > 1e-8:
         l.append("Arc length=%s != 360" % s)
     s = abs(isum - 360)
     if s > 1e-8:
         l.append("interval intersection length=%s != 360" % s)
     if mi > 360:
         l.append("max interval intersection length=%s >360" % mi)
     if ni < 0:
         l.append("min interval intersection length=%s <0" % ni)
     if l:
         l.append("sa: %s d: %s" % (sa, d))
         l.append("sidearcs: %s" % str(arcs))
         l.append("Angles: %s" % A)
         raise ValueError("piecharts._makeSideArcDefs failure\n%s" % "\n".join(l))
Exemplo n.º 2
0
 def subtest(sa,d):
     pc = Pie()
     pc.direction=d
     pc.startAngle=sa
     arcs = _makeSideArcDefs(sa,d)
     A = [x[1] for x in pc.makeAngles()]
     arcsum = sum([a[2]-a[1] for a in arcs])
     isum = intSum(arcs,A)
     mi = max([a[2]-a[1] for a in arcs])
     ni = min([a[2]-a[1] for a in arcs])
     l = []
     s = (arcsum-360)
     if s>1e-8: l.append('Arc length=%s != 360' % s)
     s = abs(isum-360)
     if s>1e-8: l.append('interval intersection length=%s != 360' % s)
     if mi>360: l.append('max interval intersection length=%s >360' % mi)
     if ni<0: l.append('min interval intersection length=%s <0' % ni)
     if l:
         l.append('sa: %s d: %s' % (sa,d))
         l.append('sidearcs: %s' % str(arcs))
         l.append('Angles: %s' % A)
         raise ValueError('piecharts._makeSideArcDefs failure\n%s' % '\n'.join(l))