Skip to content

Commit 7163497

Browse files
committed
Fix docstrings, remove comments, and update a few tests based on round 1 of review
1 parent 1e4ee69 commit 7163497

File tree

7 files changed

+17
-24
lines changed

7 files changed

+17
-24
lines changed

axelrod/tests/integration/test_filtering.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ def test_memory_depth_filtering(
9292
filtered = set(axl.filtered_strategies(filterset, strategies=strategies))
9393
self.assertEqual(comprehension, filtered)
9494

95-
@given(seed_=integers(min_value=0, max_value=4294967295),
96-
strategies=strategy_lists(min_size=20, max_size=20),
97-
)
95+
@given(strategies=strategy_lists(min_size=20, max_size=20))
9896
@settings(max_examples=5, deadline=None)
9997
def test_makes_use_of_filtering(self, strategies):
10098
"""

axelrod/tests/strategies/test_calculator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TestCalculator(TestPlayer):
2323
}
2424

2525
def test_twenty_rounds_joss_for_cyclers(self):
26-
"""Uses axelrod.strategies.axelrod_first.Joss strategy for first 20 rounds"""
26+
"""Uses axelrod.strategies.axelrod_first.FirstByJoss strategy for first 20 rounds"""
2727
seed = 4
2828
match = axl.Match((axl.FirstByJoss(), axl.Alternator()), turns=20, seed=seed)
2929
match.play()
@@ -32,7 +32,7 @@ def test_twenty_rounds_joss_for_cyclers(self):
3232
)
3333

3434
def test_twenty_rounds_joss_then_defects_for_cyclers(self):
35-
"""Uses axelrod.strategies.axelrod_first.Joss strategy for first 20 rounds"""
35+
"""Uses axelrod.strategies.axelrod_first.FirstByJoss strategy for first 20 rounds"""
3636
seed = 4
3737
match = axl.Match((axl.FirstByJoss(), axl.Alternator()), turns=20, seed=seed)
3838
match.play()
@@ -42,7 +42,7 @@ def test_twenty_rounds_joss_then_defects_for_cyclers(self):
4242
)
4343

4444
def test_twenty_rounds_joss_for_noncyclers(self):
45-
"""Uses axelrod.strategies.axelrod_first.Joss strategy for first 20 rounds"""
45+
"""Uses axelrod.strategies.axelrod_first.FirstByJoss strategy for first 20 rounds"""
4646
seed = 4
4747
match = axl.Match((axl.FirstByJoss(), axl.AntiCycler()), turns=20, seed=seed)
4848
match.play()
@@ -51,7 +51,7 @@ def test_twenty_rounds_joss_for_noncyclers(self):
5151
)
5252

5353
def test_twenty_rounds_joss_then_tft_for_noncyclers(self):
54-
"""Uses axelrod.strategies.axelrod_first.Joss strategy for first 20 rounds"""
54+
"""Uses axelrod.strategies.axelrod_first.FirstByJoss strategy for first 20 rounds"""
5555
seed = 4
5656
match = axl.Match((axl.FirstByJoss(), axl.AntiCycler()), turns=20, seed=seed)
5757
match.play()

axelrod/tests/strategies/test_human.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,3 @@ def test_repr(self):
130130

131131
def equality_of_players_test(self, p1, p2, seed, opponent):
132132
return True
133-
134-
def test_reproducibility_of_play(self):
135-
return True

axelrod/tests/strategies/test_memorytwo.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def test_strategy(self):
255255

256256

257257
class TestMemoryTwoCooperator(TestCooperator):
258-
"""Cooperator is equivalent to MemoryOnePlayer((1, 1, 1, 1), C)"""
258+
"""Cooperator is equivalent to MemoryTwoPlayer((1, 1, ..., 1), C)"""
259259
name = "Generic Memory Two Player: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], (C, C)"
260260
player = lambda x: axl.MemoryTwoPlayer(sixteen_vector=[1] * 16, initial=(C, C))
261261
expected_classifier = {
@@ -270,7 +270,7 @@ class TestMemoryTwoCooperator(TestCooperator):
270270

271271

272272
class TestMemoryTwoDefector(TestDefector):
273-
"""Defector is equivalent to MemoryOnePlayer((0, 0, 0, 0), D)"""
273+
"""Defector is equivalent to MemoryTwoPlayer((0, 0, ..., 0), D)"""
274274
name = "Generic Memory Two Player: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], (D, D)"
275275
player = lambda x: axl.MemoryTwoPlayer(sixteen_vector=[0] * 16, initial=(D, D))
276276
expected_classifier = {
@@ -291,10 +291,9 @@ def four_vector_to_sixteen_vector(four_vector):
291291

292292

293293
class TestMemoryTwoAlternator(TestAlternator):
294-
"""Alternator is equivalent to MemoryOnePlayer((0, 0, 1, 1), C)"""
294+
"""Alternator is equivalent to MemoryTwoPlayer(0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1), C)."""
295295
name = "Generic Memory Two Player: [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1], (C, D)"
296296
player = lambda x: axl.MemoryTwoPlayer(sixteen_vector=four_vector_to_sixteen_vector((0, 0, 1, 1)), initial=(C, D))
297-
# player = lambda x: axl.MemoryTwoPlayer(sixteen_vector=four_vector_to_sixteen_vector((1, 1, 0, 0)), initial=(C, D))
298297
expected_classifier = {
299298
"memory_depth": 1,
300299
"stochastic": False,

axelrod/tests/strategies/test_meta.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,8 @@ def test_stochasticity(self):
180180
player = axl.MetaWinnerEnsemble(team=team)
181181
self.assertTrue(Classifiers["stochastic"](player))
182182

183-
# If the players are all identical, a multiplayer
184-
# team might is in fact deterministic, even though random values
185-
# are being drawn.
183+
# If the players are all identical, a multiplayer team might in fact
184+
# be deterministic, even though random values are being drawn.
186185
team = [axl.Cooperator, axl.Cooperator]
187186
player = axl.MetaWinnerEnsemble(team=team)
188187
self.assertFalse(Classifiers["stochastic"](player))

axelrod/tests/strategies/test_player.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,8 @@ def versus_test(
656656
self.assertEqual(getattr(player1, attr), value)
657657

658658
def search_seeds(self, *args, **kwargs): # pragma: no cover
659-
"""Search for a seed that will pass the test. To use to find a new seed
660-
for a versus_test, change self.versus_test to self.search_seeds
659+
"""Search for a seed that will pass the test. Use to find a new seed
660+
for a versus_test by changing self.versus_test to self.search_seeds
661661
within a TestPlayer or TestMatch class.
662662
"""
663663
for seed in range(1, 100000):

