5
5
from numpy import mean , std
6
6
7
7
import tempfile
8
+ import os
8
9
9
10
from hypothesis import given , settings
10
11
from axelrod .tests .property import tournaments , prob_end_tournaments
@@ -398,9 +399,8 @@ class TestResultSetFromFile(unittest.TestCase):
398
399
399
400
def test_init (self ):
400
401
brs = axelrod .ResultSetFromFile (self .tmp_file .name , progress_bar = False )
401
- players = ['Cooperator' , 'Tit For Tat' , 'Defector' ]
402
- self .assertEqual (brs .players , players )
403
- self .assertEqual (brs .nplayers , len (players ))
402
+ self .assertEqual (brs .players , [str (p ) for p in self .players ])
403
+ self .assertEqual (brs .nplayers , len (self .players ))
404
404
self .assertEqual (brs .nrepetitions , 3 )
405
405
406
406
def test_init_with_different_game (self ):
@@ -409,6 +409,30 @@ def test_init_with_different_game(self):
409
409
game = game )
410
410
self .assertEqual (brs .game .RPST (), (- 1 , - 1 , - 1 , - 1 ))
411
411
412
+ def test_init_with_progress_bar (self ):
413
+ """Just able to test that no error occurs"""
414
+ brs = axelrod .ResultSetFromFile (self .tmp_file .name , progress_bar = True )
415
+ self .assertEqual (brs .nplayers , len (self .players ))
416
+ self .assertEqual (brs .nrepetitions , 3 )
417
+ self .assertEqual (brs .num_interactions , 18 )
418
+
419
+ def test_init_with_num_interactions (self ):
420
+ """Just able to test that no error occurs"""
421
+ brs = axelrod .ResultSetFromFile (self .tmp_file .name , progress_bar = True ,
422
+ num_interactions = 18 )
423
+ self .assertEqual (brs .nplayers , len (self .players ))
424
+ self .assertEqual (brs .nrepetitions , 3 )
425
+ self .assertEqual (brs .num_interactions , 18 )
426
+
427
+ def test_init_with_players_nrepetitions (self ):
428
+ """Just able to test that no error occurs"""
429
+ brs = axelrod .ResultSetFromFile (self .tmp_file .name , progress_bar = True ,
430
+ num_interactions = 18 , nrepetitions = 3 ,
431
+ players = [str (p ) for p in self .players ])
432
+ self .assertEqual (brs .nplayers , len (self .players ))
433
+ self .assertEqual (brs .nrepetitions , 3 )
434
+ self .assertEqual (brs .num_interactions , 18 )
435
+
412
436
def test_equality (self ):
413
437
"""A test that checks overall equality by comparing to the base result
414
438
set class"""
0 commit comments