From e4e972e9602e84394d81f5f8085a67b6f68cf4e2 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Thu, 25 Apr 2024 15:52:05 -0700 Subject: [PATCH] fix tests --- tests/test_osmnx.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_osmnx.py b/tests/test_osmnx.py index 57230a0cd..4426c788d 100644 --- a/tests/test_osmnx.py +++ b/tests/test_osmnx.py @@ -125,6 +125,7 @@ def test_stats() -> None: reconnect_edges=False, ) G_clean = ox.consolidate_intersections(G_proj, tolerance=10, rebuild_graph=False) + G_clean = ox.consolidate_intersections(G_proj, tolerance=50000, rebuild_graph=True) # try consolidating an empty graph G = nx.MultiDiGraph(crs="epsg:4326") @@ -132,9 +133,16 @@ def test_stats() -> None: G_clean = ox.consolidate_intersections(G, rebuild_graph=False) # test passing dict of tolerances to consolidate_intersections - tolerance_dict = {node: 10 for node in G.nodes} - G_clean = ox.consolidate_intersections(G_proj, tolerance={0: 10}, rebuild_graph=True) - G_clean = ox.consolidate_intersections(G_proj, tolerance=tolerance_dict, rebuild_graph=True) + tols: dict[int, float] + # every node present + tols = {node: 5 for node in G_proj.nodes} + G_clean = ox.consolidate_intersections(G_proj, tolerance=tols, rebuild_graph=True) + # one node missing + tols.popitem() + G_clean = ox.consolidate_intersections(G_proj, tolerance=tols, rebuild_graph=True) + # one node 0 + tols[next(iter(tols))] = 0 + G_clean = ox.consolidate_intersections(G_proj, tolerance=tols, rebuild_graph=True) def test_bearings() -> None: