Skip to content

Commit

Permalink
Fix floating point error in a hyp test
Browse files Browse the repository at this point in the history
In some cases floating point error will make this particular test throw
a different rank for the strategies.
  • Loading branch information
drvinceknight committed Sep 26, 2016
1 parent e21ac85 commit 4a0bf57
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion axelrod/tests/unit/test_resultset.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,15 @@ def test_equality_with_round_robin(self, tournament):
progress_bar=False)

# Not testing full equality because of floating point errors.
self.assertEqual(rs.ranked_names, brs.ranked_names)
self.assertEqual(rs.scores, brs.scores)
self.assertEqual(rs.wins, brs.wins)
self.assertEqual(rs.match_lengths, brs.match_lengths)
self.assertEqual(rs.cooperation, brs.cooperation)

# Test that players are in the results (due to floating point errors
# the order might not be the same)
self.assertEqual(set(rs.ranked_names), set(brs.ranked_names))

@given(tournament=prob_end_tournaments(max_size=5,
min_prob_end=.7,
max_repetitions=3))
Expand Down

0 comments on commit 4a0bf57

Please sign in to comment.