Skip to content

Commit 7e3fd8a

Browse files
committed
Fix floating point error in a hyp test
In some cases floating point error will make this particular test throw a different rank for the strategies.
1 parent e21ac85 commit 7e3fd8a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

axelrod/tests/unit/test_resultset.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,14 @@ def test_equality_with_round_robin(self, tournament):
500500
progress_bar=False)
501501

502502
# Not testing full equality because of floating point errors.
503-
self.assertEqual(rs.ranked_names, brs.ranked_names)
503+
self.assertEqual(rs.cooperation, brs.cooperation)
504504
self.assertEqual(rs.scores, brs.scores)
505+
self.assertEqual(rs.wins, brs.wins)
505506
self.assertEqual(rs.match_lengths, brs.match_lengths)
506-
self.assertEqual(rs.cooperation, brs.cooperation)
507+
508+
# Test that players are in the results (due to floating point errors
509+
# the order might not be the same)
510+
self.assertEqual(sorted(rs.ranked_names), sorted(brs.ranked_names))
507511

508512
@given(tournament=prob_end_tournaments(max_size=5,
509513
min_prob_end=.7,

0 commit comments

Comments
 (0)