def testSimple(self): p1 = Planet(5.0, 0.0, 0.1) self.assertAlmostEqual(p1.rho(), 5.0) self.assertAlmostEqual(p1.theta(), 0.0) p1.tick() self.assertAlmostEqual(p1.rho(), 5.0) self.assertAlmostEqual(p1.theta(), 0.1)
class PlanetTest(unittest.TestCase): def setUp(self): self.p1 = Planet(5.0, 0.0, 0.1) def testInitial(self): self.assertAlmostEqual(self.p1.rho(), 5.0) self.assertAlmostEqual(self.p1.theta(), 0.0) def testOneMove(self): self.p1.tick() self.assertAlmostEqual(self.p1.rho(), 5.0) self.assertAlmostEqual(self.p1.theta(), 0.1)