@@ -42,7 +42,8 @@ def setUpClass(cls):
42
42
except KeyError :
43
43
cls .interactions [index_pair ] = [match .result ]
44
44
45
- cls .test_result_set = axelrod .ResultSet (cls .players , cls .interactions )
45
+ cls .test_result_set = axelrod .ResultSet (cls .players , cls .interactions ,
46
+ progress_bar = False )
46
47
cls .expected_boxplot_dataset = [
47
48
[(17 / 5 + 9 / 5 ) / 2 for _ in range (3 )],
48
49
[(13 / 5 + 4 / 5 ) / 2 for _ in range (3 )],
@@ -116,7 +117,7 @@ def test_init_from_resulsetfromfile(self):
116
117
repetitions = 2 )
117
118
tournament .play (filename = tmp_file .name , progress_bar = False )
118
119
tmp_file .close ()
119
- rs = axelrod .ResultSetFromFile (tmp_file .name )
120
+ rs = axelrod .ResultSetFromFile (tmp_file .name , progress_bar = False )
120
121
121
122
plot = axelrod .Plot (rs )
122
123
self .assertEqual (plot .result_set , rs )
@@ -159,9 +160,9 @@ def test_boxplot_with_passed_axes(self):
159
160
self .assertNotEqual (axarr [0 , 1 ].get_ylim (), (0 , 1 ))
160
161
161
162
# Plot on another axes with a title
162
- plot .boxplot (title = "Test " , ax = axarr [1 , 0 ])
163
+ plot .boxplot (title = "dummy title " , ax = axarr [1 , 0 ])
163
164
self .assertNotEqual (axarr [1 , 0 ].get_ylim (), (0 , 1 ))
164
- self .assertEqual (axarr [1 , 0 ].get_title (), "Test " )
165
+ self .assertEqual (axarr [1 , 0 ].get_title (), "dummy title " )
165
166
166
167
else : # pragma: no cover
167
168
self .skipTest ('matplotlib not installed' )
@@ -248,6 +249,22 @@ def test_payoff_with_title(self):
248
249
else : # pragma: no cover
249
250
self .skipTest ('matplotlib not installed' )
250
251
252
+ def test_payoff_with_passed_axes (self ):
253
+ if matplotlib_installed :
254
+ plot = axelrod .Plot (self .test_result_set )
255
+ fig , axarr = plt .subplots (2 , 2 )
256
+ self .assertEqual (axarr [0 , 1 ].get_xlim (), (0 , 1 ))
257
+
258
+ plot .payoff (ax = axarr [0 , 1 ])
259
+ self .assertNotEqual (axarr [0 , 1 ].get_xlim (), (0 , 1 ))
260
+
261
+ # Plot on another axes with a title
262
+ plot .payoff (title = "dummy title" , ax = axarr [1 , 0 ])
263
+ self .assertNotEqual (axarr [1 , 0 ].get_xlim (), (0 , 1 ))
264
+ self .assertEqual (axarr [1 , 0 ].get_xlabel (), "dummy title" )
265
+ else : # pragma: no cover
266
+ self .skipTest ('matplotlib not installed' )
267
+
251
268
def test_stackplot (self ):
252
269
if matplotlib_installed :
253
270
eco = axelrod .Ecosystem (self .test_result_set )
@@ -298,6 +315,6 @@ def test_all_plots(self):
298
315
self .assertIsNone (
299
316
plot .save_all_plots (prefix = "test_outputs/" ,
300
317
title_prefix = "A prefix" ,
301
- progress_bar = False ))
318
+ progress_bar = True ))
302
319
else : # pragma: no cover
303
320
self .skipTest ('matplotlib not installed' )
0 commit comments