@@ -273,6 +273,8 @@ def not_test_get_k_routes(nwa, p):
273273
274274def not_test_direction (roads_oslo ):
275275 """Check that a route that should go in separate tunnels, goes in correct tunnels."""
276+ m = 5
277+
276278 vippetangen = sg .to_gdf ([10.741527 , 59.9040595 ], crs = 4326 ).to_crs (roads_oslo .crs )
277279 ryen = sg .to_gdf ([10.8047522 , 59.8949826 ], crs = 4326 ).to_crs (roads_oslo .crs )
278280
@@ -283,25 +285,21 @@ def not_test_direction(roads_oslo):
283285 tunnel_tofrom = sg .to_gdf ([10.7724645 , 59.899908 ], crs = 4326 ).to_crs (roads_oslo .crs )
284286
285287 clipped = sg .clean_clip (roads_oslo , tunnel_fromto .buffer (2000 ))
288+
286289 connected_roads = sg .get_connected_components (clipped ).query ("connected == 1" )
287290 directed_roads = sg .make_directed_network_norway (connected_roads , dropnegative = True )
288291 rules = sg .NetworkAnalysisRules (directed = True , weight = "minutes" )
289292 nwa = sg .NetworkAnalysis (directed_roads , rules = rules )
290-
291293 route_fromto = nwa .get_route (vippetangen , ryen )
292294 route_tofrom = nwa .get_route (ryen , vippetangen )
293-
294- m = 5
295295 should_be_within = route_fromto .sjoin_nearest (tunnel_fromto , distance_col = "dist" )
296296 assert should_be_within ["dist" ].max () < m , should_be_within ["dist" ]
297297 should_be_within = route_tofrom .sjoin_nearest (tunnel_tofrom , distance_col = "dist" )
298298 assert should_be_within ["dist" ].max () < m , should_be_within ["dist" ]
299-
300299 should_not_be_within = route_fromto .sjoin_nearest (
301300 tunnel_tofrom , distance_col = "dist"
302301 )
303302 assert should_not_be_within ["dist" ].max () > m , should_not_be_within ["dist" ]
304-
305303 should_not_be_within = route_tofrom .sjoin_nearest (
306304 tunnel_fromto , distance_col = "dist"
307305 )
0 commit comments