Exemplo n.º 1
0
    def reduce_to_range(self, loc, thr):
        """Removes all log entries that are farther 
		from the location by the threshold distance

		Args:
			loc (Location): location 
			thr (float): threshold distance (in km)
		"""
        tmp = dict(self.location_log)
        for idx, customer in tmp.items():
            dist = vincenty(customer, loc)
            if dist > thr:
                self.remove_customer(idx)
Exemplo n.º 2
0
 def test_illegal_steps(self, loc1, loc2, steps):
     with pytest.raises(Exception):
         assert vincenty(loc1, loc1, steps)
Exemplo n.º 3
0
 def test_default_steps(self, loc1, loc2, steps):
     assert vincenty(loc1, loc1, steps) == vincenty(loc1, loc1)
Exemplo n.º 4
0
 def test_accuracy(self, loc1, loc2):
     diff = abs(vincenty(loc1, loc2) - geopy_dist(loc1, loc2))
     assert diff <= 10**-4  # accuracy to 1 meter
Exemplo n.º 5
0
 def test_same(self, loc1, loc2):
     assert vincenty(loc1, loc1) == 0
     assert vincenty(loc2, loc2) == 0
Exemplo n.º 6
0
 def test_swapped(self, loc1, loc2):
     diff = abs(vincenty(loc1, loc2) - vincenty(loc2, loc1))
     assert diff < 10**-11  # accounting for possible rounting errors