@@ -23,15 +23,18 @@ class TestGolden(TestPlayer):
2323 def test_strategy (self ):
2424 # Cooperates initially.
2525 self .first_play_test (C )
26- # If the opposing player does not defect initially then strategy
27- # defects.
28- self .responses_test ([D ], [C ], [C ])
29- # If the ratio of Cs to Ds is greater than the golden ratio then
30- # strategy defects.
31- self .responses_test ([D ], [C ] * 4 , [C , C , D , D ])
32- # If the ratio of Cs to Ds is less than the golden ratio then strategy
33- # co-operates
34- self .responses_test ([C ], [C ] * 4 , [D ] * 4 )
26+
27+ actions = [(C , C ), (D , D ), (C , C ), (D , D ), (C , C )]
28+ self .versus_test (opponent = axelrod .Alternator (),
29+ expected_actions = actions )
30+
31+ actions = [(C , C ), (D , C ), (D , C ), (D , C ), (D , C )]
32+ self .versus_test (opponent = axelrod .Cooperator (),
33+ expected_actions = actions )
34+
35+ actions = [(C , D ), (C , D ), (C , D ), (C , D ), (C , D )]
36+ self .versus_test (opponent = axelrod .Defector (),
37+ expected_actions = actions )
3538
3639
3740class TestPi (TestPlayer ):
@@ -51,13 +54,18 @@ class TestPi(TestPlayer):
5154 def test_strategy (self ):
5255 # Cooperates initially
5356 self .first_play_test (C )
54- # If the opposing player does not defect initially then strategy
55- # defects.
56- self .responses_test ([D ], [C ], [C ])
57- # If the ratio of Cs to Ds is greater than pi then strategy defects.
58- self .responses_test ([D ], [C ] * 4 , [C , C , C , D ])
59- # If the ratio of Cs to Ds is less than pi then strategy co-operates.
60- self .responses_test ([C ], [C ] * 4 , [C , C , D , D ])
57+
58+ actions = [(C , C ), (D , D ), (C , C ), (C , D ), (C , C )]
59+ self .versus_test (opponent = axelrod .Alternator (),
60+ expected_actions = actions )
61+
62+ actions = [(C , C ), (D , C ), (D , C ), (D , C ), (D , C )]
63+ self .versus_test (opponent = axelrod .Cooperator (),
64+ expected_actions = actions )
65+
66+ actions = [(C , D ), (C , D ), (C , D ), (C , D ), (C , D )]
67+ self .versus_test (opponent = axelrod .Defector (),
68+ expected_actions = actions )
6169
6270
6371class Teste (TestPlayer ):
@@ -77,10 +85,15 @@ class Teste(TestPlayer):
7785 def test_strategy (self ):
7886 # Cooperates initially.
7987 self .first_play_test (C )
80- # If the opposing player does not defect initially then strategy
81- # defects.
82- self .responses_test ([D ], [C ], [C ])
83- # If the ratio of Cs to Ds is greater than e then strategy defects.
84- self .responses_test ([D ], [C ] * 4 , [C , C , D , D ])
85- # If the ratio of Cs to Ds is less than e then strategy co-operates.
86- self .responses_test ([C ], [C ] * 4 , [C , D , D , D ])
88+
89+ actions = [(C , C ), (D , D ), (C , C ), (C , D ), (C , C )]
90+ self .versus_test (opponent = axelrod .Alternator (),
91+ expected_actions = actions )
92+
93+ actions = [(C , C ), (D , C ), (D , C ), (D , C ), (D , C )]
94+ self .versus_test (opponent = axelrod .Cooperator (),
95+ expected_actions = actions )
96+
97+ actions = [(C , D ), (C , D ), (C , D ), (C , D ), (C , D )]
98+ self .versus_test (opponent = axelrod .Defector (),
99+ expected_actions = actions )
0 commit comments