def test_18(self): """TestTrackGenLines.test_18(): genLog10Decade3() line spacing.""" pS = [math.pow(10,p/100) for s, p in Track.genLog10Decade3(0.0, 300.0)] self.assertEqual(28, len(pS)) expResult = [float(n) for n in list(range(1,11,1))+list(range(20,110,10))+list(range(200,1100,100))] # print() # pprint.pprint(expResult) # pprint.pprint(pS) for e,p in zip(expResult, pS): self.assertAlmostEqual(e, p)
def test_17(self): """TestTrackGenLines.test_17(): genLog10Decade3() line spacing.""" pS = [(s.width, p) for s, p in Track.genLog10Decade3(0.0, 300.0)] # print() # pprint.pprint(pS) self.assertEqual(28, len(pS)) expRes = [ (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), (0.25, 130.10299956639813), (0.25, 147.71212547196626), (0.25, 160.20599913279625), (0.25, 169.89700043360187), (0.25, 177.81512503836436), (0.25, 184.50980400142566), (0.25, 190.30899869919435), (0.25, 195.4242509439325), (0.75, 200.0), (0.25, 230.10299956639813), (0.25, 247.71212547196626), (0.25, 260.20599913279625), (0.25, 269.8970004336019), (0.25, 277.8151250383644), (0.25, 284.50980400142566), (0.25, 290.3089986991944), (0.25, 295.4242509439325), (0.75, 300.0), ] # self.assertEqual(expRes, pS) for (el, ep), (al, ap) in zip(expRes, pS): self.assertAlmostEqual(el, al) self.assertAlmostEqual(ep, ap)