Skip to content

Commit 84a8378

Browse files
committed
bug fix : merges the DataFrames on (tail, head) to ensure correct alignment before comparing volumes
1 parent 5297ae2 commit 84a8378

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/test_path.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,13 @@ def test_SF_network_run_01(spiess_florian_network):
515515
hp = HyperpathGenerating(edges)
516516
hp.run(origin=0, destination=12, volume=1.0)
517517

518-
# Test edge volumes
518+
# Test edge volumes - merge by (tail, head) to ensure correct alignment
519+
# since HyperpathGenerating may reorder edges internally
520+
edges_with_ref = edges[["tail", "head", "volume_ref"]].copy()
521+
computed_volumes = hp._edges[["tail", "head", "volume"]].copy()
522+
merged = edges_with_ref.merge(computed_volumes, on=["tail", "head"])
519523
np.testing.assert_allclose(
520-
edges["volume_ref"].values, hp._edges["volume"].values, rtol=1e-05, atol=1e-08
524+
merged["volume_ref"].values, merged["volume"].values, rtol=1e-05, atol=1e-08
521525
)
522526

523527
# Test vertex travel times (u_i_vec) from the paper

0 commit comments

Comments
 (0)