Skip to content

Commit 6375474

Browse files
drvinceknightmarcharper
authored andcommitted
Refactor tests for alternator for #884
1 parent fc01357 commit 6375474

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

axelrod/tests/strategies/test_alternator.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ class TestAlternator(TestPlayer):
2323
def test_strategy(self):
2424
# Starts by cooperating.
2525
self.first_play_test(C)
26-
for i in range(10):
27-
self.responses_test([C, D] * i)
28-
self.responses_test([C], [C, D, C, D], [C, C, C, C])
29-
self.responses_test([D], [C, D, C, D, C], [C, C, C, C, C])
26+
27+
opponent = axelrod.MockPlayer()
28+
actions = [(C, C), (D, C)] * 5
29+
self.versus_test(opponent, expected_actions=actions)
30+
31+
opponent = axelrod.MockPlayer(D)
32+
actions = [(C, D), (D, D)] * 5
33+
self.versus_test(opponent, expected_actions=actions)
34+
35+
opponent = axelrod.MockPlayer([D, C])
36+
actions = [(C, D), (D, C)] * 5
37+
self.versus_test(opponent, expected_actions=actions)

0 commit comments

Comments
 (0)