Skip to content

Commit 8de6301

Browse files
drvinceknightmarcharper
authored andcommitted
Remove/adjust more tests.
1 parent 3329c46 commit 8de6301

File tree

6 files changed

+4
-98
lines changed

6 files changed

+4
-98
lines changed

axelrod/_strategy_utils.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ def _limited_simulate_play(player_1, player_2, h1):
7777
for both players. Note that player_1's move is an argument.
7878
7979
If you need a more complete simulation, see `simulate_play` in
80-
player.py. This function is specifically designed for the needs
81-
of MindReader.
80+
player.py.
8281
8382
Parameters
8483
----------
@@ -94,24 +93,6 @@ def _limited_simulate_play(player_1, player_2, h1):
9493
player_2.update_history(h2, h1)
9594

9695

97-
def simulate_match(player_1, player_2, strategy, rounds=10):
98-
"""Simulates a number of rounds with a constant strategy.
99-
100-
Parameters
101-
----------
102-
player_1: Player
103-
The player that will have a constant strategy.
104-
player_2: Player
105-
The player we want to simulate.
106-
strategy: Action
107-
The constant strategy to use for first player.
108-
rounds: int
109-
The number of rounds to play.
110-
"""
111-
for match in range(rounds):
112-
_limited_simulate_play(player_1, player_2, strategy)
113-
114-
11596
def _calculate_scores(p1, p2, game):
11697
"""Calculates the scores for two players based their history.
11798

axelrod/tests/strategies/test_darwin.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,6 @@ def test_strategy(self):
6161
expected_actions = [(C, C)] + [(D, C)] * 3 + [(C, C)] * 2
6262
self.versus_test(axl.Cooperator(), expected_actions)
6363

64-
def test_against_geller_and_mindreader(self):
65-
self.versus_test(
66-
axl.GellerCooperator(),
67-
expected_actions=[(C, C)] * 2,
68-
attrs={"genome": [C, C]},
69-
)
70-
71-
self.versus_test(
72-
axl.MindReader(),
73-
expected_actions=[(C, D)] * 2,
74-
attrs={"genome": [D, C]},
75-
)
76-
7764
def test_reset_history_and_attributes(self):
7865
# Overwrite this method because Darwin does not reset
7966
self.versus_test(

axelrod/tests/strategies/test_player.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,7 @@ def test_reset_clone(self):
467467
def test_clone_reproducible_play(self, seed, turns, noise):
468468
# Test that the cloned player produces identical play
469469
player = self.player()
470-
if player.name in [
471-
"Darwin",
472-
"Human",
473-
"Mind Bender",
474-
"Mind Controller",
475-
"Mind Warper",
476-
]:
470+
if player.name in ["Darwin", "Human"]:
477471
# Known exceptions
478472
return
479473

axelrod/tests/unit/test_classification.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ def test_obey_axelrod(self):
162162
"""A test that verifies if the obey_axl function works correctly"""
163163
known_cheaters = [
164164
axl.Darwin,
165-
axl.Geller,
166-
axl.GellerCooperator,
167-
axl.GellerDefector,
168165
]
169166

170167
known_basic = [
@@ -208,9 +205,6 @@ def test_is_basic(self):
208205
"""A test that verifies if the is_basic function works correctly"""
209206
known_cheaters = [
210207
axl.Darwin,
211-
axl.Geller,
212-
axl.GellerCooperator,
213-
axl.GellerDefector,
214208
]
215209

216210
known_basic = [

axelrod/tests/unit/test_moran.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,8 @@ def test_four_players(self):
302302

303303
@given(strategies=strategy_lists(min_size=2, max_size=4))
304304
@settings(max_examples=5, deadline=None)
305-
# Two specific examples relating to cloning of strategies
306-
@example(strategies=[axl.BackStabber, axl.MindReader])
307-
@example(strategies=[axl.ThueMorse, axl.MindReader])
305+
# A specific example relating to cloning of strategies
306+
@example(strategies=[axl.ThueMorse, axl.BackStabber])
308307
def test_property_players(self, strategies):
309308
"""Hypothesis test that randomly checks players"""
310309
players = [s() for s in strategies]

axelrod/tests/unit/test_strategy_utils.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
inspect_strategy,
88
look_ahead,
99
recursive_thue_morse,
10-
simulate_match,
1110
thue_morse_generator,
1211
)
1312
from hypothesis import given, settings
@@ -81,54 +80,6 @@ def test_strategies_without_countermeasures_return_their_strategy(self):
8180
self.assertEqual(inspect_strategy(inspector=inspector, opponent=tft), D)
8281
self.assertEqual(tft.strategy(inspector), D)
8382

84-
def test_strategies_with_countermeasures_return_their_countermeasures(self):
85-
d_geller = axl.GellerDefector()
86-
inspector = axl.Cooperator()
87-
match = axl.Match((d_geller, inspector), turns=1)
88-
match.play()
89-
self.assertEqual(
90-
inspect_strategy(inspector=inspector, opponent=d_geller), D
91-
)
92-
self.assertEqual(d_geller.strategy(inspector), C)
93-
94-
95-
class TestSimulateMatch(unittest.TestCase):
96-
def test_tft_reacts_to_cooperation(self):
97-
tft = axl.TitForTat()
98-
inspector = axl.Alternator()
99-
100-
simulate_match(inspector, tft, C, 5)
101-
self.assertEqual(inspector.history, [C, C, C, C, C])
102-
self.assertEqual(tft.history, [C, C, C, C, C])
103-
104-
def test_tft_reacts_to_defection(self):
105-
tft = axl.TitForTat()
106-
inspector = axl.Alternator()
107-
108-
simulate_match(inspector, tft, D, 5)
109-
self.assertEqual(inspector.history, [D, D, D, D, D])
110-
self.assertEqual(tft.history, [C, D, D, D, D])
111-
112-
113-
class TestLookAhead(unittest.TestCase):
114-
def setUp(self):
115-
self.inspector = axl.Player()
116-
self.game = axl.Game()
117-
118-
def test_cooperator(self):
119-
tft = axl.Cooperator()
120-
# It always makes sense to defect here.
121-
self.assertEqual(look_ahead(self.inspector, tft, self.game, 1), D)
122-
self.assertEqual(look_ahead(self.inspector, tft, self.game, 2), D)
123-
self.assertEqual(look_ahead(self.inspector, tft, self.game, 5), D)
124-
125-
def test_tit_for_tat(self):
126-
tft = axl.TitForTat()
127-
# Cooperation should be chosen if we look ahead further than one move.
128-
self.assertEqual(look_ahead(self.inspector, tft, self.game, 1), D)
129-
self.assertEqual(look_ahead(self.inspector, tft, self.game, 2), C)
130-
self.assertEqual(look_ahead(self.inspector, tft, self.game, 5), C)
131-
13283

13384
class TestRecursiveThueMorse(unittest.TestCase):
13485
def test_initial_values(self):

0 commit comments

Comments
 (0)