Ejemplo n.º 1
0
    def test4_resolve_by_coords(self):
        loc = City.getByLatLon(34.05223, -118.24368, self.redis)

        self.assertIsNotNone(loc)

        self.assertEqual(loc.country, "United States")
        self.assertIn(loc.state, ("CA", "California"))
Ejemplo n.º 2
0
    def test4_resolve_by_coords(self):
        loc = City.getByLatLon(34.05223, -118.24368, self.redis)

        self.assertIsNotNone(loc)

        self.assertEqual(loc.country, 'United States')
        self.assertIn(loc.state, ('CA', 'California'))
Ejemplo n.º 3
0
def benchResolveCoords(num):

    coords = [(-3.03333, 53.47778), (40.7226, -74.66544), (31.78199, 35.2196),
              (0, 0), (45, 45)]
    r = redis.Redis()
    ncoords = len(coords)
    for i in range(num):
        lat, lon = coords[i % ncoords]
        loc = City.getByLatLon(lat, lon, r)

    return num