def test_GetStationsAround(self): Cartography.synchronize(TEST_XML_URL_DATA_STATION) finder = BaseGeoFinder(1, 1) self.assertEquals(len(finder.get_stations_around( STATION_AROUND_RADIUS)), 0) finder.lat = 48.81 finder.lng = 2.38 self.assertEquals( [station.id for station in finder.get_stations_around(STATION_AROUND_RADIUS)], [42012, 42010, 42009, 42008, 42016, 42006, 42007, 42015]) Cartography.flush()
def test_Cache(self): key = (1, 1, STATION_AROUND_RADIUS) self.assertFalse(key in global_geofinder_cache) finder = BaseGeoFinder(key[0], key[1]) finder.get_stations_around(key[2]) self.assertTrue(key in global_geofinder_cache)