Skip to content

Commit b9e837c

Browse files
committed
Fixing randomize test
1 parent a4f275b commit b9e837c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

axelrod/tests/unit/test_random_.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ def test_generator(self):
7171
class TestPdf(unittest.TestCase):
7272
"""A suite of tests for the Pdf class"""
7373

74+
seed = 0
7475
observations = [(C, D)] * 4 + [(C, C)] * 12 + [(D, C)] * 2 + [(D, D)] * 15
7576
counter = Counter(observations)
76-
pdf = axl.Pdf(counter)
77+
pdf = axl.Pdf(counter, seed=seed)
7778

7879
def test_init(self):
7980
self.assertEqual(set(self.pdf.sample_space), set(self.counter.keys()))
@@ -84,9 +85,7 @@ def test_init(self):
8485
def test_sample(self):
8586
"""Test that sample maps to correct domain"""
8687
all_samples = []
87-
random = RandomGenerator()
88-
random.seed(0)
89-
for sample in range(100):
88+
for _ in range(100):
9089
all_samples.append(self.pdf.sample())
9190

9291
self.assertEqual(len(all_samples), 100)

0 commit comments

Comments
 (0)