Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gboeing authored Apr 25, 2024
1 parent edd26b2 commit e4e972e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_osmnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,24 @@ 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")
G_clean = ox.consolidate_intersections(G, rebuild_graph=True)
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:
Expand Down

0 comments on commit e4e972e

Please sign in to comment.