def test_nearest_filter(self):
     """Tests filtering nearest stations"""
     for airport, reports, count in (
         (True, True, 6),
         (True, False, 15),
         (False, True, 6),
         (False, False, 29),
     ):
         stations = station.nearest(30, -80, 30, airport, reports, 1.5)
         self.assertEqual(len(stations), count)
Exemple #2
0
 def test_nearest(self):
     """
     Tests returning nearest Stations to lat, lon
     """
     stn, dist = station.nearest(28.43, -81.31)
     self.assertIsInstance(stn, station.Station)
     self.assertEqual(stn.icao, "KMCO")
     self.assertIsInstance(dist, float)
     for *params, count in (
         (30, -82, 10, True, 0.1, 0),
         (30, -82, 10, False, 0.1, 2),
         (30, -82, 1000, True, 0.5, 6),
         (30, -82, 1000, False, 0.5, 38),
     ):
         stations = station.nearest(*params)
         self.assertEqual(len(stations), count)
         for stn, dist in stations:
             self.assertIsInstance(stn, station.Station)
             self.assertIsInstance(dist, float)
 def test_nearest(self):
     """Tests returning nearest Stations to lat, lon"""
     dist = station.nearest(28.43, -81.31)
     stn = dist.pop("station")
     self.assertIsInstance(stn, station.Station)
     self.assertEqual(stn.icao, "KMCO")
     for val in dist.values():
         self.assertIsInstance(val, float)
     for *params, count in (
         (30, -82, 10, True, True, 0.2, 1),
         (30, -82, 10, True, False, 0.2, 5),
         (30, -82, 10, False, False, 0.2, 6),
         (30, -82, 1000, True, True, 0.5, 6),
         (30, -82, 1000, False, False, 0.5, 37),
     ):
         stations = station.nearest(*params)
         self.assertEqual(len(stations), count)
         for dist in stations:
             stn = dist.pop("station")
             self.assertIsInstance(stn, station.Station)
             for val in dist.values():
                 self.assertIsInstance(val, float)