diff --git a/axelrod/tests/unit/test_fingerprint.py b/axelrod/tests/unit/test_fingerprint.py index d6f8532ff..459e487c5 100644 --- a/axelrod/tests/unit/test_fingerprint.py +++ b/axelrod/tests/unit/test_fingerprint.py @@ -226,31 +226,31 @@ def test_plot(self): def test_wsls_fingerprint(self): axl.seed(0) # Fingerprinting is a random process - test_data = {Point(x=0.0, y=0.0): 3.0, - Point(x=0.0, y=0.25): 1.71, - Point(x=0.0, y=0.5): 1.44, - Point(x=0.0, y=0.75): 1.08, - Point(x=0.0, y=1.0): 0.5, - Point(x=0.25, y=0.0): 3.0, - Point(x=0.25, y=0.25): 2.23, - Point(x=0.25, y=0.5): 1.85, - Point(x=0.25, y=0.75): 1.27, - Point(x=0.25, y=1.0): 0.84, - Point(x=0.5, y=0.0): 3.0, - Point(x=0.5, y=0.25): 2.66, - Point(x=0.5, y=0.5): 2.77, - Point(x=0.5, y=0.75): 1.62, - Point(x=0.5, y=1.0): 1.02, - Point(x=0.75, y=0.0): 3.0, - Point(x=0.75, y=0.25): 3.12, - Point(x=0.75, y=0.5): 3.01, - Point(x=0.75, y=0.75): 2.27, - Point(x=0.75, y=1.0): 1.14, - Point(x=1.0, y=0.0): 3.0, - Point(x=1.0, y=0.25): 4.78, - Point(x=1.0, y=0.5): 3.94, - Point(x=1.0, y=0.75): 3.57, - Point(x=1.0, y=1.0): 1.3} + test_data = {Point(x=0.0, y=0.0): 3.000, + Point(x=0.0, y=0.25): 1.710, + Point(x=0.0, y=0.5): 1.440, + Point(x=0.0, y=0.75): 1.080, + Point(x=0.0, y=1.0): 0.500, + Point(x=0.25, y=0.0): 3.000, + Point(x=0.25, y=0.25): 2.280, + Point(x=0.25, y=0.5): 1.670, + Point(x=0.25, y=0.75): 1.490, + Point(x=0.25, y=1.0): 0.770, + Point(x=0.5, y=0.0): 3.000, + Point(x=0.5, y=0.25): 2.740, + Point(x=0.5, y=0.5): 2.240, + Point(x=0.5, y=0.75): 1.730, + Point(x=0.5, y=1.0): 1.000, + Point(x=0.75, y=0.0): 3.000, + Point(x=0.75, y=0.25): 3.520, + Point(x=0.75, y=0.5): 2.830, + Point(x=0.75, y=0.75): 1.750, + Point(x=0.75, y=1.0): 1.250, + Point(x=1.0, y=0.0): 3.000, + Point(x=1.0, y=0.25): 4.440, + Point(x=1.0, y=0.5): 4.410, + Point(x=1.0, y=0.75): 4.440, + Point(x=1.0, y=1.0): 1.300} af = axl.AshlockFingerprint(self.strategy, self.probe) data = af.fingerprint(turns=50, repetitions=2, step=0.25, progress_bar=False) @@ -260,31 +260,31 @@ def test_wsls_fingerprint(self): def test_tft_fingerprint(self): axl.seed(0) # Fingerprinting is a random process - test_data = {Point(x=0.0, y=0.0): 3.0, - Point(x=0.0, y=0.25): 1.82, - Point(x=0.0, y=0.5): 1.13, - Point(x=0.0, y=0.75): 1.05, - Point(x=0.0, y=1.0): 0.98, - Point(x=0.25, y=0.0): 3.0, - Point(x=0.25, y=0.25): 2.31, - Point(x=0.25, y=0.5): 1.92, - Point(x=0.25, y=0.75): 1.62, - Point(x=0.25, y=1.0): 1.63, - Point(x=0.5, y=0.0): 3.0, - Point(x=0.5, y=0.25): 2.6, - Point(x=0.5, y=0.5): 2.46, - Point(x=0.5, y=0.75): 1.93, - Point(x=0.5, y=1.0): 1.91, - Point(x=0.75, y=0.0): 3.0, - Point(x=0.75, y=0.25): 2.76, - Point(x=0.75, y=0.5): 2.33, - Point(x=0.75, y=0.75): 2.30, - Point(x=0.75, y=1.0): 2.07, - Point(x=1.0, y=0.0): 3.0, - Point(x=1.0, y=0.25): 2.72, - Point(x=1.0, y=0.5): 2.58, - Point(x=1.0, y=0.75): 2.38, - Point(x=1.0, y=1.0): 2.18} + test_data = {Point(x=0.0, y=0.0): 3.000, + Point(x=0.0, y=0.25): 1.820, + Point(x=0.0, y=0.5): 1.130, + Point(x=0.0, y=0.75): 1.050, + Point(x=0.0, y=1.0): 0.980, + Point(x=0.25, y=0.0): 3.000, + Point(x=0.25, y=0.25): 2.440, + Point(x=0.25, y=0.5): 1.770, + Point(x=0.25, y=0.75): 1.700, + Point(x=0.25, y=1.0): 1.490, + Point(x=0.5, y=0.0): 3.000, + Point(x=0.5, y=0.25): 2.580, + Point(x=0.5, y=0.5): 2.220, + Point(x=0.5, y=0.75): 2.000, + Point(x=0.5, y=1.0): 1.940, + Point(x=0.75, y=0.0): 3.000, + Point(x=0.75, y=0.25): 2.730, + Point(x=0.75, y=0.5): 2.290, + Point(x=0.75, y=0.75): 2.310, + Point(x=0.75, y=1.0): 2.130, + Point(x=1.0, y=0.0): 3.000, + Point(x=1.0, y=0.25): 2.790, + Point(x=1.0, y=0.5): 2.480, + Point(x=1.0, y=0.75): 2.310, + Point(x=1.0, y=1.0): 2.180} af = axl.AshlockFingerprint(axl.TitForTat, self.probe) data = af.fingerprint(turns=50, repetitions=2, step=0.25, @@ -295,31 +295,31 @@ def test_tft_fingerprint(self): def test_majority_fingerprint(self): axl.seed(0) # Fingerprinting is a random process - test_data = {Point(x=0.0, y=0.0): 3.0, - Point(x=0.0, y=0.25): 1.94, - Point(x=0.0, y=0.5): 1.13, - Point(x=0.0, y=0.75): 1.03, - Point(x=0.0, y=1.0): 0.98, - Point(x=0.25, y=0.0): 3.0, - Point(x=0.25, y=0.25): 2.31, - Point(x=0.25, y=0.5): 1.90, - Point(x=0.25, y=0.75): 1.86, - Point(x=0.25, y=1.0): 2.18, - Point(x=0.5, y=0.0): 3.0, - Point(x=0.5, y=0.25): 2.34, - Point(x=0.5, y=0.5): 1.89, - Point(x=0.5, y=0.75): 2.6, - Point(x=0.5, y=1.0): 2.70, - Point(x=0.75, y=0.0): 3.0, - Point(x=0.75, y=0.25): 2.40, - Point(x=0.75, y=0.5): 1.81, - Point(x=0.75, y=0.75): 2.13, - Point(x=0.75, y=1.0): 2.58, - Point(x=1.0, y=0.0): 3.0, - Point(x=1.0, y=0.25): 2.22, - Point(x=1.0, y=0.5): 1.74, - Point(x=1.0, y=0.75): 2.0, - Point(x=1.0, y=1.0): 2.26} + test_data = {Point(x=0.0, y=0.0): 3.000, + Point(x=0.0, y=0.25): 1.940, + Point(x=0.0, y=0.5): 1.130, + Point(x=0.0, y=0.75): 1.030, + Point(x=0.0, y=1.0): 0.980, + Point(x=0.25, y=0.0): 3.000, + Point(x=0.25, y=0.25): 2.130, + Point(x=0.25, y=0.5): 1.940, + Point(x=0.25, y=0.75): 2.060, + Point(x=0.25, y=1.0): 1.940, + Point(x=0.5, y=0.0): 3.000, + Point(x=0.5, y=0.25): 2.300, + Point(x=0.5, y=0.5): 2.250, + Point(x=0.5, y=0.75): 2.420, + Point(x=0.5, y=1.0): 2.690, + Point(x=0.75, y=0.0): 3.000, + Point(x=0.75, y=0.25): 2.400, + Point(x=0.75, y=0.5): 2.010, + Point(x=0.75, y=0.75): 2.390, + Point(x=0.75, y=1.0): 2.520, + Point(x=1.0, y=0.0): 3.000, + Point(x=1.0, y=0.25): 2.360, + Point(x=1.0, y=0.5): 1.740, + Point(x=1.0, y=0.75): 2.260, + Point(x=1.0, y=1.0): 2.260} af = axl.AshlockFingerprint(axl.GoByMajority, self.probe) data = af.fingerprint(turns=50, repetitions=2, step=0.25, diff --git a/axelrod/tests/unit/test_pickling.py b/axelrod/tests/unit/test_pickling.py index c1a802d4c..62c377d64 100644 --- a/axelrod/tests/unit/test_pickling.py +++ b/axelrod/tests/unit/test_pickling.py @@ -271,10 +271,9 @@ def test_pointer_to_class_derived_from_Player(self): self.assert_mutated_instance_same_as_pickled(player) def test_local_class_unpicklable(self): - """Due to steps taken, an unpickle-able AND transformed class - will not raise an error until it is un-pickled. This is - different from the original class that raises an error when it is - pickled.""" + """An unpickle-able AND transformed class will not raise an error until + it is un-pickled. This is different from the original class that raises + an error when it is pickled.""" class LocalCooperator(axl.Player): def __init__(self): super(LocalCooperator, self).__init__() @@ -283,6 +282,9 @@ def strategy(self, opponent): return C un_transformed = LocalCooperator() + # for coverage + self.assertEqual(un_transformed.strategy(axl.Cooperator()), C) + self.assertRaises(AttributeError, pickle.dumps, un_transformed) player = st.FlipTransformer()(LocalCooperator)() @@ -345,8 +347,3 @@ def assert_dual_wrapper_correct(self, player_class): p2.play(p3) self.assertEqual(p1.history, [x.flip() for x in p2.history]) - - - - -