コード例 #1
0
 def test_query_distance_matrix_api_with_last_ride_bad_dropoff_loc(self):
     user = self._create_user()
     self._create_ride(user, 1, 0.0, 0.0, 37.272042, -76.714027, dropoff_time=datetime(2015, 6, 13, 1, 2, 3))
     pickup_loc = (37.280893, -76.719691)
     dropoff_loc = (0.0, 0.0)
     result = query_distance_matrix_api(pickup_loc, dropoff_loc)
     self.assertEquals(result, None)
コード例 #2
0
    def test_query_distance_matrix_api_with_last_ride(self):
        user = self._create_user()
        ride = self._create_ride(user,
                                 1,
                                 0.0,
                                 0.0,
                                 37.272042,
                                 -76.714027,
                                 dropoff_time=datetime(2015, 6, 13, 1, 2, 3))
        pickup_loc = (37.273485, -76.719628)
        dropoff_loc = (37.280893, -76.719691)
        expected_pickup_time = datetime(2015, 6, 13, 1, 2, 3) + timedelta(
            0, 373)
        expected_travel_time = 239
        expected_dropoff_time = expected_pickup_time + timedelta(
            0, expected_travel_time)
        result = query_distance_matrix_api(pickup_loc, dropoff_loc)

        (pickup_time, travel_time, dropoff_time) = result[0]
        self.assertEquals(pickup_time, expected_pickup_time)
        self.assertEquals(travel_time, expected_travel_time)
        self.assertEquals(dropoff_time, expected_dropoff_time)

        pickup_address, dropoff_address = result[1]
        self.assertEquals(pickup_address,
                          u'2006 Brooks Street, Williamsburg, VA 23185, USA')
        self.assertEquals(dropoff_address,
                          u'1234 Richmond Road, Williamsburg, VA 23185, USA')
コード例 #3
0
 def test_query_distance_matrix_api_with_last_ride_bad_dropoff_loc(self):
     user = self._create_user()
     self._create_ride(user,
                       1,
                       0.0,
                       0.0,
                       37.272042,
                       -76.714027,
                       dropoff_time=datetime(2015, 6, 13, 1, 2, 3))
     pickup_loc = (37.280893, -76.719691)
     dropoff_loc = (0.0, 0.0)
     result = query_distance_matrix_api(pickup_loc, dropoff_loc)
     self.assertEquals(result, None)
コード例 #4
0
    def test_query_distance_matrix_api_no_rides(self):
        pickup_loc = (37.273485, -76.719628)
        dropoff_loc = (37.280893, -76.719691)
        expected_pickup_time = datetime(2015, 6, 13, 1, 2, 3) + timedelta(0, 10 * 60)
        expected_dropoff_time = expected_pickup_time + timedelta(0, 239)
        result = query_distance_matrix_api(pickup_loc, dropoff_loc)

        (pickup_time, travel_time, dropoff_time) = result[0]
        self.assertEquals(pickup_time, expected_pickup_time)
        self.assertEquals(travel_time, 239)
        self.assertEquals(dropoff_time, expected_dropoff_time)

        pickup_address, dropoff_address = result[1]
        self.assertEquals(pickup_address, u"2006 Brooks Street, Williamsburg, VA 23185, USA")
        self.assertEquals(dropoff_address, u"1234 Richmond Road, Williamsburg, VA 23185, USA")
コード例 #5
0
    def test_query_distance_matrix_api_no_rides(self):
        pickup_loc = (37.273485, -76.719628)
        dropoff_loc = (37.280893, -76.719691)
        expected_pickup_time = datetime(2015, 6, 13, 1, 2, 3) + timedelta(
            0, 10 * 60)
        expected_dropoff_time = expected_pickup_time + timedelta(0, 239)
        result = query_distance_matrix_api(pickup_loc, dropoff_loc)

        (pickup_time, travel_time, dropoff_time) = result[0]
        self.assertEquals(pickup_time, expected_pickup_time)
        self.assertEquals(travel_time, 239)
        self.assertEquals(dropoff_time, expected_dropoff_time)

        pickup_address, dropoff_address = result[1]
        self.assertEquals(pickup_address,
                          u'2006 Brooks Street, Williamsburg, VA 23185, USA')
        self.assertEquals(dropoff_address,
                          u'1234 Richmond Road, Williamsburg, VA 23185, USA')
コード例 #6
0
    def test_query_distance_matrix_api_with_last_ride(self):
        user = self._create_user()
        ride = self._create_ride(user, 1, 0.0, 0.0, 37.272042, -76.714027, dropoff_time=datetime(2015, 6, 13, 1, 2, 3))
        pickup_loc = (37.273485, -76.719628)
        dropoff_loc = (37.280893, -76.719691)
        expected_pickup_time = datetime(2015, 6, 13, 1, 2, 3) + timedelta(0, 373)
        expected_travel_time = 239
        expected_dropoff_time = expected_pickup_time + timedelta(0, expected_travel_time)
        result = query_distance_matrix_api(pickup_loc, dropoff_loc)

        (pickup_time, travel_time, dropoff_time) = result[0]
        self.assertEquals(pickup_time, expected_pickup_time)
        self.assertEquals(travel_time, expected_travel_time)
        self.assertEquals(dropoff_time, expected_dropoff_time)

        pickup_address, dropoff_address = result[1]
        self.assertEquals(pickup_address, u"2006 Brooks Street, Williamsburg, VA 23185, USA")
        self.assertEquals(dropoff_address, u"1234 Richmond Road, Williamsburg, VA 23185, USA")
コード例 #7
0
 def test_query_distance_matrix_api_no_rides_bad_dest_loc(self):
     pickup_loc = (37.280893, -76.719691)
     dropoff_loc = (0.0, 0.0)
     result = query_distance_matrix_api(pickup_loc, dropoff_loc)
     self.assertEquals(result, None)
コード例 #8
0
 def test_query_distance_matrix_api_no_rides_bad_dest_loc(self):
     pickup_loc = (37.280893, -76.719691)
     dropoff_loc = (0.0, 0.0)
     result = query_distance_matrix_api(pickup_loc, dropoff_loc)
     self.assertEquals(result, None)