def test_31(self): """TestTrackGenLines.test_31(): genLog10Decade1Start2() line spacing.""" pS = [(s.width, p) for s, p in Track.genLog10Decade1Start2(0.0, 100.0)] # print() # pprint.pprint(pS) self.assertEqual(10, len(pS)) expRes = [ # Starting at 1 # (0.75, 0.0), # (0.25, 30.10299956639812), # (0.25, 47.712125471966246), # (0.25, 60.20599913279624), # (0.25, 69.89700043360189), # (0.25, 77.81512503836436), # (0.25, 84.50980400142568), # (0.25, 90.30899869919435), # (0.25, 95.42425094393249), # (0.75, 100.0), # Startign at 2 (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.75, 100.0), ] # self.assertEqual(expRes, pS) for (el, ep), (al, ap) in zip(expRes, pS): self.assertAlmostEqual(el, al) self.assertAlmostEqual(ep, ap)
def test_32(self): """TestTrackGenLines.test_32(): genLog10Decade1Start2() line spacing.""" pS = [math.pow(10,p/100) for s, p in Track.genLog10Decade1Start2(0.0, 100.0)] self.assertEqual(10, len(pS)) expResult = [float(n/2) for n in list(range(2,11,1)) +list(range(20,30,10)) ] # print() # pprint.pprint(expResult) # pprint.pprint(pS) for e,p in zip(expResult, pS): self.assertAlmostEqual(e, p)