Skip to content

Commit 19b2022

Browse files
authored
Merge pull request #1035 from Axelrod-Python/884-mockplayer
Minor refactor of Mock Player tests
2 parents 45be8c5 + 559d51d commit 19b2022

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

axelrod/tests/unit/test_mock_player.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_various(self):
7171

7272
class TestSimulatePlay(unittest.TestCase):
7373

74-
def test_various(self):
74+
def test_opponent_play(self):
7575
p1 = TestOpponent()
7676
p2 = TestOpponent()
7777
self.assertEqual(simulate_play(p1, p2), (C, C))
@@ -81,15 +81,14 @@ def test_various(self):
8181
self.assertEqual(p2.defections, 0)
8282

8383
# TestOpponent always returns C
84-
for h1 in [C, D]:
85-
for h2 in [C, D]:
86-
self.assertEqual(simulate_play(p1, p2, h1, h2), (C, C))
87-
self.assertEqual(p1.cooperations, 3)
88-
self.assertEqual(p2.cooperations, 3)
89-
self.assertEqual(p1.defections, 2)
90-
self.assertEqual(p2.defections, 2)
84+
for _ in range(4):
85+
self.assertEqual(simulate_play(p1, p2, C, C), (C, C))
86+
self.assertEqual(p1.cooperations, 5)
87+
self.assertEqual(p2.cooperations, 5)
88+
self.assertEqual(p1.defections, 0)
89+
self.assertEqual(p2.defections, 0)
9190

92-
def test_various2(self):
91+
def test_simulated_play(self):
9392
p1 = axelrod.Cooperator()
9493
p2 = axelrod.Defector()
9594
self.assertEqual(simulate_play(p1, p2), (C, D))

0 commit comments

Comments
 (0)