Skip to content

Commit fd7f8cc

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 fd7f8cc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

axelrod/tests/unit/test_resultset.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,15 @@ 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)
504503
self.assertEqual(rs.scores, brs.scores)
504+
self.assertEqual(rs.wins, brs.wins)
505505
self.assertEqual(rs.match_lengths, brs.match_lengths)
506506
self.assertEqual(rs.cooperation, brs.cooperation)
507507

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))
511+
508512
@given(tournament=prob_end_tournaments(max_size=5,
509513
min_prob_end=.7,
510514
max_repetitions=3))

0 commit comments

Comments
 (0)