|
1 | 1 | from ctypes import c_int, c_float, POINTER, CDLL
|
2 | 2 | import itertools
|
| 3 | +import random |
3 | 4 |
|
4 | 5 | import pytest
|
5 | 6 |
|
6 | 7 | from axelrod_fortran import Player, characteristics, all_strategies
|
7 | 8 | from axelrod import (Alternator, Cooperator, Defector, Match, MoranProcess,
|
8 |
| - Game, basic_strategies, seed) |
| 9 | + Game, basic_strategies, seed, Tournament) |
9 | 10 | from axelrod.action import Action
|
10 | 11 |
|
11 | 12 |
|
@@ -180,8 +181,17 @@ def test_no_warning_for_normal_interaction(recwarn):
|
180 | 181 |
|
181 | 182 |
|
182 | 183 | def test_multiple_copies(recwarn):
|
| 184 | + """Test that multiple copies of a strategy doesn't cause any errors.""" |
183 | 185 | players = [Player('ktitfortatc') for _ in range(5)] + [
|
184 | 186 | Player('k42r') for _ in range(5)]
|
185 | 187 | mp = MoranProcess(players)
|
186 | 188 | mp.play()
|
187 |
| - mp.populations_plot() |
| 189 | + assert len(recwarn) == 0 |
| 190 | + |
| 191 | + |
| 192 | +def test_small_tournament(recwarn): |
| 193 | + players = [Player(name) for name in all_strategies] |
| 194 | + players = random.sample(players, 20) |
| 195 | + tournament = Tournament(players, repetitions=1) |
| 196 | + results = tournament.play(processes=2) |
| 197 | + assert len(recwarn) == 0 |
0 commit comments