def test_routing() -> None:
    """Test working with speed, travel time, and routing."""
    G = ox.graph_from_address(address=address, dist=500, dist_type="bbox", network_type="bike")

    # give each edge speed and travel time attributes
    G = ox.add_edge_speeds(G)
    G = ox.add_edge_speeds(G, hwy_speeds={"motorway": 100})
    G = ox.add_edge_travel_times(G)

    # test value cleaning
    assert ox.routing._clean_maxspeed("100,2") == 100.2
    assert ox.routing._clean_maxspeed("100.2") == 100.2
    assert ox.routing._clean_maxspeed("100 km/h") == 100.0
    assert ox.routing._clean_maxspeed("100 mph") == pytest.approx(160.934)
    assert ox.routing._clean_maxspeed("60|100") == 80
    assert ox.routing._clean_maxspeed("60|100 mph") == pytest.approx(128.7472)
    assert ox.routing._clean_maxspeed("signal") is None
    assert ox.routing._clean_maxspeed("100;70") is None
    assert ox.routing._clean_maxspeed("FR:urban") == 50.0

    # test collapsing multiple mph values to single kph value
    assert ox.routing._collapse_multiple_maxspeed_values(["25 mph", "30 mph"], np.mean) == 44.25685

    # test collapsing invalid values: should return None
    assert ox.routing._collapse_multiple_maxspeed_values(["mph", "kph"], np.mean) is None

    orig_x = np.array([-122.404771])
    dest_x = np.array([-122.401429])
    orig_y = np.array([37.794302])
    dest_y = np.array([37.794987])
    orig_node = int(ox.distance.nearest_nodes(G, orig_x, orig_y)[0])
    dest_node = int(ox.distance.nearest_nodes(G, dest_x, dest_y)[0])

    # test non-numeric weight, should raise ValueError
    with pytest.raises(ValueError, match="contains non-numeric values"):
        route1 = ox.shortest_path(G, orig_node, dest_node, weight="highway")

    # mismatch iterable and non-iterable orig/dest, should raise TypeError
    msg = "must either both be iterable or neither must be iterable"
    with pytest.raises(TypeError, match=msg):
        route2 = ox.shortest_path(G, orig_node, [dest_node])  # type: ignore[call-overload]

    # mismatch lengths of orig/dest, should raise ValueError
    msg = "must be of equal length"
    with pytest.raises(ValueError, match=msg):
        route2 = ox.shortest_path(G, [orig_node] * 2, [dest_node] * 3)

    # test missing weight (should raise warning)
    route3 = ox.shortest_path(G, orig_node, dest_node, weight="time")
    # test good weight
    route4 = ox.routing.shortest_path(G, orig_node, dest_node, weight="travel_time")
    route5 = ox.shortest_path(G, orig_node, dest_node, weight="travel_time")
    assert route5 is not None

    route_edges = ox.routing.route_to_gdf(G, route5, weight="travel_time")

    fig, ax = ox.plot_graph_route(G, route5, save=True)

    # test multiple origins-destinations
    n = 5
    nodes = np.array(G.nodes)
    origs = [int(x) for x in np.random.default_rng().choice(nodes, size=n, replace=True)]
    dests = [int(x) for x in np.random.default_rng().choice(nodes, size=n, replace=True)]
    paths1 = ox.shortest_path(G, origs, dests, weight="length", cpus=1)
    paths2 = ox.shortest_path(G, origs, dests, weight="length", cpus=2)
    paths3 = ox.shortest_path(G, origs, dests, weight="length", cpus=None)
    assert paths1 == paths2 == paths3

    # test k shortest paths
    routes = ox.routing.k_shortest_paths(G, orig_node, dest_node, k=2, weight="travel_time")
    fig, ax = ox.plot_graph_routes(G, list(routes))

    # test great circle and euclidean distance calculators
    assert ox.distance.great_circle(0, 0, 1, 1) == pytest.approx(157249.6034105)
    assert ox.distance.euclidean(0, 0, 1, 1) == pytest.approx(1.4142135)
Test working with speed, travel time, and routing.
tests/test_osmnx.py