How to use the classes.Location function in classes

To help you get started, we’ve selected a few classes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dgraziotin / dycapo / tests / test_multiple_matching.py View on Github external
def test_search_trip_driver_closest_to_destination(self):
        driver_position = '46.500730 11.345070'
        self.driver.location = classes.Location(georss_point=driver_position,point='posi')
        self.driver.update_position()

        response = self.rider1.search_ride(self.rider1.location,self.rider1.destination)
        assert response['code'] == response_codes.ALL_OK
        with py.test.raises(KeyError):
            assert response['trips'] == True
        self.driver.location = classes.Location(georss_point=self.driver_position)
        self.driver.update_position()
github dgraziotin / dycapo / tests / test_simple_matching.py View on Github external
def setup_method(self,method):
        self.driver.location = classes.Location(georss_point=self.driver_position)
        self.driver.destination = classes.Location(georss_point=self.driver_destination,point='dest')
        self.rider.location = classes.Location(georss_point=self.rider_position)
        self.rider.destination = classes.Location(georss_point=self.rider_destination,point='dest')
        self.rider2.location = classes.Location(georss_point=self.rider_position)
        self.rider2.destination = classes.Location(georss_point=self.rider_destination,point='dest')
github dgraziotin / dycapo / tests / test_driver.py View on Github external
def test_position(self):
        old_position = self.driver.location
        new_position = classes.Location(georss_point='46.000 11.000')
        self.driver.update_position(location=new_position)
        response = self.driver.get_position()
        assert response['value']['georss_point'] != old_position.georss_point
        assert response['value']['georss_point'] == new_position.georss_point
        self.driver.update_position(location=old_position)
        response = self.driver.get_position()
        assert response['value']['georss_point'] == old_position.georss_point
        assert response['value']['georss_point'] != new_position.georss_point
github dgraziotin / dycapo / tests / test_simple_matching.py View on Github external
def setup_method(self,method):
        self.driver.location = classes.Location(georss_point=self.driver_position)
        self.driver.destination = classes.Location(georss_point=self.driver_destination,point='dest')
        self.rider.location = classes.Location(georss_point=self.rider_position)
        self.rider.destination = classes.Location(georss_point=self.rider_destination,point='dest')
        self.rider2.location = classes.Location(georss_point=self.rider_position)
        self.rider2.destination = classes.Location(georss_point=self.rider_destination,point='dest')
github dgraziotin / dycapo / tests / test_matching_algorithm.py View on Github external
def test_search_trip_driver_closer_to_destination(self):
        '''
        Rider and driver are now at the same latitude, 46.502000. We move Driver to
        46.503000 North (+0.01000). Therefore, driver is after rider and closer to
        the destination.
        Before this method:
            Driver Position:    '46.502000  11.340000'
            Rider Position:     '46.502000  11.340000'
        After this method:
            Driver Position:    '46.503000  11.340000'
            Rider Position:     '46.502000  11.340000'
        '''
        self.driver.position_lat += 0.001000
        self.driver_position = utils.georss_point_from_coords(self.driver.position_lat,self.driver.position_lon)
        self.driver.location = classes.Location(georss_point=self.driver_position)
        response = self.driver.update_position(location=self.driver.location)
        assert response['code'] == response_codes.CREATED
        response = self.rider.search_ride(self.rider.location,self.rider.destination)
        assert response['code'] == response_codes.NOT_FOUND
github dgraziotin / dycapo / tests / test_simple_matching.py View on Github external
def test_search_trip_driver_closest_to_destination(self):
        driver_position = '46.500730 11.345070'
        self.driver.location = classes.Location(georss_point=driver_position,point='posi')
        self.driver.update_position()

        response = self.rider.search_ride(self.rider.location,self.rider.destination)
        assert response['code'] == response_codes.NOT_FOUND
        self.driver.location = classes.Location(georss_point=self.driver_position)
        self.driver.update_position()
github dgraziotin / dycapo / tests / test_matching_algorithm.py View on Github external
def setup_method(self,method):
        self.driver.location = classes.Location(georss_point=self.driver_position)
        self.driver.destination = classes.Location(georss_point=self.driver_destination,point='dest')
        self.rider.location = classes.Location(georss_point=self.rider_position)
        self.rider.destination = classes.Location(georss_point=self.rider_destination,point='dest')
github dgraziotin / dycapo / tests / test_multiple_matching.py View on Github external
def setup_method(self,method):
        self.driver.location = classes.Location(georss_point=self.driver_position)
        self.driver.destination = classes.Location(georss_point=self.driver_destination,point='dest')
        self.rider5.location = classes.Location(georss_point=self.rider_position)
        self.rider5.destination = classes.Location(georss_point=self.rider_destination,point='dest')
        self.rider6.location = classes.Location(georss_point=self.rider_position)
        self.rider6.destination = classes.Location(georss_point=self.rider_destination,point='dest')

        for rider in self.riders:
            rider.location = classes.Location(georss_point=self.rider_position)
            rider.destination = classes.Location(georss_point=self.rider_destination,point='dest')
github dgraziotin / dycapo / tests / test_matching_algorithm.py View on Github external
def test_search_trip_valid(self):
        '''
        We move Driver + 0.00010 North 20 times, until he reaches rider
        location. Rider is +0.002000 North initially.
        Before this method:
            Driver Position:    '46.500000  11.340000'
            Rider Position:     '46.502000  11.340000'
        After this method:
            Driver Position:    '46.502000  11.340000'
            Rider Position:     '46.502000  11.340000'
        '''
        for i in range (1,21):
            self.driver.position_lat += 0.000100
            self.driver_position = utils.georss_point_from_coords(self.driver.position_lat,self.driver.position_lon)
            self.driver.location = classes.Location(georss_point=self.driver_position)
            response = self.driver.update_position(location=self.driver.location)
            assert response['code'] == response_codes.CREATED
            response = self.rider.search_ride(self.rider.location,self.rider.destination)
            assert response['code'] == response_codes.ALL_OK
            self.rider.trip = response['value'][0]

        driver_position = utils.coords_from_georss_point(self.driver.get_position()['value']['georss_point'])
        rider_position = utils.coords_from_georss_point(self.rider.get_position()['value']['georss_point'])
        assert driver_position == rider_position
github dgraziotin / dycapo / tests / test_multiple_matching.py View on Github external
def setup_method(self,method):
        self.driver.location = classes.Location(georss_point=self.driver_position)
        self.driver.destination = classes.Location(georss_point=self.driver_destination,point='dest')
        self.rider5.location = classes.Location(georss_point=self.rider_position)
        self.rider5.destination = classes.Location(georss_point=self.rider_destination,point='dest')
        self.rider6.location = classes.Location(georss_point=self.rider_position)
        self.rider6.destination = classes.Location(georss_point=self.rider_destination,point='dest')

        for rider in self.riders:
            rider.location = classes.Location(georss_point=self.rider_position)
            rider.destination = classes.Location(georss_point=self.rider_destination,point='dest')