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 7e3fd8a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions axelrod/tests/unit/test_resultset.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,14 @@ 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.cooperation, brs.cooperation)
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(sorted(rs.ranked_names), sorted(brs.ranked_names))

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

0 comments on commit 7e3fd8a

Please sign in to comment.