diff --git a/src/qrules/topology.py b/src/qrules/topology.py index b110fbf9..457d33c1 100644 --- a/src/qrules/topology.py +++ b/src/qrules/topology.py @@ -624,7 +624,7 @@ def create_isobar_topologies( number_of_initial_edges=1, number_of_final_edges=number_of_final_states, ) - return tuple(topologies) + return tuple(sorted(topologies)) def create_n_body_topology( diff --git a/tests/unit/test_topology.py b/tests/unit/test_topology.py index c11e3bf1..0acaac5f 100644 --- a/tests/unit/test_topology.py +++ b/tests/unit/test_topology.py @@ -271,21 +271,10 @@ def test_swap_edges(self, two_to_three_decay: Topology): topology = topology.swap_edges(0, 1) assert topology != original_topology - @pytest.mark.parametrize( - ("n_final_states", "expected_order"), - [ - (2, [0]), - (3, [0]), - (4, [1, 0]), - (5, [3, 2, 4, 1, 0]), - (6, [13, 9, 7, 10, 6, 5, 14, 11, 8, 15, 3, 2, 12, 4, 1, 0]), - ], - ) - def test_unique_ordering(self, n_final_states, expected_order): + @pytest.mark.parametrize("n_final_states", [2, 3, 4, 5, 6]) + def test_unique_ordering(self, n_final_states): topologies = create_isobar_topologies(n_final_states) - sorted_topologies = sorted(topologies) - order = [sorted_topologies.index(t) for t in topologies] - assert order == expected_order + assert sorted(topologies) == list(topologies) @pytest.mark.parametrize(