def test_midpt_at_computed_location(self): midpoint_discrepancies = tc.midpt(self.trip1) for i, pt in enumerate(midpoint_discrepancies): if 0 < i < len(midpoint_discrepancies) - 1: self.assertNotEqual( pt, None, 'Failed at ' + str(i) + ' out of ' + str(len(midpoint_discrepancies))) self.assertAlmostEqual(pt, 0, msg='Failed at ' + str(i) + ' with mid point = ' + str(pt), delta=0.00001)
def test_midpt_1_deg_error_out_by_60coslat(self): midpoint_discrepancies = tc.midpt(self.trip2) self.assertAlmostEqual( midpoint_discrepancies[1], (2 * np.pi * 6371.0088) * math.cos(self.trip2.reps[1].lat() * np.pi / 180) / 360., delta=0.00001)
def test_first_and_last_are_missing(self): midpoint_discrepancies = tc.midpt(self.trip1) self.assertEqual(midpoint_discrepancies[0], None) self.assertEqual(midpoint_discrepancies[-1], None)