コード例 #1
0
    def test_stops_farther_than_custom_threshold_with_same_longitude_should_return_true(
        self, ):
        stop_1 = {"stop_lat": 45.508888, "stop_lon": -73.561668}
        stop_2 = {"stop_lat": 45.508978, "stop_lon": -73.561668}

        under_test = StopsLongitudeLatitudeTooClose()
        self.assertFalse(under_test.execute(stop_1, stop_2, 10))
コード例 #2
0
    def test_stops_farther_than_default_5_meters_with_same_longitude_should_return_true(
        self, ):
        stop_1 = {"stop_lat": 45.508888, "stop_lon": -73.561668}
        stop_2 = {"stop_lat": 45.508933, "stop_lon": -73.561668}

        under_test = StopsLongitudeLatitudeTooClose()
        self.assertFalse(under_test.execute(stop_1, stop_2))
コード例 #3
0
 def execute(self):
     """Execute comparison between the two GTFS datasets."""
     stops_longitude_latitude_too_close = StopsLongitudeLatitudeTooClose()
     for i in range(len(self.stops_1)):
         for j in range(len(self.stops_2)):
             stops_longitude_latitude_too_close.execute(
                 self.stops_1.iloc[i], self.stops_2.iloc[j])
コード例 #4
0
    def test_stops_closer_than_custom_threshold_should_return_true(self):
        stop_1 = {"stop_lat": 45.508888, "stop_lon": -73.561668}
        stop_2 = {"stop_lat": 45.508889, "stop_lon": -73.561669}

        under_test = StopsLongitudeLatitudeTooClose()
        self.assertTrue(under_test.execute(stop_1, stop_2, 10))
コード例 #5
0
    def test_none_stop1_should_return_none(self):
        stop_1 = None
        stop_2 = {"stop_lat": 45.508888, "stop_lon": -73.561668}

        under_test = StopsLongitudeLatitudeTooClose()
        self.assertIsNone(under_test.execute(stop_1, stop_2))