def test_acceleration(self): self.assertAlmostEquals(6371 * 1000, self.earth_radius) basic_gravity = physics.acceleration(self.earth_radius, self.earth_mass) self.assertAlmostEquals(physics.GRAVITY, basic_gravity, places=1)
def test_gravities(self): basic_gravity = physics.acceleration(self.earth_radius, self.earth_mass) self.assertAlmostEquals(1.0, physics.gravities(basic_gravity), places=2)
def acceleration_vector(self, thing): delta_x = abs(self.vector[0] - thing.vector[0]) delta_y = abs(self.vector[1] - thing.vector[1]) distance = math.sqrt(pow(delta_x, 2) + pow(delta_y, 2)) force = physics.acceleration(distance, thing.mass)