def test_33(self): """TestTrackGenLines.test_33(): genLog10Decade2Start2() line spacing.""" pS = [(s.width, p) for s, p in Track.genLog10Decade2Start2(0.0, 200.0)] # print() # pprint.pprint(pS) self.assertEqual(19, len(pS)) expRes = [ (0.75, 0.0), (0.25, 17.609125905568124), (0.25, 30.10299956639812), (0.25, 39.79400086720376), (0.25, 47.712125471966246), (0.25, 54.40680443502757), (0.25, 60.20599913279623), (0.25, 65.32125137753437), (0.75, 69.89700043360187), (0.25, 100.0), (0.25, 117.60912590556812), (0.25, 130.10299956639813), (0.25, 139.79400086720375), (0.25, 147.71212547196626), (0.25, 154.40680443502757), (0.25, 160.20599913279622), (0.25, 165.32125137753437), (0.75, 169.89700043360187), (0.75, 200.0), ] # self.assertEqual(expRes, pS) for (el, ep), (al, ap) in zip(expRes, pS): self.assertAlmostEqual(el, al) self.assertAlmostEqual(ep, ap)
def test_34(self): """TestTrackGenLines.test_34(): genLog10Decade2Start2() line spacing.""" pS = [math.pow(10,p/100) for s, p in Track.genLog10Decade2Start2(0.0, 200.0)] self.assertEqual(19, len(pS)) expResult = [float(n/2) for n in list(range(2,11,1)) +list(range(20,110,10)) +list(range(200,300,100)) ] # print() # pprint.pprint(expResult) # pprint.pprint(pS) for e,p in zip(expResult, pS): self.assertAlmostEqual(e, p)