Skip to content

Commit 16e5fae

Browse files
committed
Fix prober tests in conjunction with test_reponses and attrs
1 parent 5c3c981 commit 16e5fae

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

axelrod/strategies/prober.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class RemorsefulProber(NaiveProber):
206206

207207
name = 'Remorseful Prober'
208208
classifier = {
209-
'memory_depth': 2, # It remembers if it's previous move was random
209+
'memory_depth': 2, # It remembers if its previous move was random
210210
'stochastic': True,
211211
'makes_use_of': set(),
212212
'long_run_time': False,

axelrod/tests/unit/test_prober.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -192,32 +192,22 @@ def test_strategy(self):
192192
opponent.history = [C, D]
193193
self.assertEqual(player.strategy(opponent), D)
194194

195-
def test_random_defection(self):
196-
# Random defection
197-
player = self.player(0.4)
198-
opponent = axelrod.Random()
199-
test_responses(self, player, opponent, [C], [C], [D], random_seed=1)
200-
201195
def test_remorse(self):
202196
"""After probing, if opponent retaliates, will offer a C"""
203197
player = self.player(0.4)
204-
opponent = axelrod.Random()
198+
opponent = axelrod.Cooperator()
205199

206-
random.seed(0)
207-
player.history = [C]
208-
opponent.history = [C]
209-
self.assertEqual(player.strategy(opponent), D) # Random defection
210-
self.assertEqual(player.probing, True)
200+
test_responses(self, player, opponent, [C], [C], [C],
201+
random_seed=0, attrs = {'probing': False})
211202

212-
player.history = [C, D]
213-
opponent.history = [C, D]
214-
self.assertEqual(player.strategy(opponent), C) # Remorse
215-
self.assertEqual(player.probing, False)
203+
test_responses(self, player, opponent, [C], [C], [D],
204+
random_seed=1, attrs={'probing': True})
216205

217-
player.history = [C, D, C]
218-
opponent.history = [C, D, D]
219-
self.assertEqual(player.strategy(opponent), D)
220-
self.assertEqual(player.probing, False)
206+
test_responses(self, player, opponent, [C, D], [C, D], [D],
207+
attrs = {'probing': False})
208+
209+
test_responses(self, player, opponent, [C, D, C], [C, D, D], [D],
210+
attrs = {'probing': False})
221211

222212
def test_reduction_to_TFT(self):
223213
player = self.player(0)
@@ -236,3 +226,9 @@ def test_reset_probing(self):
236226
player.probing = True
237227
player.reset()
238228
self.assertFalse(player.probing)
229+
230+
def test_random_defection(self):
231+
# Random defection
232+
player = self.player(0.4)
233+
opponent = axelrod.Random()
234+
test_responses(self, player, opponent, [C], [C], [D], random_seed=1)

0 commit comments

Comments
 (0)