@@ -21,10 +21,10 @@ def setUpClass(cls):
21
21
}
22
22
23
23
cls .expected_basic_strategies = axelrod .basic_strategies
24
- cls .expected_strategies = (
24
+ cls .expected_ordinary_strategies = (
25
25
axelrod .ordinary_strategies )
26
26
cls .expected_cheating_strategies = axelrod .cheating_strategies
27
- cls .expected_all_strategies = (
27
+ cls .expected_strategies = (
28
28
axelrod .ordinary_strategies +
29
29
axelrod .cheating_strategies )
30
30
@@ -37,14 +37,14 @@ def test_tournaments_dict(self):
37
37
actual_strategies = self .tmf ._tournaments_dict ()['strategies' ]
38
38
actual_cheating_strategies = (
39
39
self .tmf ._tournaments_dict ()['cheating_strategies' ])
40
- actual_all_strategies = self .tmf ._tournaments_dict ()['all_strategies ' ]
40
+ actual_all_strategies = self .tmf ._tournaments_dict ()['strategies ' ]
41
41
42
42
self .assertEqual (
43
43
actual_basic_strategies , self .expected_basic_strategies )
44
44
self .assertEqual (actual_strategies , self .expected_strategies )
45
45
self .assertEqual (
46
46
actual_cheating_strategies , self .expected_cheating_strategies )
47
- self .assertEqual (actual_all_strategies , self .expected_all_strategies )
47
+ self .assertEqual (actual_all_strategies , self .expected_strategies )
48
48
49
49
# Tests to ensure that the exclusions list works as intended
50
50
with_exclusions = self .tmf ._tournaments_dict (self .test_exclusions )
@@ -61,7 +61,84 @@ def test_add_tournaments(self):
61
61
self .tmf ._add_tournaments (mgr , self .test_exclusions , self .test_kwargs )
62
62
self .assertEqual (len (mgr ._tournaments ), 2 )
63
63
self .assertIsInstance (mgr ._tournaments [0 ], axelrod .Tournament )
64
- self .assertEqual (mgr ._tournaments [0 ].name , 'strategies' )
64
+ self .assertEqual (mgr ._tournaments [0 ].name , 'ordinary_strategies' )
65
+
66
+ def test_create_tournament_manager (self ):
67
+ mgr = self .tmf .create_tournament_manager (
68
+ output_directory = self .test_output_directory ,
69
+ no_ecological = False ,
70
+ rebuild_cache = self .test_rebuild_cache ,
71
+ cache_file = self .test_cache_file ,
72
+ exclusions = self .test_exclusions ,
73
+ ** self .test_kwargs )
74
+
75
+ self .assertIsInstance (mgr , axelrod .TournamentManager )
76
+ self .assertEqual (mgr ._output_directory , self .test_output_directory )
77
+ self .assertEqual (len (mgr ._tournaments ), 2 )
78
+ self .assertTrue (mgr ._with_ecological )
79
+ self .assertTrue (mgr ._pass_cache )
80
+
81
+
82
+ class TestProbEndTournamentManagerFactory (unittest .TestCase ):
83
+
84
+ @classmethod
85
+ def setUpClass (cls ):
86
+ cls .tmf = axelrod .ProbEndTournamentManagerFactory
87
+
88
+ cls .test_output_directory = './assets/'
89
+ cls .test_with_ecological = True
90
+ cls .test_rebuild_cache = False
91
+ cls .test_cache_file = './cache.txt'
92
+ cls .test_exclusions = ['basic_strategies' , 'cheating_strategies' ]
93
+ cls .test_kwargs = {
94
+ 'processes' : 2 ,
95
+ 'prob_end' : .1 ,
96
+ 'repetitions' : 200 ,
97
+ 'noise' : 0
98
+ }
99
+
100
+ cls .expected_basic_strategies = axelrod .basic_strategies
101
+ cls .expected_ordinary_strategies = (
102
+ axelrod .ordinary_strategies )
103
+ cls .expected_cheating_strategies = axelrod .cheating_strategies
104
+ cls .expected_strategies = (
105
+ axelrod .ordinary_strategies +
106
+ axelrod .cheating_strategies )
107
+
108
+ def test_tournaments_dict (self ):
109
+
110
+ # Tests to ensure that the tournaments dictionary contains the correct
111
+ # keys and values
112
+ actual_basic_strategies = (
113
+ self .tmf ._tournaments_dict ()['basic_strategies_prob_end' ])
114
+ actual_ordinary_strategies = self .tmf ._tournaments_dict ()['ordinary_strategies_prob_end' ]
115
+ actual_cheating_strategies = (
116
+ self .tmf ._tournaments_dict ()['cheating_strategies_prob_end' ])
117
+ actual_all_strategies = self .tmf ._tournaments_dict ()['strategies_prob_end' ]
118
+
119
+ self .assertEqual (
120
+ actual_basic_strategies , self .expected_basic_strategies )
121
+ self .assertEqual (actual_ordinary_strategies , self .expected_ordinary_strategies )
122
+ self .assertEqual (
123
+ actual_cheating_strategies , self .expected_cheating_strategies )
124
+ self .assertEqual (actual_all_strategies , self .expected_strategies )
125
+
126
+ # Tests to ensure that the exclusions list works as intended
127
+ with_exclusions = self .tmf ._tournaments_dict (self .test_exclusions )
128
+ self .assertFalse ('basic_strategies' in with_exclusions )
129
+ self .assertFalse ('cheating_strategies' in with_exclusions )
130
+ self .assertEqual (
131
+ with_exclusions ['strategies_prob_end' ], self .expected_strategies )
132
+
133
+ def test_add_tournaments (self ):
134
+ mgr = axelrod .ProbEndTournamentManager (
135
+ self .test_output_directory ,
136
+ self .test_with_ecological )
137
+
138
+ self .tmf ._add_tournaments (mgr , self .test_exclusions , self .test_kwargs )
139
+ self .assertEqual (len (mgr ._tournaments ), 2 )
140
+ self .assertIsInstance (mgr ._tournaments [0 ], axelrod .Tournament )
141
+ self .assertEqual (mgr ._tournaments [0 ].name , 'ordinary_strategies_prob_end' )
65
142
66
143
def test_create_tournament_manager (self ):
67
144
mgr = self .tmf .create_tournament_manager (
0 commit comments