Beispiel #1
0
    def test_closest_bus_stop(self):
        route_bus = CdsRouteBus.make(*[
            51.625537, 39.177478, 16, "2018-02-15T19:57:47", "М617АК136", 834,
            20, "80", 0, "2018-02-15T19:54:56", "Рабочий проспект (из центра)"
        ])

        station = self.cds.get_closest_bus_stop(route_bus)
        logger.info(
            f"{station}; {route_bus.distance_km(station):.4f}  {route_bus.distance(station):.4f}"
        )
Beispiel #2
0
 def next_test_data(self):
     if self.test_data_files and self.test_data_index >= len(
             self.test_data_files):
         self.test_data_index = 0
     path = self.test_data_files[self.test_data_index]
     self.mocked_now = datetime.strptime(
         path.name, "codd_data_db%y_%m_%d_%H_%M_%S.json")
     with open(path, 'rb') as f:
         long_bus_stops = [CdsRouteBus.make(*i) for i in json.load(f)]
     self.test_data_index += 1
     self.logger.info(f'Loaded {path.name}; {self.mocked_now:%H:%M:%S}')
     return long_bus_stops