Ejemplo n.º 1
0
 def test_unique_multiple_processes_init(self):
     n = 100
     core.get_random_seed()
     assert core.get_seed_rng() is not None
     with multiprocessing.Pool(5) as pool:
         seeds = pool.map(get_seed, range(n))
         assert len(set(seeds)) == n
Ejemplo n.º 2
0
 def test_unique_multiple_processes_init(self):
     n = 100
     core.get_random_seed()
     self.assertIsNotNone(core.get_seed_rng())
     # Would use with block here, but not supported in Py < 3.3.
     pool = multiprocessing.Pool(5)
     seeds = pool.map(get_seed, range(n))
     self.assertEqual(len(set(seeds)), n)
     pool.terminate()
     pool.join()
Ejemplo n.º 3
0
 def test_seed_generator_init(self):
     core.clear_seed_rng()
     seed = core.get_random_seed()
     self.assertGreater(seed, 0)
     self.assertIsNotNone(core.get_seed_rng())
Ejemplo n.º 4
0
 def test_seed_generator_init(self):
     core.clear_seed_rng()
     seed = core.get_random_seed()
     assert seed > 0
     assert core.get_seed_rng() is not None