axelrod/tests/strategies/test_titfortat.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ def test_output_from_literature(self):
669669
]
670670

671671
turns = 1000
672-
tournament = axl.Tournament(players, turns=turns, repetitions=1, seed=1)
672+
tournament = axl.Tournament(players, turns=turns, repetitions=1, seed=75)
673673
results = tournament.play(progress_bar=False)
674674
scores = [
675675
round(average_score_per_turn * 1000, 1)
@@ -678,7 +678,7 @@ def test_output_from_literature(self):
678678
expected_scores = [
679679
3000.0,
680680
915.0,
681-
2756.0,
681+
2763.0,
682682
3000.0,
683683
3000.0,
684684
2219.0,
@@ -1031,7 +1031,7 @@ class Test1TitsFor1TatsIsTFT(TestTitForTat):
10311031

10321032

10331033
class Test1TitsFor2TatsIsTF2T(TestTitFor2Tats):
1034-
"""Tests that for N = 1 = M, all the TFT tests are passed."""
1034+
"""Tests that for N = 1, M = 2, all the TF2T tests are passed."""
10351035
name = "N Tit(s) For M Tat(s): 1, 2"
10361036
player = lambda x: axl.NTitsForMTats(1, 2)
10371037
expected_classifier = {
@@ -1045,8 +1045,8 @@ class Test1TitsFor2TatsIsTF2T(TestTitFor2Tats):
10451045
}
10461046

10471047

1048-
class Test2TitsFor1TatsIsT2FT(TestTwoTitsForTat):
1049-
"""Tests that for N = 1 = M, all the TFT tests are passed."""
1048+
class Test2TitsFor1TatsIs2TFT(TestTwoTitsForTat):
1049+
"""Tests that for N = 2, M = 1, all the 2TFT tests are passed."""
10501050
name = "N Tit(s) For M Tat(s): 2, 1"
10511051
player = lambda x: axl.NTitsForMTats(2, 1)
10521052
expected_classifier = {

0 commit comments

Comments
 (0)