Ejemplo n.º 1
0
    def test_inserting_locations(self):
        locations = self.db.locations
        for l in LOCATIONS:
            location_hash = grid_id(l[0], l[1], 400, 600)
            locations.insert({
                'latitude': l[0],
                'longitude': l[1],
                'hash': location_hash})

        self.assertEqual(len(LOCATIONS), locations.count())
        expected_latitude = 37.58
        spot = locations.find_one({"hash": (382, 203)})
        self.assertEqual(expected_latitude, spot["latitude"])
Ejemplo n.º 2
0
 def test_convenience_function(self):
     expected_result = (462, 204)
     location_id = grid_id(self.latitude, self.longitude, self.grid_width,
                           self.grid_height)
     self.assertEqual(location_id, expected_result)
Ejemplo n.º 3
0
 def test_convenience_function(self):
     expected_result = (462, 204)
     location_id = grid_id(self.latitude, self.longitude,
         self.grid_width, self.grid_height)
     self.assertEqual(location_id, expected_result)