Skip to content

Commit 40a99de

Browse files
committed
Add tests for TF*
1 parent e350cf4 commit 40a99de

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

axelrod/strategies/finite_state_machines.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ class TF1(FSMPlayer):
587587

588588
name = "TF1"
589589
classifier = {
590-
'memory_depth': 16, # Estimate
590+
'memory_depth': float('inf'),
591591
'stochastic': False,
592592
'makes_use_of': set(),
593593
'long_run_time': False,
@@ -631,7 +631,7 @@ class TF2(FSMPlayer):
631631

632632
name = "TF2"
633633
classifier = {
634-
'memory_depth': 16, # Estimate
634+
'memory_depth': float('inf'),
635635
'stochastic': False,
636636
'makes_use_of': set(),
637637
'long_run_time': False,
@@ -675,7 +675,7 @@ class TF3(FSMPlayer):
675675

676676
name = "TF3"
677677
classifier = {
678-
'memory_depth': 8, # Estimate
678+
'memory_depth': float('inf'),
679679
'stochastic': False,
680680
'makes_use_of': set(),
681681
'long_run_time': False,

axelrod/tests/strategies/test_finite_state_machines.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,11 @@ def transitions_test(self, state_and_action):
173173
expected_actions.append((fsm_move, current_opponent_move))
174174
opponent_actions.append(current_opponent_move)
175175

176-
self.verify_against_finite_state_machine(current_state=current_state,
177-
expected_state=new_state,
178-
last_opponent_move=last_opponent_move,
179-
expected_move=fsm_move)
176+
self.verify_against_finite_state_machine(
177+
current_state=current_state,
178+
expected_state=new_state,
179+
last_opponent_move=last_opponent_move,
180+
expected_move=fsm_move)
180181

181182
self.versus_test(axelrod.MockPlayer(actions=opponent_actions),
182183
expected_actions=expected_actions)
@@ -790,7 +791,7 @@ class TestTF1(TestFSMPlayer):
790791
name = "TF1"
791792
player = axelrod.TF1
792793
expected_classifier = {
793-
'memory_depth': 16,
794+
'memory_depth': float('inf'),
794795
'stochastic': False,
795796
'makes_use_of': set(),
796797
'long_run_time': False,
@@ -801,13 +802,15 @@ class TestTF1(TestFSMPlayer):
801802

802803
def test_strategy(self):
803804
self.first_play_test(C)
805+
actions = [(C, C), (C, D), (D, C), (D, D), (D, C)]
806+
self.versus_test(axelrod.Alternator(), expected_actions=actions)
804807

805808

806809
class TestTF2(TestFSMPlayer):
807810
name = "TF2"
808811
player = axelrod.TF2
809812
expected_classifier = {
810-
'memory_depth': 16,
813+
'memory_depth': float('inf'),
811814
'stochastic': False,
812815
'makes_use_of': set(),
813816
'long_run_time': False,
@@ -818,13 +821,15 @@ class TestTF2(TestFSMPlayer):
818821

819822
def test_strategy(self):
820823
self.first_play_test(C)
824+
actions = [(C, C), (D, D), (D, C), (C, D), (D, C)]
825+
self.versus_test(axelrod.Alternator(), expected_actions=actions)
821826

822827

823828
class TestTF3(TestFSMPlayer):
824829
name = "TF3"
825830
player = axelrod.TF3
826831
expected_classifier = {
827-
'memory_depth': 8,
832+
'memory_depth': float('inf'),
828833
'stochastic': False,
829834
'makes_use_of': set(),
830835
'long_run_time': False,
@@ -835,3 +840,5 @@ class TestTF3(TestFSMPlayer):
835840

836841
def test_strategy(self):
837842
self.first_play_test(C)
843+
actions = [(C, C), (C, D), (C, C), (D, D), (D, C)]
844+
self.versus_test(axelrod.Alternator(), expected_actions=actions)

0 commit comments

Comments
 (0)