Skip to content

Commit 0bc5104

Browse files
committed
Add more tests.
1 parent 568275e commit 0bc5104

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

axelrod/tests/unit/test_resultset.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from numpy import mean, std
66

77
import tempfile
8+
import os
89

910
from hypothesis import given, settings
1011
from axelrod.tests.property import tournaments, prob_end_tournaments
@@ -398,9 +399,8 @@ class TestResultSetFromFile(unittest.TestCase):
398399

399400
def test_init(self):
400401
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))
404404
self.assertEqual(brs.nrepetitions, 3)
405405

406406
def test_init_with_different_game(self):
@@ -409,6 +409,30 @@ def test_init_with_different_game(self):
409409
game=game)
410410
self.assertEqual(brs.game.RPST(), (-1, -1, -1, -1))
411411

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+
412436
def test_equality(self):
413437
"""A test that checks overall equality by comparing to the base result
414438
set class"""

0 commit comments

Comments
 (0)