Skip to content

Commit 9a05018

Browse files
drvinceknightmarcharper
authored andcommitted
Add specific test for TfT
1 parent 888b299 commit 9a05018

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

axelrod/tests/strategies/test_axelrod_first.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ def test_strategy(self):
186186
)
187187

188188
# Test recognition of random player
189-
190189
expected_attrs = {
191190
"opponent_is_random": False,
192191
"next_random_defection_turn": None,
@@ -217,6 +216,15 @@ def test_strategy(self):
217216
axelrod.Alternator(), expected_actions=actions, attrs=expected_attrs
218217
)
219218

219+
# Test versus TfT
220+
expected_attrs = {"opponent_is_random": False, "next_random_defection_turn": None}
221+
actions = [(C, C)] * 50 + [(D, C)] # 51 turns
222+
actions += [(C, D), (D, C)] * 3 # 56 turns
223+
actions += [(C, D), (D, C)] * 50
224+
self.versus_test(
225+
axelrod.TitForTat(), expected_actions=actions, seed=0, attrs=expected_attrs
226+
)
227+
220228
# Test random defections
221229
expected_attrs = {"opponent_is_random": False, "next_random_defection_turn": 78}
222230
actions = [(C, C)] * 50 + [(D, C)] + [(C, C)] * 16 + [(D, C)] + [(C, C)]

0 commit comments

Comments
 (0)