Skip to content

Commit

Permalink
refactor: sort output of create_isobar_topologies
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Feb 21, 2022
1 parent c6ccd6f commit 38d7750
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/qrules/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
17 changes: 3 additions & 14 deletions tests/unit/test_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 38d7750

Please sign in to comment.