예제 #1
0
    def test_upload_gpx_creates_trackpoints(self):
        with self.settings(MEDIA_ROOT=self.temp_dir):
            test_file = SimpleUploadedFile('test1.gpx', GPX_BIN)
            assert len(ActivityTrackpoint.objects.all()) == 0

            ActivityTrack.create_new(
                upfile=test_file,
                activity=Activity.objects.create(user=UserFactory.create()))
            assert len(ActivityTrackpoint.objects.all()) == 5

            first = ActivityTrackpoint.objects.first()
            last = ActivityTrackpoint.objects.last()

            assert my_round(first.lat) == 43.078
            assert my_round(first.lon) == -89.384
            assert first.sog == 0.0
            assert first.timepoint.month == 3
            assert first.timepoint.day == 16
            assert first.timepoint.hour == 17
            assert first.timepoint.second == 56

            assert my_round(last.lat) == 43.074
            assert my_round(last.lon) == -89.380
            assert my_round(last.sog) == 2.847
            assert last.timepoint.month == 3
            assert last.timepoint.day == 16
            assert last.timepoint.hour == 17
            assert last.timepoint.second == 57
예제 #2
0
    def test_upload_sbn_creates_trackpoints(self):
        with self.settings(MEDIA_ROOT=self.temp_dir):
            test_file = SimpleUploadedFile('test1.sbn', SBN_BIN)
            assert 0 == len(ActivityTrackpoint.objects.all())

            ActivityTrack.create_new(
                upfile=test_file,
                activity=Activity.objects.create(user=UserFactory.create()))

            assert 4 == len(ActivityTrackpoint.objects.all())

            first = ActivityTrackpoint.objects.first()
            last = ActivityTrackpoint.objects.last()

            assert my_round(first.lat) == 43.087
            assert my_round(first.lon) == -89.389
            assert my_round(first.sog) == 3.11
            assert first.timepoint.month == 7
            assert first.timepoint.day == 15
            assert first.timepoint.hour == 22
            assert first.timepoint.second == 54
            assert my_round(last.lat) == 43.087
            assert my_round(last.lon) == -89.389
            assert my_round(last.sog) == 3.420
            assert last.timepoint.month == 7
            assert last.timepoint.day == 15
            assert last.timepoint.hour == 22
            assert last.timepoint.second == 57
예제 #3
0
 def test_get_bearing(self, stats):
     bearings = stats.bearing()
     assert 27 == len(bearings)
     assert 240.084 == my_round(bearings[0])
     assert 249.443 == my_round(bearings[26])
예제 #4
0
 def test_get_distance_equirect_method(self, stats):
     assert 59.125 == my_round(stats.distance(method='Equirect').magnitude)
예제 #5
0
 def test_get_distance_sphlawcos_method(self, stats):
     assert 59.114 == my_round(stats.distance(method='SphLawCos').magnitude)
예제 #6
0
 def test_get_distance_haversine_method(self, stats):
     assert 59.125 == my_round(stats.distance(method='Haversine').magnitude)