From 4a0bf574275f481659343b3bced0d887c6f66105 Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Mon, 26 Sep 2016 10:39:38 +0100 Subject: [PATCH] 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. --- axelrod/tests/unit/test_resultset.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/axelrod/tests/unit/test_resultset.py b/axelrod/tests/unit/test_resultset.py index 96ba3278d..ccaa7b9d6 100644 --- a/axelrod/tests/unit/test_resultset.py +++ b/axelrod/tests/unit/test_resultset.py @@ -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))