Ejemplo n.º 1
0
 def test_convert_dict_to_point(self):
     """
     Tests the convert_to_point function with a dictionary.
     """
     point = shapes.convert_to_point({'lat': 40, 'lon': 100}, 'lon')
     self.assertEqual(point[0], 100)
     self.assertEqual(point[1], 40)
Ejemplo n.º 2
0
 def test_convert_lon_list_to_point(self):
     """
     Tests the convert_to_point function with a list that starts with
     longitude.
     """
     point = shapes.convert_to_point([100, 40], 'lon')
     self.assertEqual(point[0], 100)
     self.assertEqual(point[1], 40)
Ejemplo n.º 3
0
    def get_location(self, data):
        """Return the value of the location field.

        Parameters
        ----------
        data : |dict|
            A document from which to extract the date field.

        Returns
        -------
        |Point| or |None|
            The value of the location field.

        """
        location = get_dict_value(self.location, data)
        if location:
            return convert_to_point(location, self.location_format)